Preserve entries order in DynamicStruct #2410 (#2413)

* Preserve entries order in DynamicStruct #2410

* disable C++11 default

* ifdef C++11 code
This commit is contained in:
Aleksandar Fabijanic
2018-08-01 08:06:59 -07:00
committed by GitHub
parent 6107b43a7b
commit 231ef2762d
11 changed files with 825 additions and 73 deletions

View File

@@ -21,16 +21,20 @@
#include "Poco/Foundation.h"
#include "Poco/Format.h"
#include "Poco/SharedPtr.h"
#include "Poco/OrderedMap.h"
#include "Poco/OrderedSet.h"
#include "Poco/Dynamic/VarHolder.h"
#include "Poco/Dynamic/VarIterator.h"
#include <typeinfo>
#include <map>
#include <set>
namespace Poco {
namespace Dynamic {
template <typename T>
template <typename K, typename M, typename S>
class Struct;
@@ -449,6 +453,10 @@ public:
bool isStruct() const;
/// Returns true if Var represents a struct.
bool isOrdered() const;
/// Returns true if Var represents an ordered struct,
/// false if struct is sorted.
char& at(std::size_t n);
/// Returns character at position n. This function only works with
/// Var containing a std::string.
@@ -595,7 +603,11 @@ private:
throw E(errorMessage);
}
Var& structIndexOperator(VarHolderImpl<Struct<int> >* pStr, int n) const;
template <typename T, typename N>
Var& structIndexOperator(T* pStr, N n) const
{
return pStr->operator[](n);
}
#ifdef POCO_NO_SOO
@@ -822,6 +834,13 @@ inline bool Var::isStruct() const
}
inline bool Var::isOrdered() const
{
VarHolder* pHolder = content();
return pHolder ? pHolder->isOrdered() : false;
}
inline bool Var::isInteger() const
{
VarHolder* pHolder = content();