diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-01-18 00:40:38 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-01-30 19:11:03 +0100 |
commit | e8e8f6f43c760523520dfe7a5c76d88c959599f6 (patch) | |
tree | a000bcb5cbbde3e2833a57a28e761449b62165b2 /include | |
parent | b9af421ef788b94fcbf18ecf702cec3ba9a018b7 (diff) | |
download | qpdf-e8e8f6f43c760523520dfe7a5c76d88c959599f6.tar.zst |
Add JSON::parse
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/JSON.hh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/include/qpdf/JSON.hh b/include/qpdf/JSON.hh index 11fe2c7b..676becbf 100644 --- a/include/qpdf/JSON.hh +++ b/include/qpdf/JSON.hh @@ -22,13 +22,15 @@ #ifndef JSON_HH #define JSON_HH -// This is a simple JSON serializer, primarily designed for -// serializing QPDF Objects as JSON. JSON objects contain their data -// as smart pointers. One JSON object is added to another, this -// pointer is copied. This means you can create temporary JSON objects -// on the stack, add them to other objects, and let them go out of -// scope safely. It also means that if the json JSON object is added -// in more than one place, all copies share underlying data. +// This is a simple JSON serializer and parser, primarily designed for +// serializing QPDF Objects as JSON. While it may work as a +// general-purpose JSON parser/serializer, there are better options. +// JSON objects contain their data as smart pointers. One JSON object +// is added to another, this pointer is copied. This means you can +// create temporary JSON objects on the stack, add them to other +// objects, and let them go out of scope safely. It also means that if +// the json JSON object is added in more than one place, all copies +// share underlying data. #include <qpdf/DLL.h> #include <qpdf/PointerHolder.hh> @@ -98,6 +100,10 @@ class JSON QPDF_DLL bool checkSchema(JSON schema, std::list<std::string>& errors); + // Create a JSON object from a string. + QPDF_DLL + static JSON parse(std::string const&); + private: static std::string encode_string(std::string const& utf8); |