Skip to content

Commit

Permalink
[onert/3rdparty] Update jsoncpp (#14413)
Browse files Browse the repository at this point in the history
This commit updates jsoncpp to 1.9.6.

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh authored Dec 5, 2024
1 parent 37f1589 commit 81d6d2a
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 120 deletions.
2 changes: 1 addition & 1 deletion runtime/3rdparty/jsoncpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Since jsoncpp on tizen does not support static jsoncpp library, nnfw project wil

# Version

- 1.9.5 : https://github.com/open-source-parsers/jsoncpp/archive/1.9.5.tar.gz
- 1.9.6 : https://github.com/open-source-parsers/jsoncpp/archive/1.9.6.tar.gz
14 changes: 7 additions & 7 deletions runtime/3rdparty/jsoncpp/json/json-forwards.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Json-cpp amalgamated forward header (http://jsoncpp.sourceforge.net/).
/// Json-cpp amalgamated forward header (https://github.com/open-source-parsers/jsoncpp/).
/// It is intended to be used with #include "json/json-forwards.h"
/// This header provides forward declaration for all JsonCpp types.

Expand Down Expand Up @@ -90,18 +90,17 @@ license you like.
// 3. /CMakeLists.txt
// IMPORTANT: also update the SOVERSION!!

#define JSONCPP_VERSION_STRING "1.9.5"
#define JSONCPP_VERSION_STRING "1.9.6"
#define JSONCPP_VERSION_MAJOR 1
#define JSONCPP_VERSION_MINOR 9
#define JSONCPP_VERSION_PATCH 5
#define JSONCPP_VERSION_PATCH 6
#define JSONCPP_VERSION_QUALIFIER
#define JSONCPP_VERSION_HEXA \
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))

#ifdef JSONCPP_USING_SECURE_MEMORY
#undef JSONCPP_USING_SECURE_MEMORY
#endif
#if !defined(JSONCPP_USE_SECURE_MEMORY)
#define JSONCPP_USING_SECURE_MEMORY 0
#endif
// If non-zero, the library zeroes any memory that it has allocated before
// it frees its memory.

Expand All @@ -126,7 +125,8 @@ license you like.
#include <cstring>
#include <memory>

#pragma pack(push, 8)
#pragma pack(push)
#pragma pack()

namespace Json
{
Expand Down
112 changes: 90 additions & 22 deletions runtime/3rdparty/jsoncpp/json/json.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Json-cpp amalgamated header (http://jsoncpp.sourceforge.net/).
/// Json-cpp amalgamated header (https://github.com/open-source-parsers/jsoncpp/).
/// It is intended to be used with #include "json/json.h"

// //////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -89,18 +89,17 @@ license you like.
// 3. /CMakeLists.txt
// IMPORTANT: also update the SOVERSION!!

#define JSONCPP_VERSION_STRING "1.9.5"
#define JSONCPP_VERSION_STRING "1.9.6"
#define JSONCPP_VERSION_MAJOR 1
#define JSONCPP_VERSION_MINOR 9
#define JSONCPP_VERSION_PATCH 5
#define JSONCPP_VERSION_PATCH 6
#define JSONCPP_VERSION_QUALIFIER
#define JSONCPP_VERSION_HEXA \
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))

#ifdef JSONCPP_USING_SECURE_MEMORY
#undef JSONCPP_USING_SECURE_MEMORY
#endif
#if !defined(JSONCPP_USE_SECURE_MEMORY)
#define JSONCPP_USING_SECURE_MEMORY 0
#endif
// If non-zero, the library zeroes any memory that it has allocated before
// it frees its memory.

Expand All @@ -125,7 +124,8 @@ license you like.
#include <cstring>
#include <memory>

#pragma pack(push, 8)
#pragma pack(push)
#pragma pack()

