From f1a03bfb0409bb4f037e1280dfb0714b29a86a9f Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Tue, 23 Jun 2020 11:05:58 -0400 Subject: [PATCH] Very minor cleaning. --- include/simdjson/dom/object.h | 2 ++ include/simdjson/dom/parsedjson_iterator.h | 29 +++++++++++----------- include/simdjson/dom/parser.h | 2 +- include/simdjson/padded_string.h | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/include/simdjson/dom/object.h b/include/simdjson/dom/object.h index 9316914d..42b949c7 100644 --- a/include/simdjson/dom/object.h +++ b/include/simdjson/dom/object.h @@ -190,7 +190,9 @@ private: */ class key_value_pair { public: + /** key in the key-value pair **/ std::string_view key; + /** value in the key-value pair **/ element value; private: diff --git a/include/simdjson/dom/parsedjson_iterator.h b/include/simdjson/dom/parsedjson_iterator.h index 795d70a3..2a0f32be 100644 --- a/include/simdjson/dom/parsedjson_iterator.h +++ b/include/simdjson/dom/parsedjson_iterator.h @@ -16,6 +16,7 @@ namespace simdjson { +/** @private **/ class [[deprecated("Use the new DOM navigation API instead (see doc/basics.md)")]] dom::parser::Iterator { public: inline Iterator(const dom::parser &parser) noexcept(false); @@ -104,11 +105,11 @@ public: inline bool is_string() const { return get_type() == '"'; } - // Returns true if the current type of node is an signed integer. + // Returns true if the current type of the node is an signed integer. // You can get its value with `get_integer()`. inline bool is_integer() const { return get_type() == 'l'; } - // Returns true if the current type of node is an unsigned integer. + // Returns true if the current type of the node is an unsigned integer. // You can get its value with `get_unsigned_integer()`. // // NOTE: @@ -117,19 +118,19 @@ public: // positive integer, such as 1, 42, or 1000000, is as a signed node. // Be aware this function returns false for a signed node. inline bool is_unsigned_integer() const { return get_type() == 'u'; } - + // Returns true if the current type of the node is a double floating-point number. inline bool is_double() const { return get_type() == 'd'; } - + // Returns true if the current type of the node is a number (integer or floating-point). inline bool is_number() const { return is_integer() || is_unsigned_integer() || is_double(); } - + // Returns true if the current type of the node is a bool with true value. inline bool is_true() const { return get_type() == 't'; } - + // Returns true if the current type of the node is a bool with false value. inline bool is_false() const { return get_type() == 'f'; } - + // Returns true if the current type of the node is null. inline bool is_null() const { return get_type() == 'n'; } - + // Returns true if the type byte represents an object of an array static bool is_object_or_array(uint8_t type) { return ((type == '[') || (type == '{')); } @@ -243,15 +244,10 @@ public: ; } - // void to_end_scope(); // move us to - // the start of our current scope; always succeeds + // print the node we are currently pointing at inline bool print(std::ostream &os, bool escape_strings = true) const; - typedef struct { - size_t start_of_scope; - uint8_t scope_type; - } scopeindex_t; private: const document &doc; @@ -261,6 +257,11 @@ public: size_t tape_length{}; uint8_t current_type{}; uint64_t current_val{}; + typedef struct { + size_t start_of_scope; + uint8_t scope_type; + } scopeindex_t; + scopeindex_t *depth_index{}; }; diff --git a/include/simdjson/dom/parser.h b/include/simdjson/dom/parser.h index 49ca234d..b0f073ac 100644 --- a/include/simdjson/dom/parser.h +++ b/include/simdjson/dom/parser.h @@ -188,7 +188,7 @@ public: * If the parser's current capacity is less than batch_size, it will allocate enough capacity * to handle it (up to max_capacity). * - * @param s The concatenated JSON to parse. Must have at least len + SIMDJSON_PADDING allocated bytes. + * @param path File name pointing at the concatenated JSON to parse. * @param batch_size The batch size to use. MUST be larger than the largest document. The sweet * spot is cache-related: small enough to fit in cache, yet big enough to * parse as many documents as possible in one tight loop. diff --git a/include/simdjson/padded_string.h b/include/simdjson/padded_string.h index 96b529cf..9c06dbf2 100644 --- a/include/simdjson/padded_string.h +++ b/include/simdjson/padded_string.h @@ -45,7 +45,7 @@ struct padded_string final { /** * Create a new padded string by copying the given input. * - * @param str_ the string to copy + * @param sv_ the string to copy */ inline padded_string(std::string_view sv_) noexcept; /**