mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-26 10:10:46 +01:00
back-port JSON and accompanying Foundation portions (JSONString, Dynamic::Var etc)
This commit is contained in:
@@ -71,6 +71,19 @@ public:
|
||||
Array(const Array& copy);
|
||||
/// Creates an Array by copying another one.
|
||||
|
||||
#ifdef POCO_ENABLE_CPP11
|
||||
|
||||
Array(Array&& other);
|
||||
/// Move constructor
|
||||
|
||||
Array& operator=(Array&& other);
|
||||
/// Move assignment operator.
|
||||
|
||||
#endif // POCO_ENABLE_CPP11
|
||||
|
||||
Array& operator=(const Array& other);
|
||||
/// Assignment operator.
|
||||
|
||||
virtual ~Array();
|
||||
/// Destroys the Array.
|
||||
|
||||
@@ -165,6 +178,7 @@ public:
|
||||
/// Removes the element on the given index.
|
||||
|
||||
operator const Poco::Dynamic::Array& () const;
|
||||
/// Conversion operator to Dynamic::Array.
|
||||
|
||||
static Poco::Dynamic::Array makeArray(const JSON::Array::Ptr& arr);
|
||||
/// Utility function for creation of array.
|
||||
@@ -173,10 +187,13 @@ public:
|
||||
/// Clears the contents of the array.
|
||||
|
||||
private:
|
||||
void resetDynArray() const;
|
||||
|
||||
typedef SharedPtr<Poco::Dynamic::Array> ArrayPtr;
|
||||
|
||||
ValueVec _values;
|
||||
mutable ArrayPtr _pArray;
|
||||
mutable bool _modified;
|
||||
};
|
||||
|
||||
|
||||
@@ -224,6 +241,7 @@ inline bool Array::isArray(ConstIterator& it) const
|
||||
inline void Array::add(const Dynamic::Var& value)
|
||||
{
|
||||
_values.push_back(value);
|
||||
_modified = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +249,7 @@ inline void Array::set(unsigned int index, const Dynamic::Var& value)
|
||||
{
|
||||
if (index >= _values.size()) _values.resize(index + 1);
|
||||
_values[index] = value;
|
||||
_modified = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -356,11 +375,6 @@ public:
|
||||
return _val;
|
||||
}
|
||||
|
||||
bool isArray() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isInteger() const
|
||||
{
|
||||
return false;
|
||||
@@ -495,11 +509,6 @@ public:
|
||||
return _val;
|
||||
}
|
||||
|
||||
bool isArray() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isInteger() const
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user