mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-12 18:10:27 +01:00
remove JSON_HAS_RVALUE_REFERENCES
This commit is contained in:
parent
00558b38db
commit
9a55d22d3d
@ -97,30 +97,6 @@ msvc_pre1900_c99_snprintf(char* outBuf, size_t size, const char* format, ...);
|
|||||||
#define JSONCPP_OP_EXPLICIT
|
#define JSONCPP_OP_EXPLICIT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef JSON_HAS_RVALUE_REFERENCES
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define JSON_HAS_RVALUE_REFERENCES 1
|
|
||||||
#endif // MSVC >= 2013
|
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#if __has_feature(cxx_rvalue_references)
|
|
||||||
#define JSON_HAS_RVALUE_REFERENCES 1
|
|
||||||
#endif // has_feature
|
|
||||||
|
|
||||||
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
|
|
||||||
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
|
|
||||||
#define JSON_HAS_RVALUE_REFERENCES 1
|
|
||||||
#endif // GXX_EXPERIMENTAL
|
|
||||||
|
|
||||||
#endif // __clang__ || __GNUC__
|
|
||||||
|
|
||||||
#endif // not defined JSON_HAS_RVALUE_REFERENCES
|
|
||||||
|
|
||||||
#ifndef JSON_HAS_RVALUE_REFERENCES
|
|
||||||
#define JSON_HAS_RVALUE_REFERENCES 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#if __has_extension(attribute_deprecated_with_message)
|
#if __has_extension(attribute_deprecated_with_message)
|
||||||
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||||
|
@ -251,15 +251,10 @@ private:
|
|||||||
CZString(ArrayIndex index);
|
CZString(ArrayIndex index);
|
||||||
CZString(char const* str, unsigned length, DuplicationPolicy allocate);
|
CZString(char const* str, unsigned length, DuplicationPolicy allocate);
|
||||||
CZString(CZString const& other);
|
CZString(CZString const& other);
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
CZString(CZString&& other);
|
CZString(CZString&& other);
|
||||||
#endif
|
|
||||||
~CZString();
|
~CZString();
|
||||||
CZString& operator=(const CZString& other);
|
CZString& operator=(const CZString& other);
|
||||||
|
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
CZString& operator=(CZString&& other);
|
CZString& operator=(CZString&& other);
|
||||||
#endif
|
|
||||||
|
|
||||||
bool operator<(CZString const& other) const;
|
bool operator<(CZString const& other) const;
|
||||||
bool operator==(CZString const& other) const;
|
bool operator==(CZString const& other) const;
|
||||||
@ -468,10 +463,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
|||||||
///
|
///
|
||||||
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
|
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
|
||||||
Value& append(const Value& value);
|
Value& append(const Value& value);
|
||||||
|
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
Value& append(Value&& value);
|
Value& append(Value&& value);
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Access an object value by name, create a null member if it does not exist.
|
/// Access an object value by name, create a null member if it does not exist.
|
||||||
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.
|
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.
|
||||||
|
@ -276,12 +276,10 @@ Value::CZString::CZString(const CZString& other) {
|
|||||||
storage_.length_ = other.storage_.length_;
|
storage_.length_ = other.storage_.length_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
Value::CZString::CZString(CZString&& other)
|
Value::CZString::CZString(CZString&& other)
|
||||||
: cstr_(other.cstr_), index_(other.index_) {
|
: cstr_(other.cstr_), index_(other.index_) {
|
||||||
other.cstr_ = nullptr;
|
other.cstr_ = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Value::CZString::~CZString() {
|
Value::CZString::~CZString() {
|
||||||
if (cstr_ && storage_.policy_ == duplicate) {
|
if (cstr_ && storage_.policy_ == duplicate) {
|
||||||
@ -304,14 +302,12 @@ Value::CZString& Value::CZString::operator=(const CZString& other) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
Value::CZString& Value::CZString::operator=(CZString&& other) {
|
Value::CZString& Value::CZString::operator=(CZString&& other) {
|
||||||
cstr_ = other.cstr_;
|
cstr_ = other.cstr_;
|
||||||
index_ = other.index_;
|
index_ = other.index_;
|
||||||
other.cstr_ = nullptr;
|
other.cstr_ = nullptr;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool Value::CZString::operator<(const CZString& other) const {
|
bool Value::CZString::operator<(const CZString& other) const {
|
||||||
if (!cstr_)
|
if (!cstr_)
|
||||||
@ -1169,11 +1165,9 @@ Value const& Value::operator[](CppTL::ConstString const& key) const {
|
|||||||
|
|
||||||
Value& Value::append(const Value& value) { return (*this)[size()] = value; }
|
Value& Value::append(const Value& value) { return (*this)[size()] = value; }
|
||||||
|
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
Value& Value::append(Value&& value) {
|
Value& Value::append(Value&& value) {
|
||||||
return (*this)[size()] = std::move(value);
|
return (*this)[size()] = std::move(value);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Value Value::get(char const* begin,
|
Value Value::get(char const* begin,
|
||||||
char const* end,
|
char const* end,
|
||||||
@ -1198,11 +1192,7 @@ bool Value::removeMember(const char* begin, const char* end, Value* removed) {
|
|||||||
if (it == value_.map_->end())
|
if (it == value_.map_->end())
|
||||||
return false;
|
return false;
|
||||||
if (removed)
|
if (removed)
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
*removed = std::move(it->second);
|
*removed = std::move(it->second);
|
||||||
#else
|
|
||||||
*removed = it->second;
|
|
||||||
#endif
|
|
||||||
value_.map_->erase(it);
|
value_.map_->erase(it);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2499,7 +2499,6 @@ JSONTEST_FIXTURE(IteratorTest, const) {
|
|||||||
struct RValueTest : JsonTest::TestCase {};
|
struct RValueTest : JsonTest::TestCase {};
|
||||||
|
|
||||||
JSONTEST_FIXTURE(RValueTest, moveConstruction) {
|
JSONTEST_FIXTURE(RValueTest, moveConstruction) {
|
||||||
#if JSON_HAS_RVALUE_REFERENCES
|
|
||||||
Json::Value json;
|
Json::Value json;
|
||||||
json["key"] = "value";
|
json["key"] = "value";
|
||||||
Json::Value moved = std::move(json);
|
Json::Value moved = std::move(json);
|
||||||
@ -2507,7 +2506,6 @@ JSONTEST_FIXTURE(RValueTest, moveConstruction) {
|
|||||||
// equal.
|
// equal.
|
||||||
JSONTEST_ASSERT_EQUAL(Json::objectValue, moved.type());
|
JSONTEST_ASSERT_EQUAL(Json::objectValue, moved.type());
|
||||||
JSONTEST_ASSERT_EQUAL(Json::stringValue, moved["key"].type());
|
JSONTEST_ASSERT_EQUAL(Json::stringValue, moved["key"].type());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main(int argc, const char* argv[]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user