mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08: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
|
||||
#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__
|
||||
#if __has_extension(attribute_deprecated_with_message)
|
||||
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
||||
|
@ -251,15 +251,10 @@ private:
|
||||
CZString(ArrayIndex index);
|
||||
CZString(char const* str, unsigned length, DuplicationPolicy allocate);
|
||||
CZString(CZString const& other);
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
CZString(CZString&& other);
|
||||
#endif
|
||||
~CZString();
|
||||
CZString& operator=(const CZString& other);
|
||||
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
CZString& operator=(CZString&& other);
|
||||
#endif
|
||||
|
||||
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;
|
||||
Value& append(const Value& value);
|
||||
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
Value& append(Value&& value);
|
||||
#endif
|
||||
|
||||
/// 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.
|
||||
|
@ -276,12 +276,10 @@ Value::CZString::CZString(const CZString& other) {
|
||||
storage_.length_ = other.storage_.length_;
|
||||
}
|
||||
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
Value::CZString::CZString(CZString&& other)
|
||||
: cstr_(other.cstr_), index_(other.index_) {
|
||||
other.cstr_ = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
Value::CZString::~CZString() {
|
||||
if (cstr_ && storage_.policy_ == duplicate) {
|
||||
@ -304,14 +302,12 @@ Value::CZString& Value::CZString::operator=(const CZString& other) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
Value::CZString& Value::CZString::operator=(CZString&& other) {
|
||||
cstr_ = other.cstr_;
|
||||
index_ = other.index_;
|
||||
other.cstr_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Value::CZString::operator<(const CZString& other) const {
|
||||
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; }
|
||||
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
Value& Value::append(Value&& value) {
|
||||
return (*this)[size()] = std::move(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
Value Value::get(char const* begin,
|
||||
char const* end,
|
||||
@ -1198,11 +1192,7 @@ bool Value::removeMember(const char* begin, const char* end, Value* removed) {
|
||||
if (it == value_.map_->end())
|
||||
return false;
|
||||
if (removed)
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
*removed = std::move(it->second);
|
||||
#else
|
||||
*removed = it->second;
|
||||
#endif
|
||||
value_.map_->erase(it);
|
||||
return true;
|
||||
}
|
||||
|
@ -2499,7 +2499,6 @@ JSONTEST_FIXTURE(IteratorTest, const) {
|
||||
struct RValueTest : JsonTest::TestCase {};
|
||||
|
||||
JSONTEST_FIXTURE(RValueTest, moveConstruction) {
|
||||
#if JSON_HAS_RVALUE_REFERENCES
|
||||
Json::Value json;
|
||||
json["key"] = "value";
|
||||
Json::Value moved = std::move(json);
|
||||
@ -2507,7 +2506,6 @@ JSONTEST_FIXTURE(RValueTest, moveConstruction) {
|
||||
// equal.
|
||||
JSONTEST_ASSERT_EQUAL(Json::objectValue, moved.type());
|
||||
JSONTEST_ASSERT_EQUAL(Json::stringValue, moved["key"].type());
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user