mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
JSON Stringifier fails with preserve insert order #819
This commit is contained in:
@@ -101,16 +101,16 @@ void Object::stringify(std::ostream& out, unsigned int indent, int step) const
|
||||
}
|
||||
|
||||
|
||||
const std::string& Object::getKey(KeyPtrList::const_iterator& iter) const
|
||||
const std::string& Object::getKey(KeyList::const_iterator& iter) const
|
||||
{
|
||||
ValueMap::const_iterator it = _values.begin();
|
||||
ValueMap::const_iterator end = _values.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
if (it->second == **iter) return it->first;
|
||||
if (it->first == *iter) return it->first;
|
||||
}
|
||||
|
||||
throw NotFoundException((*iter)->convert<std::string>());
|
||||
throw NotFoundException(*iter);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,13 +119,13 @@ void Object::set(const std::string& key, const Dynamic::Var& value)
|
||||
_values[key] = value;
|
||||
if (_preserveInsOrder)
|
||||
{
|
||||
KeyPtrList::iterator it = _keys.begin();
|
||||
KeyPtrList::iterator end = _keys.end();
|
||||
KeyList::iterator it = _keys.begin();
|
||||
KeyList::iterator end = _keys.end();
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
if (key == **it) return;
|
||||
if (key == *it) return;
|
||||
}
|
||||
_keys.push_back(&_values[key]);
|
||||
_keys.push_back(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user