This commit is contained in:
Alex Fabijanic 2018-02-08 20:01:36 -06:00
parent fac2437fab
commit fc47df04cd
5 changed files with 7 additions and 29 deletions

View File

@ -22,6 +22,7 @@
#include <cstdio>
#include <map>
#include <set>
#include <sstream>
using Poco::trimLeft;

View File

@ -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.

View File

@ -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)
{
}

View File

@ -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;
}

View File

@ -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
}