1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-03 23:47:12 +02:00

Update POCO to 1.11.0

This commit is contained in:
Sandu Liviu Catalin
2021-08-22 18:07:06 +03:00
parent 151077c799
commit 7a3d92d1d1
450 changed files with 25219 additions and 6528 deletions

View File

@ -124,6 +124,9 @@ public:
std::size_t size() const;
/// Returns the size of the array.
bool empty() const;
/// Returns true if the array is empty, false otherwise.
bool isArray(unsigned int index) const;
/// Returns true when the element is an array.
@ -241,6 +244,12 @@ inline std::size_t Array::size() const
}
inline bool Array::empty() const
{
return _values.empty();
}
inline bool Array::isArray(unsigned int index) const
{
Dynamic::Var value = get(index);

View File

@ -267,7 +267,7 @@ private:
for (unsigned int i = 0; i < indent; i++) out << ' ';
Stringifier::stringify(getKey(it), out, indent, step, options);
out << ((indent > 0) ? " : " : ":");
out << ((indent > 0) ? ": " : ":");
Stringifier::stringify(getValue(it), out, indent + step, step, options);
@ -443,7 +443,6 @@ inline std::size_t Object::size() const
inline void Object::remove(const std::string& key)
{
_values.erase(key);
if (_preserveInsOrder)
{
KeyList::iterator it = _keys.begin();
@ -457,6 +456,7 @@ inline void Object::remove(const std::string& key)
}
}
}
_values.erase(key);
_modified = true;
}

View File

@ -35,9 +35,9 @@ namespace JSON {
class JSON_API Parser: private ParserImpl
/// A parser for reading RFC 4627 compliant JSON from strings or streams.
///
///
/// Simple usage example:
///
///
/// std::string json = "{ \"name\" : \"Franky\", \"children\" : [ \"Jonas\", \"Ellen\" ] }";
/// Parser parser;
/// Var result = parser.parse(json);
@ -54,18 +54,18 @@ class JSON_API Parser: private ParserImpl
/// containing a Poco::SharedPtr to an Object or Array instance.
///
/// Example:
///
///
/// std::string json = "{ \"name\" : \"Franky\", \"children\" : [ \"Jonas\", \"Ellen\" ] }";
/// Parser parser;
/// Var result = parser.parse(json);
/// Object::Ptr object = result.extract<Object::Ptr>();
/// std::string name = object.getValue<std::string>("name");
/// Array::Ptr children = object.getArray("children");
/// Object::Ptr pObject = result.extract<Object::Ptr>();
/// std::string name = pObject->getValue<std::string>("name");
/// Array::Ptr pChildren = pObject->getArray("children");
/// ----
{
public:
Parser(const Handler::Ptr& pHandler = new ParseHandler, std::size_t bufSize = JSON_PARSE_BUFFER_SIZE);
Parser(const Handler::Ptr& pHandler = new ParseHandler);
/// Creates JSON Parser, using the given Handler and buffer size.
virtual ~Parser();
@ -76,16 +76,24 @@ public:
void setAllowComments(bool comments);
/// Allow or disallow comments. By default, comments are not allowed.
///
/// If set to true, comments will be filtered out of the input data
/// before passing the JSON on to the parser. This will impact performance,
/// especially when reading from a std::istream.
bool getAllowComments() const;
/// Returns true if comments are allowed, false otherwise.
///
/// By default, comments are not allowed.
void setAllowNullByte(bool nullByte);
/// Allow or disallow null byte in strings.
/// Allow or disallow null byte in strings.
///
/// By default, null byte is allowed.
/// By default, null byte is allowed (true).
///
/// If set to false, an additional check for "\u0000" will be performed
/// before passing the JSON on to the parser. This will impact performance,
/// especially when reading from a std::istream.
bool getAllowNullByte() const;
/// Returns true if null byte is allowed, false otherwise.
@ -94,6 +102,10 @@ public:
void setDepth(std::size_t depth);
/// Sets the allowed JSON depth.
///
/// Default maximum depth is 128. Setting this value too high
/// may result in a stack overflow when parsing a (malicious)
/// JSON document.
std::size_t getDepth() const;
/// Returns the allowed JSON depth.

View File

@ -38,11 +38,9 @@ namespace JSON {
class JSON_API ParserImpl
{
protected:
static const std::size_t JSON_PARSE_BUFFER_SIZE = 4096;
static const std::size_t JSON_PARSER_STACK_SIZE = 128;
static const int JSON_UNLIMITED_DEPTH = -1;
static const std::size_t JSON_DEFAULT_DEPTH = 128;
ParserImpl(const Handler::Ptr& pHandler = new ParseHandler, std::size_t bufSize = JSON_PARSE_BUFFER_SIZE);
ParserImpl(const Handler::Ptr& pHandler = new ParseHandler);
/// Creates JSON ParserImpl, using the given Handler and buffer size.
virtual ~ParserImpl();
@ -101,12 +99,13 @@ private:
void handleObject();
void handle();
void handle(const std::string& json);
void handle(std::istream& json);
void stripComments(std::string& json);
bool checkError();
struct json_stream* _pJSON;
Handler::Ptr _pHandler;
int _depth;
std::size_t _depth;
char _decimalPoint;
bool _allowNullByte;
bool _allowComments;