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