1- /* auto-generated on Tue Jun 23 09:15:19 PDT 2020 . Do not edit! */
1+ /* auto-generated on Tue 23 Jun 2020 20:51:12 EDT . Do not edit! */
22/* begin file include/simdjson.h */
33#ifndef SIMDJSON_H
44#define SIMDJSON_H
@@ -389,6 +389,7 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
389389 SIMDJSON_DISABLE_GCC_WARNING(-Wextra) \
390390 SIMDJSON_DISABLE_GCC_WARNING(-Wattributes) \
391391 SIMDJSON_DISABLE_GCC_WARNING(-Wimplicit-fallthrough) \
392+ SIMDJSON_DISABLE_GCC_WARNING(-Wnon-virtual-dtor) \
392393 SIMDJSON_DISABLE_GCC_WARNING(-Wreturn-type) \
393394 SIMDJSON_DISABLE_GCC_WARNING(-Wshadow) \
394395 SIMDJSON_DISABLE_GCC_WARNING(-Wunused-parameter) \
@@ -2017,7 +2018,7 @@ SIMDJSON_DISABLE_UNDESIRED_WARNINGS
20172018#define SIMDJSON_SIMDJSON_VERSION_H
20182019
20192020/** The version of simdjson being used (major.minor.revision) */
2020- #define SIMDJSON_VERSION 0.3.1
2021+ #define SIMDJSON_VERSION 0.4.0
20212022
20222023namespace simdjson {
20232024enum {
@@ -2028,11 +2029,11 @@ enum {
20282029 /**
20292030 * The minor version (major.MINOR.revision) of simdjson being used.
20302031 */
2031- SIMDJSON_VERSION_MINOR = 3 ,
2032+ SIMDJSON_VERSION_MINOR = 4 ,
20322033 /**
20332034 * The revision (major.minor.REVISION) of simdjson being used.
20342035 */
2035- SIMDJSON_VERSION_REVISION = 1
2036+ SIMDJSON_VERSION_REVISION = 0
20362037};
20372038} // namespace simdjson
20382039
@@ -2082,7 +2083,8 @@ enum error_code {
20822083 * Get the error message for the given error code.
20832084 *
20842085 * dom::parser parser;
2085- * auto [doc, error] = parser.parse(" foo" );
2086+ * dom::element doc;
2087+ * auto error = parser.parse(" foo" ).get(doc);
20862088 * if (error) { printf(" Error: %s\n" , error_message(error)); }
20872089 *
20882090 * @return The error message.
@@ -2335,7 +2337,7 @@ struct padded_string final {
23352337 /**
23362338 * Create a new padded string by copying the given input.
23372339 *
2338- * @param str_ the string to copy
2340+ * @param sv_ the string to copy
23392341 */
23402342 inline padded_string(std::string_view sv_) noexcept;
23412343 /**
@@ -3095,7 +3097,7 @@ class array {
30953097 * Get the value associated with the given JSON pointer.
30963098 *
30973099 * dom::parser parser;
3098- * array a = parser.parse(R"([ { "foo": { "a": [ 10, 20, 30 ] }} ])");
3100+ * array a = parser.parse(R"([ { "foo": { "a": [ 10, 20, 30 ] }} ])"_padded );
30993101 * a.at("0/foo/a/1") == 20
31003102 * a.at("0")["foo"]["a"].at(1) == 20
31013103 *
@@ -3434,9 +3436,13 @@ class parser {
34343436 * the same interface, requiring you to check the error before using the document:
34353437 *
34363438 * dom::parser parser;
3437- * for (auto [doc, error] : parser.load_many(path)) {
3438- * if (error) { cerr << error << endl; exit(1); }
3439- * cout << std::string(doc["title"]) << endl;
3439+ * dom::document_stream docs;
3440+ * auto error = parser.load_many(path).get(docs);
3441+ * if (error) { cerr << error << endl; exit(1); }
3442+ * for (auto doc : docs) {
3443+ * std::string_view title;
3444+ * if ((error = doc["title"].get(title)) { cerr << error << endl; exit(1); }
3445+ * cout << title << endl;
34403446 * }
34413447 *
34423448 * ### Threads
@@ -3449,7 +3455,7 @@ class parser {
34493455 * If the parser's current capacity is less than batch_size, it will allocate enough capacity
34503456 * to handle it (up to max_capacity).
34513457 *
3452- * @param s The concatenated JSON to parse. Must have at least len + SIMDJSON_PADDING allocated bytes.
3458+ * @param path File name pointing at the concatenated JSON to parse.
34533459 * @param batch_size The batch size to use. MUST be larger than the largest document. The sweet
34543460 * spot is cache-related: small enough to fit in cache, yet big enough to
34553461 * parse as many documents as possible in one tight loop.
@@ -3494,9 +3500,13 @@ class parser {
34943500 * the same interface, requiring you to check the error before using the document:
34953501 *
34963502 * dom::parser parser;
3497- * for (auto [doc, error] : parser.parse_many(buf, len)) {
3498- * if (error) { cerr << error << endl; exit(1); }
3499- * cout << std::string(doc["title"]) << endl;
3503+ * dom::document_stream docs;
3504+ * auto error = parser.load_many(path).get(docs);
3505+ * if (error) { cerr << error << endl; exit(1); }
3506+ * for (auto doc : docs) {
3507+ * std::string_view title;
3508+ * if ((error = doc["title"].get(title)) { cerr << error << endl; exit(1); }
3509+ * cout << title << endl;
35003510 * }
35013511 *
35023512 * ### REQUIRED: Buffer Padding
@@ -4120,7 +4130,6 @@ class element {
41204130 * - Object: dom::object
41214131 *
41224132 * @tparam T bool, double, uint64_t, int64_t, std::string_view, const char *, dom::array, dom::object
4123- * @returns true if the value can be cast to the given type, false if not.
41244133 */
41254134 template <typename T>
41264135 really_inline bool is () const noexcept ;
@@ -4273,8 +4282,8 @@ class element {
42734282 * The key will be matched against **unescaped** JSON:
42744283 *
42754284 * dom::parser parser;
4276- * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
4277- * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
4285+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\n"].get<uint64_t>().first == 1
4286+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\\n"].get<uint64_t>().error() == NO_SUCH_FIELD
42784287 *
42794288 * @return The value associated with this field, or:
42804289 * - NO_SUCH_FIELD if the field does not exist in the object
@@ -4288,8 +4297,8 @@ class element {
42884297 * The key will be matched against **unescaped** JSON:
42894298 *
42904299 * dom::parser parser;
4291- * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
4292- * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
4300+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\n"].get<uint64_t>().first == 1
4301+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\\n"].get<uint64_t>().error() == NO_SUCH_FIELD
42934302 *
42944303 * @return The value associated with this field, or:
42954304 * - NO_SUCH_FIELD if the field does not exist in the object
@@ -4301,7 +4310,7 @@ class element {
43014310 * Get the value associated with the given JSON pointer.
43024311 *
43034312 * dom::parser parser;
4304- * element doc = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})");
4313+ * element doc = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})"_padded );
43054314 * doc.at("/foo/a/1") == 20
43064315 * doc.at("/")["foo"]["a"].at(1) == 20
43074316 * doc.at("")["foo"]["a"].at(1) == 20
@@ -4328,8 +4337,8 @@ class element {
43284337 * The key will be matched against **unescaped** JSON:
43294338 *
43304339 * dom::parser parser;
4331- * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
4332- * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
4340+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\n"].get<uint64_t>().first == 1
4341+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\\n"].get<uint64_t>().error() == NO_SUCH_FIELD
43334342 *
43344343 * @return The value associated with this field, or:
43354344 * - NO_SUCH_FIELD if the field does not exist in the object
@@ -4557,8 +4566,8 @@ class object {
45574566 * The key will be matched against **unescaped** JSON:
45584567 *
45594568 * dom::parser parser;
4560- * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
4561- * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
4569+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\n"].get<uint64_t>().first == 1
4570+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\\n"].get<uint64_t>().error() == NO_SUCH_FIELD
45624571 *
45634572 * This function has linear-time complexity: the keys are checked one by one.
45644573 *
@@ -4574,8 +4583,8 @@ class object {
45744583 * The key will be matched against **unescaped** JSON:
45754584 *
45764585 * dom::parser parser;
4577- * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
4578- * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
4586+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\n"].get<uint64_t>().first == 1
4587+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\\n"].get<uint64_t>().error() == NO_SUCH_FIELD
45794588 *
45804589 * This function has linear-time complexity: the keys are checked one by one.
45814590 *
@@ -4589,7 +4598,7 @@ class object {
45894598 * Get the value associated with the given JSON pointer.
45904599 *
45914600 * dom::parser parser;
4592- * object obj = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})");
4601+ * object obj = parser.parse(R"({ "foo": { "a": [ 10, 20, 30 ] }})"_padded );
45934602 * obj.at("foo/a/1") == 20
45944603 * obj.at("foo")["a"].at(1) == 20
45954604 *
@@ -4607,8 +4616,8 @@ class object {
46074616 * The key will be matched against **unescaped** JSON:
46084617 *
46094618 * dom::parser parser;
4610- * parser.parse(R"({ "a\n": 1 })")["a\n"].get<uint64_t>().value == 1
4611- * parser.parse(R"({ "a\n": 1 })")["a\\n"].get<uint64_t>().error == NO_SUCH_FIELD
4619+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\n"].get<uint64_t>().first == 1
4620+ * parser.parse(R"({ "a\n": 1 })"_padded )["a\\n"].get<uint64_t>().error() == NO_SUCH_FIELD
46124621 *
46134622 * This function has linear-time complexity: the keys are checked one by one.
46144623 *
@@ -4646,7 +4655,9 @@ class object {
46464655 */
46474656class key_value_pair {
46484657public:
4658+ /* * key in the key-value pair **/
46494659 std::string_view key;
4660+ /* * value in the key-value pair **/
46504661 element value;
46514662
46524663private:
@@ -4956,6 +4967,7 @@ inline std::ostream& operator<<(std::ostream& out, const escape_json_string &une
49564967
49574968namespace simdjson {
49584969
4970+ /* * @private **/
49594971class [[deprecated(" Use the new DOM navigation API instead (see doc/basics.md)" )]] dom::parser::Iterator {
49604972public:
49614973 inline Iterator (const dom::parser &parser) noexcept (false );
@@ -5044,11 +5056,11 @@ class [[deprecated("Use the new DOM navigation API instead (see doc/basics.md)")
50445056
50455057 inline bool is_string () const { return get_type () == ' "' ; }
50465058
5047- // Returns true if the current type of node is an signed integer.
5059+ // Returns true if the current type of the node is an signed integer.
50485060 // You can get its value with `get_integer()`.
50495061 inline bool is_integer () const { return get_type () == ' l' ; }
50505062
5051- // Returns true if the current type of node is an unsigned integer.
5063+ // Returns true if the current type of the node is an unsigned integer.
50525064 // You can get its value with `get_unsigned_integer()`.
50535065 //
50545066 // NOTE:
@@ -5057,19 +5069,19 @@ class [[deprecated("Use the new DOM navigation API instead (see doc/basics.md)")
50575069 // positive integer, such as 1, 42, or 1000000, is as a signed node.
50585070 // Be aware this function returns false for a signed node.
50595071 inline bool is_unsigned_integer () const { return get_type () == ' u' ; }
5060-
5072+ // Returns true if the current type of the node is a double floating-point number.
50615073 inline bool is_double () const { return get_type () == ' d' ; }
5062-
5074+ // Returns true if the current type of the node is a number (integer or floating-point).
50635075 inline bool is_number () const {
50645076 return is_integer () || is_unsigned_integer () || is_double ();
50655077 }
5066-
5078+ // Returns true if the current type of the node is a bool with true value.
50675079 inline bool is_true () const { return get_type () == ' t' ; }
5068-
5080+ // Returns true if the current type of the node is a bool with false value.
50695081 inline bool is_false () const { return get_type () == ' f' ; }
5070-
5082+ // Returns true if the current type of the node is null.
50715083 inline bool is_null () const { return get_type () == ' n' ; }
5072-
5084+ // Returns true if the type byte represents an object of an array
50735085 static bool is_object_or_array (uint8_t type) {
50745086 return ((type == ' [' ) || (type == ' {' ));
50755087 }
@@ -5183,15 +5195,10 @@ class [[deprecated("Use the new DOM navigation API instead (see doc/basics.md)")
51835195 ;
51845196 }
51855197
5186- // void to_end_scope(); // move us to
5187- // the start of our current scope; always succeeds
5198+
51885199
51895200 // print the node we are currently pointing at
51905201 inline bool print (std::ostream &os, bool escape_strings = true ) const ;
5191- typedef struct {
5192- size_t start_of_scope;
5193- uint8_t scope_type;
5194- } scopeindex_t ;
51955202
51965203 private:
51975204 const document &doc;
@@ -5201,6 +5208,11 @@ class [[deprecated("Use the new DOM navigation API instead (see doc/basics.md)")
52015208 size_t tape_length{};
52025209 uint8_t current_type{};
52035210 uint64_t current_val{};
5211+ typedef struct {
5212+ size_t start_of_scope;
5213+ uint8_t scope_type;
5214+ } scopeindex_t ;
5215+
52045216 scopeindex_t *depth_index{};
52055217};
52065218
0 commit comments