Use C++11 headers directly if in C++11 mode or when using libc++.

This commit is contained in:
joerg 2013-05-30 15:36:29 +00:00
parent 3fcc3237b4
commit aeaa532297
8 changed files with 262 additions and 13 deletions

View file

@ -1,8 +1,14 @@
$NetBSD: distinfo,v 1.5 2012/11/16 00:40:18 joerg Exp $
$NetBSD: distinfo,v 1.6 2013/05/30 15:36:29 joerg Exp $
SHA1 (libcassandra-20101010.tar.gz) = 457dcf1fd24ad310c63eefb3b532f58835f326ef
RMD160 (libcassandra-20101010.tar.gz) = e3e05861d1c1173d2492d49442aa68ee429d7b8f
Size (libcassandra-20101010.tar.gz) = 873233 bytes
SHA1 (patch-aa) = 387ea4e5ceb65c63e0a8d894035c9ae0fee2b792
SHA1 (patch-aa) = 9cfe12f0fe26514bd7216d49e83248073cf26f4c
SHA1 (patch-libcassandra_cassandra.cc) = 88d78156cbdbf51e0bd59326e72ca230de3a7688
SHA1 (patch-libcassandra_cassandra.h) = 751a4b2847e52c87bbd9ccbf05bdcd62dfbb9ae3
SHA1 (patch-libcassandra_cassandra__factory.cc) = 7582d397c21f81f8cd5b84669204e6e2dfe93e96
SHA1 (patch-libcassandra_cassandra__factory.h) = 602752ecd9d692bef0c692ba54098a75df4047c6
SHA1 (patch-libcassandra_keyspace__factory.cc) = 9ac440c383243fd11e13147e9375e62c48847ebc
SHA1 (patch-libcassandra_keyspace__factory.h) = bd611da5e673ce38a5eb811e6196a903a5a80ff8
SHA1 (patch-libgenthrift_Cassandra.cpp) = b8ab38d7e28f98ad84d0f2cd3459d564a8decfc7
SHA1 (patch-libgenthrift_Cassandra.h) = 271f776e8a4ba898fccd66b951cb7227c7c72cad

View file