namespace Json
{
Expand Down Expand Up @@ -443,7 +443,8 @@ class ValueConstIterator;
#include "forwards.h"
#endif // if !defined(JSON_IS_AMALGAMATION)

#pragma pack(push, 8)
#pragma pack(push)
#pragma pack()

namespace Json
{
Expand Down Expand Up @@ -508,8 +509,8 @@ class JSON_API Features
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef JSON_H_INCLUDED
#define JSON_H_INCLUDED
#ifndef JSON_VALUE_H_INCLUDED
#define JSON_VALUE_H_INCLUDED

#if !defined(JSON_IS_AMALGAMATION)
#include "forwards.h"
Expand Down Expand Up @@ -558,7 +559,8 @@ class JSON_API Features
#pragma warning(disable : 4251 4275)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)

#pragma pack(push, 8)
#pragma pack(push)
#pragma pack()

/** \brief JSON (JavaScript Object Notation).
*/
Expand Down Expand Up @@ -956,23 +958,23 @@ class JSON_API Value
/// \post type() is arrayValue
void resize(ArrayIndex newSize);

//@{
///@{
/// Access an array element (zero based index). If the array contains less
/// than index element, then null value are inserted in the array so that
/// its size is index+1.
/// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.)
Value &operator[](ArrayIndex index);
Value &operator[](int index);
//@}
///@}

//@{
///@{
/// Access an array element (zero based index).
/// (You may need to say 'value[0u]' to get your compiler to distinguish
/// this from the operator[] which takes a string.)
const Value &operator[](ArrayIndex index) const;
const Value &operator[](int index) const;
//@}
///@}

/// If the array contains at least index+1 elements, returns the element
/// value, otherwise returns defaultValue.
Expand Down Expand Up @@ -1031,6 +1033,9 @@ class JSON_API Value
/// and operator[]const
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
Value const *find(char const *begin, char const *end) const;
/// Most general and efficient version of isMember()const, get()const,
/// and operator[]const
Value const *find(const String &key) const;
/// Most general and efficient version of object-mutators.
/// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
/// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
Expand Down Expand Up @@ -1105,6 +1110,26 @@ class JSON_API Value
iterator begin();
iterator end();

/// \brief Returns a reference to the first element in the `Value`.
/// Requires that this value holds an array or json object, with at least one
/// element.
const Value &front() const;

/// \brief Returns a reference to the first element in the `Value`.
/// Requires that this value holds an array or json object, with at least one
/// element.
Value &front();

/// \brief Returns a reference to the last element in the `Value`.
/// Requires that value holds an array or json object, with at least one
/// element.
const Value &back() const;

/// \brief Returns a reference to the last element in the `Value`.
/// Requires that this value holds an array or json object, with at least one
/// element.
Value &back();

// Accessors for the [start, limit) range of bytes within the JSON text from
// which this value was parsed, if any.
void setOffsetStart(ptrdiff_t start);
Expand Down Expand Up @@ -1457,6 +1482,14 @@ class JSON_API ValueIterator : public ValueIteratorBase

inline void swap(Value &a, Value &b) { a.swap(b); }

inline const Value &Value::front() const { return *begin(); }

inline Value &Value::front() { return *begin(); }

inline const Value &Value::back() const { return *(--end()); }

inline Value &Value::back() { return *(--end()); }

} // namespace Json

#pragma pack(pop)
Expand Down Expand Up @@ -1500,7 +1533,8 @@ inline void swap(Value &a, Value &b) { a.swap(b); }
#pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)

#pragma pack(push, 8)
#pragma pack(push)
#pragma pack()

namespace Json
{
Expand Down Expand Up @@ -1670,6 +1704,7 @@ class JSON_API Reader
using Errors = std::deque<ErrorInfo>;

bool readToken(Token &token);
bool readTokenSkippingComments(Token &token);
void skipSpaces();
bool match(const Char *pattern, int patternLength);
bool readComment();
Expand Down Expand Up @@ -1698,7 +1733,6 @@ class JSON_API Reader
void getLocationLineAndColumn(Location location, int &line, int &column) const;
String getLocationLineAndColumn(Location location) const;
void addComment(Location begin, Location end, CommentPlacement placement);
void skipCommentTokens(Token &token);

static bool containsNewLine(Location begin, Location end);
static String normalizeEOL(Location begin, Location end);
Expand All @@ -1722,6 +1756,13 @@ class JSON_API Reader
class JSON_API CharReader
{
public:
struct JSON_API StructuredError
{
ptrdiff_t offset_start;
ptrdiff_t offset_limit;
String message;
};

virtual ~CharReader() = default;
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
* document. The document must be a UTF-8 encoded string containing the
Expand All @@ -1739,7 +1780,12 @@ class JSON_API CharReader
* \return \c true if the document was successfully parsed, \c false if an
* error occurred.
*/
virtual bool parse(char const *beginDoc, char const *endDoc, Value *root, String *errs) = 0;
virtual bool parse(char const *beginDoc, char const *endDoc, Value *root, String *errs);

/** \brief Returns a vector of structured errors encountered while parsing.
* Each parse call resets the stored list of errors.
*/
std::vector<StructuredError> getStructuredErrors() const;

class JSON_API Factory
{
Expand All @@ -1750,7 +1796,21 @@ class JSON_API CharReader
*/
virtual CharReader *newCharReader() const = 0;
}; // Factory
}; // CharReader

protected:
class Impl
{
public:
virtual ~Impl() = default;
virtual bool parse(char const *beginDoc, char const *endDoc, Value *root, String *errs) = 0;
virtual std::vector<StructuredError> getStructuredErrors() const = 0;
};

explicit CharReader(std::unique_ptr<Impl> impl) : _impl(std::move(impl)) {}

private:
std::unique_ptr<Impl> _impl;
}; // CharReader

/** \brief Build a CharReader implementation.
*
Expand Down Expand Up @@ -1839,6 +1899,12 @@ class JSON_API CharReaderBuilder : public CharReader::Factory
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
*/
static void strictMode(Json::Value *settings);
/** ECMA-404 mode.
* \pre 'settings' != NULL (but Json::null is fine)
* \remark Defaults:
* \snippet src/lib_json/json_reader.cpp CharReaderBuilderECMA404Mode
*/
static void ecma404Mode(Json::Value *settings);
};

/** Consume entire stream and use its begin/end.
Expand Down Expand Up @@ -1913,7 +1979,8 @@ JSON_API IStream &operator>>(IStream &, Value &);
#pragma warning(disable : 4251)
#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)

#pragma pack(push, 8)
#pragma pack(push)
#pragma pack()

namespace Json
{
Expand Down Expand Up @@ -2114,7 +2181,7 @@ class JSON_API FastWriter : public Writer
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their
* If the Value have comments then they are outputted according to their
*#CommentPlacement.
*
* \sa Reader, Value, Value::setComment()
Expand Down Expand Up @@ -2183,7 +2250,7 @@ class JSON_API StyledWriter : public Writer
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their
* If the Value have comments then they are outputted according to their
#CommentPlacement.
*
* \sa Reader, Value, Value::setComment()
Expand Down Expand Up @@ -2249,6 +2316,7 @@ String JSON_API valueToString(double value, unsigned int precision = Value::defa
PrecisionType precisionType = PrecisionType::significantDigits);
String JSON_API valueToString(bool value);
String JSON_API valueToQuotedString(const char *value);
String JSON_API valueToQuotedString(const char *value, size_t length);

/// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>()
Expand Down
Loading

0 comments on commit 81d6d2a

Please sign in to comment.