1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2026-01-19 21:54:40 +01:00

Update libraries and make it build on windows.

Still gets some warnings because compilers have changed. But should work.
This commit is contained in:
Sandu Liviu Catalin
2025-06-25 22:34:23 +03:00
parent 520a5eacc5
commit f2b7499f85
3038 changed files with 251668 additions and 273857 deletions

View File

@@ -14,28 +14,40 @@
#include "Poco/JSON/Object.h"
#include <iostream>
#include <sstream>
using Poco::Dynamic::Var;
// Explicitly instatiated shared pointer in JSON library is required to
// have known instance of the pointer to be used with VarHolder when
// compiling with -fvisibility=hidden
#if defined(POCO_OS_FAMILY_WINDOWS)
template class JSON_API Poco::SharedPtr<Poco::JSON::Object>;
#else
template class Poco::SharedPtr<Poco::JSON::Object>;
#endif
namespace Poco {
namespace JSON {
Object::Object(int options):
_preserveInsOrder((options & Poco::JSON_PRESERVE_KEY_ORDER) != 0),
_escapeUnicode((options & Poco::JSON_ESCAPE_UNICODE) != 0),
_lowercaseHex((options & Poco::JSON_LOWERCASE_HEX) != 0),
_modified(false)
{
}
Object::Object(const Object& other) : _values(other._values),
Object::Object(const Object& other) :
_values(other._values),
_preserveInsOrder(other._preserveInsOrder),
_escapeUnicode(other._escapeUnicode),
_pStruct(!other._modified ? other._pStruct : 0),
_lowercaseHex(other._lowercaseHex),
_pStruct(!other._modified ? other._pStruct : nullptr),
_modified(other._modified)
{
syncKeys(other._keys);
@@ -47,6 +59,7 @@ Object::Object(Object&& other) noexcept:
_keys(std::move(other._keys)),
_preserveInsOrder(other._preserveInsOrder),
_escapeUnicode(other._escapeUnicode),
_lowercaseHex(other._lowercaseHex),
_pStruct(std::move(other._pStruct)),
_pOrdStruct(std::move(other._pOrdStruct)),
_modified(other._modified)
@@ -54,9 +67,7 @@ Object::Object(Object&& other) noexcept:
}
Object::~Object()
{
}
Object::~Object() = default;
Object &Object::operator = (const Object &other)
@@ -67,7 +78,8 @@ Object &Object::operator = (const Object &other)
_keys = other._keys;
_preserveInsOrder = other._preserveInsOrder;
_escapeUnicode = other._escapeUnicode;
_pStruct = !other._modified ? other._pStruct : 0;
_lowercaseHex = other._lowercaseHex;
_pStruct = !other._modified ? other._pStruct : nullptr;
_modified = other._modified;
}
return *this;
@@ -80,6 +92,7 @@ Object& Object::operator = (Object&& other) noexcept
_keys = std::move(other._keys);
_preserveInsOrder = other._preserveInsOrder;
_escapeUnicode = other._escapeUnicode;
_lowercaseHex = other._lowercaseHex;
_pStruct = std::move(other._pStruct);
_pOrdStruct = std::move(other._pOrdStruct);
_modified = other._modified;
@@ -93,11 +106,10 @@ void Object::syncKeys(const KeyList& keys)
if(_preserveInsOrder)
{
// update iterators in _keys to point to copied _values
for(KeyList::const_iterator it = keys.begin(); it != keys.end(); ++it)
{
ValueMap::const_iterator itv = _values.find((*it)->first);
poco_assert (itv != _values.end());
_keys.push_back(itv);
for (const auto& key : keys) {
auto itv = _values.find(key->first);
poco_assert(itv != _values.end());
_keys.emplace_back(itv);
}
}
}
@@ -105,37 +117,37 @@ void Object::syncKeys(const KeyList& keys)
Var Object::get(const std::string& key) const
{
ValueMap::const_iterator it = _values.find(key);
auto it = _values.find(key);
if (it != _values.end())
{
return it->second;
}
return Var();
return {};
}
Array::Ptr Object::getArray(const std::string& key) const
{
ValueMap::const_iterator it = _values.find(key);
auto it = _values.find(key);
if ((it != _values.end()) && (it->second.type() == typeid(Array::Ptr)))
{
return it->second.extract<Array::Ptr>();
}
return 0;
return nullptr;
}
Object::Ptr Object::getObject(const std::string& key) const
{
ValueMap::const_iterator it = _values.find(key);
auto it = _values.find(key);
if ((it != _values.end()) && (it->second.type() == typeid(Object::Ptr)))
{
return it->second.extract<Object::Ptr>();
}
return 0;
return nullptr;
}
@@ -144,16 +156,14 @@ void Object::getNames(NameList& names) const
names.clear();
if (_preserveInsOrder)
{
for(KeyList::const_iterator it = _keys.begin(); it != _keys.end(); ++it)
{
names.push_back((*it)->first);
for (const auto& _key : _keys) {
names.push_back(_key->first);
}
}
else
{
for(ValueMap::const_iterator it = _values.begin(); it != _values.end(); ++it)
{
names.push_back(it->first);
for (const auto& _value : _values) {
names.push_back(_value.first);
}
}
}
@@ -180,8 +190,8 @@ void Object::stringify(std::ostream& out, unsigned int indent, int step) const
const std::string& Object::getKey(KeyList::const_iterator& iter) const
{
ValueMap::const_iterator it = _values.begin();
ValueMap::const_iterator end = _values.end();
auto it = _values.begin();
auto end = _values.end();
for (; it != end; ++it)
{
if (it == *iter) return it->first;
@@ -197,13 +207,13 @@ Object& Object::set(const std::string& key, const Dynamic::Var& value)
if (!ret.second) ret.first->second = value;
if (_preserveInsOrder)
{
KeyList::iterator it = _keys.begin();
KeyList::iterator end = _keys.end();
auto it = _keys.begin();
const auto end = _keys.end();
for (; it != end; ++it)
{
if (key == (*it)->first) return *this;
}
_keys.push_back(ret.first);
_keys.emplace_back(ret.first);
}
_modified = true;
return *this;
@@ -244,14 +254,14 @@ void Object::resetDynStruct() const
Object::operator const Poco::DynamicStruct& () const
{
if (!_values.size())
if (_values.empty())
{
resetDynStruct(_pStruct);
}
else if (_modified)
{
ValueMap::const_iterator it = _values.begin();
ValueMap::const_iterator end = _values.end();
auto it = _values.begin();
const auto end = _values.end();
resetDynStruct(_pStruct);
for (; it != end; ++it)
{
@@ -276,7 +286,7 @@ Object::operator const Poco::DynamicStruct& () const
Object::operator const Poco::OrderedDynamicStruct& () const
{
if (!_values.size())
if (_values.empty())
{
resetDynStruct(_pOrdStruct);
}
@@ -284,8 +294,8 @@ Object::operator const Poco::OrderedDynamicStruct& () const
{
if (_preserveInsOrder)
{
KeyList::const_iterator it = _keys.begin();
KeyList::const_iterator end = _keys.end();
auto it = _keys.begin();
const auto end = _keys.end();
resetDynStruct(_pOrdStruct);
for (; it != end; ++it)
{
@@ -305,8 +315,8 @@ Object::operator const Poco::OrderedDynamicStruct& () const
}
else
{
ValueMap::const_iterator it = _values.begin();
ValueMap::const_iterator end = _values.end();
auto it = _values.begin();
const auto end = _values.end();
resetDynStruct(_pOrdStruct);
for (; it != end; ++it)
{
@@ -334,7 +344,7 @@ void Object::clear()
{
_values.clear();
_keys.clear();
_pStruct = 0;
_pStruct = nullptr;
_modified = true;
}