@ -1,11 +1,11 @@
$NetBSD: patch-aa,v 1.3 2010/10/16 11:43:30 tonnerre Exp $
$NetBSD: patch-aa,v 1.4 2013/05/30 15:36:29 joerg Exp $
Remove the -pedantic flag from the configure script, it isn't terribly
useful for C++0x code.
--- configure.orig 2010-04-30 23:25:08.000000000 +0000
--- configure.orig 2010-10-10 00:59:59.000000000 +0000
+++ configure
@@ -17830,7 +17830,7 @@ if test "${ac_cv_safe_to_use_wconversion
@@ -17972,7 +17972,7 @@ if test "${ac_cv_safe_to_use_wconversion
$as_echo_n "(cached) " >&6
else
save_CFLAGS="$CFLAGS"
@ -14,7 +14,7 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -17869,7 +17869,7 @@ if test "${ac_cv_safe_to_use_Wconversion
@@ -18011,7 +18011,7 @@ if test "${ac_cv_safe_to_use_Wconversion
$as_echo_n "(cached) " >&6
else
save_CFLAGS="$CFLAGS"
@ -23,7 +23,7 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -17929,7 +17929,7 @@ if test "${ac_cv_safe_to_use_Wextra_+set
@@ -18071,7 +18071,7 @@ if test "${ac_cv_safe_to_use_Wextra_+set
$as_echo_n "(cached) " >&6
else
save_CFLAGS="$CFLAGS"
@ -32,7 +32,7 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -17956,7 +17956,7 @@ fi
@@ -18098,7 +18098,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_use_Wextra_" >&5
$as_echo "$ac_cv_safe_to_use_Wextra_" >&6; }
@ -41,7 +41,7 @@ useful for C++0x code.
if test "$ac_cv_safe_to_use_Wextra_" = "yes"; then :
BASE_WARNINGS="${BASE_WARNINGS} -Wextra"
else
@@ -17978,7 +17978,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXX
@@ -18120,7 +18120,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXX
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
save_CXXFLAGS="$CXXFLAGS"
@ -50,7 +50,7 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -18021,7 +18021,7 @@ if test "${ac_cv_safe_to_use_Wlogical_op
@@ -18163,7 +18163,7 @@ if test "${ac_cv_safe_to_use_Wlogical_op
$as_echo_n "(cached) " >&6
else
save_CFLAGS="$CFLAGS"
@ -59,7 +59,7 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -18063,7 +18063,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXX
@@ -18205,7 +18205,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXX
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
save_CXXFLAGS="${CXXFLAGS}"
@ -68,7 +68,7 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -18113,7 +18113,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXX
@@ -18255,7 +18255,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXX
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
save_CXXFLAGS="${CXXFLAGS}"
@ -77,7 +77,7 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -18171,7 +18171,7 @@ if test "${ac_cv_safe_to_use_Wno_attribu
@@ -18313,7 +18313,7 @@ if test "${ac_cv_safe_to_use_Wno_attribu
$as_echo_n "(cached) " >&6
else
save_CFLAGS="$CFLAGS"
@ -86,3 +86,14 @@ useful for C++0x code.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -21222,8 +21222,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test -z "$ac_cv_cxx_cinttypes"; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include $ac_cv_cxx_cstdint;
- #include <$location>
+#include $ac_cv_cxx_cstdint
+#include <$location>
int
main ()
{

View file

@ -0,0 +1,57 @@
$NetBSD: patch-libcassandra_cassandra.cc,v 1.1 2013/05/30 15:36:29 joerg Exp $
--- libcassandra/cassandra.cc.orig 2013-05-30 10:33:52.000000000 +0000
+++ libcassandra/cassandra.cc
@@ -17,6 +17,13 @@
#include "libcassandra/keyspace.h"
#include "libcassandra/exception.h"
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+#include <memory>
+#else
+#include <tr1/memory>
+using std::tr1::shared_ptr;
+#endif
+
using namespace std;
using namespace org::apache::cassandra;
using namespace libcassandra;
@@ -85,17 +92,17 @@ set<string> Cassandra::getKeyspaces()
}
-tr1::shared_ptr<Keyspace> Cassandra::getKeyspace(const string &name)
+shared_ptr<Keyspace> Cassandra::getKeyspace(const string &name)
{
return getKeyspace(name, DCQUORUM);
}
-tr1::shared_ptr<Keyspace> Cassandra::getKeyspace(const string &name,
+shared_ptr<Keyspace> Cassandra::getKeyspace(const string &name,
ConsistencyLevel level)
{
string keymap_name= buildKeyspaceMapName(name, level);
- map<string, tr1::shared_ptr<Keyspace> >::iterator key_it= keyspace_map.find(keymap_name);
+ map<string, shared_ptr<Keyspace> >::iterator key_it= keyspace_map.find(keymap_name);
if (key_it == keyspace_map.end())
{
getKeyspaces();
@@ -104,7 +111,7 @@ tr1::shared_ptr<Keyspace> Cassandra::get
{
map< string, map<string, string> > keyspace_desc;
thrift_client->describe_keyspace(keyspace_desc, name);
- tr1::shared_ptr<Keyspace> ret(new Keyspace(this, name, keyspace_desc, level));
+ shared_ptr<Keyspace> ret(new Keyspace(this, name, keyspace_desc, level));
keyspace_map[keymap_name]= ret;
}
else
@@ -117,7 +124,7 @@ tr1::shared_ptr<Keyspace> Cassandra::get
}
-void Cassandra::removeKeyspace(tr1::shared_ptr<Keyspace> k)
+void Cassandra::removeKeyspace(shared_ptr<Keyspace> k)
{
string keymap_name= buildKeyspaceMapName(k->getName(), k->getConsistencyLevel());
keyspace_map.erase(keymap_name);

View file

@ -0,0 +1,58 @@
$NetBSD: patch-libcassandra_cassandra.h,v 1.1 2013/05/30 15:36:29 joerg Exp $
--- libcassandra/cassandra.h.orig 2013-05-30 10:29:32.000000000 +0000
+++ libcassandra/cassandra.h
@@ -14,7 +14,11 @@
#include <vector>
#include <set>
#include <map>
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+#include <memory>
+#else
#include <tr1/memory>
+#endif
#include "libgenthrift/cassandra_types.h"
@@ -65,17 +69,29 @@ public:
/**
* @return the keyspace with the given name.
*/
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+ std::shared_ptr<Keyspace> getKeyspace(const std::string &name);
+#else
std::tr1::shared_ptr<Keyspace> getKeyspace(const std::string &name);
+#endif
/**
* @return the keyspace with the given name at the given consistency level.
*/
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+ std::shared_ptr<Keyspace> getKeyspace(const std::string &name, org::apache::cassandra::ConsistencyLevel level);
+#else
std::tr1::shared_ptr<Keyspace> getKeyspace(const std::string &name, org::apache::cassandra::ConsistencyLevel level);
+#endif
/**
* Remove the given keyspace.
*/
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+ void removeKeyspace(std::shared_ptr<Keyspace> k);
+#else
void removeKeyspace(std::tr1::shared_ptr<Keyspace> k);
+#endif
/**
* @return the target server cluster name.
@@ -128,7 +144,11 @@ private:
std::string config_file;
std::set<std::string> key_spaces;
std::map<std::string, std::string> token_map;
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+ std::map<std::string, std::shared_ptr<Keyspace> > keyspace_map;
+#else
std::map<std::string, std::tr1::shared_ptr<Keyspace> > keyspace_map;
+#endif
Cassandra(const Cassandra&);
Cassandra &operator=(const Cassandra&);

View file

@ -0,0 +1,25 @@
$NetBSD: patch-libcassandra_cassandra__factory.cc,v 1.1 2013/05/30 15:36:29 joerg Exp $
--- libcassandra/cassandra_factory.cc.orig 2013-05-30 10:34:39.000000000 +0000
+++ libcassandra/cassandra_factory.cc
@@ -63,17 +63,17 @@ CassandraFactory::CassandraFactory(const
CassandraFactory::~CassandraFactory() {}
-tr1::shared_ptr<Cassandra> CassandraFactory::create()
+std::shared_ptr<Cassandra> CassandraFactory::create()
{
/* Default is Buffered Transport */
return create(false);
}
-tr1::shared_ptr<Cassandra> CassandraFactory::create(bool framed_transport)
+std::shared_ptr<Cassandra> CassandraFactory::create(bool framed_transport)
{
CassandraClient *thrift_client= createThriftClient(host, port, framed_transport);
- tr1::shared_ptr<Cassandra> ret(new Cassandra(thrift_client, host, port));
+ std::shared_ptr<Cassandra> ret(new Cassandra(thrift_client, host, port));
return ret;
}

View file

@ -0,0 +1,30 @@
$NetBSD: patch-libcassandra_cassandra__factory.h,v 1.1 2013/05/30 15:36:29 joerg Exp $
--- libcassandra/cassandra_factory.h.orig 2013-05-30 10:31:55.000000000 +0000
+++ libcassandra/cassandra_factory.h
@@ -12,7 +12,11 @@
#include <string>
#include <vector>
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+#include <memory>
+#else
#include <tr1/memory>
+#endif
namespace org
{
@@ -44,8 +48,13 @@ public:
/**
* @return a shared ptr which points to a Cassandra client
*/
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+ std::shared_ptr<Cassandra> create();
+ std::shared_ptr<Cassandra> create(bool framed_transport);
+#else
std::tr1::shared_ptr<Cassandra> create();
std::tr1::shared_ptr<Cassandra> create(bool framed_transport);
+#endif
int getPort() const;
const std::string &getHost() const;

View file

@ -0,0 +1,28 @@
$NetBSD: patch-libcassandra_keyspace__factory.cc,v 1.1 2013/05/30 15:36:29 joerg Exp $
--- libcassandra/keyspace_factory.cc.orig 2013-05-30 11:03:36.000000000 +0000
+++ libcassandra/keyspace_factory.cc
@@ -34,6 +34,16 @@ KeyspaceFactory::KeyspaceFactory() {}
KeyspaceFactory::~KeyspaceFactory() {}
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+std::shared_ptr<Keyspace> KeyspaceFactory::create(Cassandra *client,
+ const string &name,
+ const map< string, map<string, string> > &descrip,
+ ConsistencyLevel level)
+{
+ std::shared_ptr<Keyspace> ret(new Keyspace(client, name, descrip, level));
+ return ret;
+}
+#else
tr1::shared_ptr<Keyspace> KeyspaceFactory::create(Cassandra *client,
const string &name,
const map< string, map<string, string> > &descrip,
@@ -42,4 +52,4 @@ tr1::shared_ptr<Keyspace> KeyspaceFactor
tr1::shared_ptr<Keyspace> ret(new Keyspace(client, name, descrip, level));
return ret;
}
-
+#endif
\ No newline at end of file

View file

@ -0,0 +1,34 @@
$NetBSD: patch-libcassandra_keyspace__factory.h,v 1.1 2013/05/30 15:36:29 joerg Exp $
--- libcassandra/keyspace_factory.h.orig 2013-05-30 10:36:25.000000000 +0000
+++ libcassandra/keyspace_factory.h
@@ -12,7 +12,11 @@
#include <string>
#include <map>
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+#include <memory>
+#else
#include <tr1/memory>
+#endif
namespace libcassandra
{
@@ -31,10 +35,17 @@ public:
/**
* @return a shared ptr which points to a Keyspace class
*/
+#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
+ std::shared_ptr<Keyspace> create(Cassandra *client,
+ const std::string &name,
+ const std::map< std::string, std::map<std::string, std::string> > &descrip,
+ org::apache::cassandra::ConsistencyLevel level);
+#else
std::tr1::shared_ptr<Keyspace> create(Cassandra *client,
const std::string &name,
const std::map< std::string, std::map<std::string, std::string> > &descrip,
org::apache::cassandra::ConsistencyLevel level);
+#endif
};