mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
parent
fac2437fab
commit
fc47df04cd
@ -22,6 +22,7 @@
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Poco::trimLeft;
|
||||
|
@ -38,13 +38,8 @@ namespace JSON {
|
||||
|
||||
|
||||
class JSON_API Object
|
||||
<<<<<<< HEAD
|
||||
/// Represents a JSON object. Object provides a representation
|
||||
/// based on shared pointers and optimized for performance. It is possible to
|
||||
=======
|
||||
/// Represents a JSON object. Object provides a representation based on
|
||||
/// shared pointers and optimized for performance. It is possible to
|
||||
>>>>>>> df5968ce1... Json unicode escape && preserveOrder keys sync (#2145)
|
||||
/// convert Object to DynamicStruct. Conversion requires copying and therefore
|
||||
/// has performance penalty; the benefit is in improved syntax, eg:
|
||||
///
|
||||
@ -75,10 +70,6 @@ public:
|
||||
explicit Object(int options = 0);
|
||||
/// Creates an empty Object.
|
||||
///
|
||||
<<<<<<< HEAD
|
||||
/// If preserveInsertionOrder, object will preserve the items insertion
|
||||
/// order. Otherwise, items will be sorted by keys.
|
||||
=======
|
||||
/// If JSON_PRESERVE_KEY_ORDER is specified, the object will
|
||||
/// preserve the items insertion order. Otherwise, items will be
|
||||
/// sorted by keys.
|
||||
@ -86,7 +77,6 @@ public:
|
||||
/// If JSON_ESCAPE_UNICODE is specified, when the object is
|
||||
/// stringified, all unicode characters will be escaped in the
|
||||
/// resulting string.
|
||||
>>>>>>> df5968ce1... Json unicode escape && preserveOrder keys sync (#2145)
|
||||
|
||||
Object(const Object& copy);
|
||||
/// Creates an Object by copying another one.
|
||||
@ -110,18 +100,8 @@ public:
|
||||
Object &operator =(const Object &other);
|
||||
// Assignment operator
|
||||
|
||||
<<<<<<< HEAD
|
||||
Iterator begin()
|
||||
{
|
||||
return _values.begin();
|
||||
}
|
||||
=======
|
||||
Object &operator =(Object &&other);
|
||||
// Move asignment operator
|
||||
|
||||
void setEscapeUnicode(bool escape = true);
|
||||
/// Sets the flag for escaping unicode.
|
||||
>>>>>>> df5968ce1... Json unicode escape && preserveOrder keys sync (#2145)
|
||||
|
||||
bool getEscapeUnicode() const;
|
||||
/// Returns the flag for escaping unicode.
|
||||
|
@ -26,7 +26,7 @@ namespace JSON {
|
||||
|
||||
|
||||
Array::Array(int options): _modified(false),
|
||||
_escapeUnicode(options & Poco::JSON_ESCAPE_UNICODE)
|
||||
_escapeUnicode((options & Poco::JSON_ESCAPE_UNICODE) != 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ namespace JSON {
|
||||
|
||||
|
||||
Object::Object(int options):
|
||||
_preserveInsOrder(options & Poco::JSON_PRESERVE_KEY_ORDER),
|
||||
_escapeUnicode(options & Poco::JSON_ESCAPE_UNICODE),
|
||||
_preserveInsOrder((options & Poco::JSON_PRESERVE_KEY_ORDER) != 0),
|
||||
_escapeUnicode((options & Poco::JSON_ESCAPE_UNICODE) != 0),
|
||||
_modified(false)
|
||||
{
|
||||
}
|
||||
@ -62,17 +62,13 @@ Object &Object::operator= (Object &&other)
|
||||
{
|
||||
if (&other != this)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
_values = std::move(other._values);
|
||||
_keys = std::move(other._keys);
|
||||
=======
|
||||
_values = other._values;
|
||||
>>>>>>> df5968ce1... Json unicode escape && preserveOrder keys sync (#2145)
|
||||
_preserveInsOrder = other._preserveInsOrder;
|
||||
syncKeys(other._keys);
|
||||
_escapeUnicode = other._escapeUnicode;
|
||||
_pStruct = !other._modified ? other._pStruct : 0;
|
||||
_modified = other._modified;
|
||||
other.clear();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -96,7 +92,6 @@ Object &Object::operator= (const Object &other)
|
||||
_escapeUnicode = other._escapeUnicode;
|
||||
_pStruct = !other._modified ? other._pStruct : 0;
|
||||
_modified = other._modified;
|
||||
other.clear();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -2073,6 +2073,7 @@ void JSONTest::testCopy()
|
||||
|
||||
void JSONTest::testMove()
|
||||
{
|
||||
#ifdef POCO_ENABLE_CPP11
|
||||
Object obj1(Poco::JSON_PRESERVE_KEY_ORDER);
|
||||
obj1.set("foo", 0);
|
||||
obj1.set("bar", 0);
|
||||
@ -2132,6 +2133,7 @@ void JSONTest::testMove()
|
||||
assert (nl[0] == "foo");
|
||||
assert (nl[1] == "bar");
|
||||
assert (nl[2] == "baz");
|
||||
#endif // POCO_ENABLE_CPP11
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user