@@ -97,22 +97,24 @@ class document {
9797 *
9898 * The parser will allocate capacity as needed.
9999 */
100- document () noexcept = default;
101- ~document () noexcept = default ;
100+ document () noexcept = default;
101+ ~document () noexcept = default ;
102102
103103 /* *
104104 * Take another document's buffers.
105105 *
106106 * @param other The document to take. Its capacity is zeroed and it is invalidated.
107107 */
108108 document (document &&other) noexcept = default;
109+ /* * @private */
109110 document (const document &) = delete; // Disallow copying
110111 /* *
111112 * Take another document's buffers.
112113 *
113114 * @param other The document to take. Its capacity is zeroed.
114115 */
115116 document &operator =(document &&other) noexcept = default ;
117+ /* * @private */
116118 document &operator =(const document &) = delete ; // Disallow copying
117119
118120 /* *
@@ -121,15 +123,19 @@ class document {
121123 element root () const noexcept ;
122124
123125 /* *
124- * Dump the raw tape for debugging.
126+ * @private Dump the raw tape for debugging.
125127 *
126128 * @param os the stream to output to.
127129 * @return false if the tape is likely wrong (e.g., you did not parse a valid JSON).
128130 */
129131 bool dump_raw_tape (std::ostream &os) const noexcept ;
130132
131133 std::unique_ptr<uint64_t []> tape;
132- std::unique_ptr<uint8_t []> string_buf;// should be at least byte_capacity
134+ /* * @private String values.
135+ *
136+ * Should be at least byte_capacity.
137+ */
138+ std::unique_ptr<uint8_t []> string_buf;
133139
134140private:
135141 inline error_code set_capacity (size_t len) noexcept ;
@@ -592,6 +598,7 @@ class parser {
592598 * DEFAULT_MAX_DEPTH.
593599 */
594600 really_inline parser (size_t max_capacity = SIMDJSON_MAXSIZE_BYTES, size_t max_depth = DEFAULT_MAX_DEPTH) noexcept ;
601+ /* * Deallocate the JSON parser. */
595602 ~parser ()=default ;
596603
597604 /* *
@@ -600,14 +607,14 @@ class parser {
600607 * @param other The parser to take. Its capacity is zeroed.
601608 */
602609 parser (parser &&other) = default ;
603- parser (const parser &) = delete ; // Disallow copying
610+ parser (const parser &) = delete ; // /< @private Disallow copying
604611 /* *
605612 * Take another parser's buffers and state.
606613 *
607614 * @param other The parser to take. Its capacity is zeroed.
608615 */
609616 parser &operator =(parser &&other) = default ;
610- parser &operator =(const parser &) = delete ; // Disallow copying
617+ parser &operator =(const parser &) = delete ; // /< @private Disallow copying
611618
612619 /* *
613620 * Load a JSON document from a file and return a reference to it.
@@ -1147,34 +1154,35 @@ class parser {
11471154 /* * @deprecated Use simdjson_error instead */
11481155 using InvalidJSON = simdjson_error;
11491156
1150- // Next location to write to in the tape
1157+ /* * @private Next location to write to in the tape */
11511158 uint32_t current_loc{0 };
11521159
1153- // structural indices passed from stage 1 to stage 2
1160+ /* * @private Number of structural indices passed from stage 1 to stage 2 */
11541161 uint32_t n_structural_indexes{0 };
1162+ /* * @private Structural indices passed from stage 1 to stage 2 */
11551163 std::unique_ptr<uint32_t []> structural_indexes;
11561164
1157- // location and return address of each open { or [
1165+ /* * @private Tape location of each open { or [ */
11581166 std::unique_ptr<uint32_t []> containing_scope_offset;
11591167#ifdef SIMDJSON_USE_COMPUTED_GOTO
1168+ /* * @private Return address of each open { or [ */
11601169 std::unique_ptr<void *[]> ret_address;
11611170#else
1171+ /* * @private Return address of each open { or [ */
11621172 std::unique_ptr<char []> ret_address;
11631173#endif
11641174
1165- // Next place to write a string
1175+ /* * @private Next write location in the string buf for stage 2 parsing */
11661176 uint8_t *current_string_buf_loc;
11671177
1178+ /* * @deprecated Use `if (parser.parse(...).error)` instead */
11681179 bool valid{false };
1180+ /* * @deprecated Use `parser.parse(...).error` instead */
11691181 error_code error{UNINITIALIZED};
11701182
1171- // Document we're writing to
1183+ /* * @deprecated Use `parser.parse(...).doc` instead */
11721184 document doc;
11731185
1174- //
1175- // TODO these are deprecated; use the results of parse instead.
1176- //
1177-
11781186 // returns true if the document parsed was valid
11791187 [[deprecated(" Use the result of parser.parse() instead" )]]
11801188 inline bool is_valid () const noexcept ;
@@ -1188,11 +1196,9 @@ class parser {
11881196 [[deprecated(" Use error_message() on the result of parser.parse() instead, or cout << error" )]]
11891197 inline std::string get_error_message () const noexcept ;
11901198
1191- // print the json to std::ostream (should be valid)
1192- // return false if the tape is likely wrong (e.g., you did not parse a valid
1193- // JSON).
11941199 [[deprecated(" Use cout << on the result of parser.parse() instead" )]]
11951200 inline bool print_json (std::ostream &os) const noexcept ;
1201+ /* * @private Private and deprecated: use `parser.parse(...).doc.dump_raw_tape()` instead */
11961202 inline bool dump_raw_tape (std::ostream &os) const noexcept ;
11971203
11981204 //
@@ -1201,54 +1207,54 @@ class parser {
12011207 // TODO find a way to do this without exposing the interface or crippling performance
12021208 //
12031209
1204- // this should be called when parsing (right before writing the tapes)
1210+ /* * @private this should be called when parsing (right before writing the tapes) */
12051211 inline void init_stage2 () noexcept ;
1206- really_inline error_code on_error (error_code new_error_code) noexcept ;
1207- really_inline error_code on_success (error_code success_code) noexcept ;
1208- really_inline bool on_start_document (uint32_t depth) noexcept ;
1209- really_inline bool on_start_object (uint32_t depth) noexcept ;
1210- really_inline bool on_start_array (uint32_t depth) noexcept ;
1212+ really_inline error_code on_error (error_code new_error_code) noexcept ; // /< @private
1213+ really_inline error_code on_success (error_code success_code) noexcept ; // /< @private
1214+ really_inline bool on_start_document (uint32_t depth) noexcept ; // /< @private
1215+ really_inline bool on_start_object (uint32_t depth) noexcept ; // /< @private
1216+ really_inline bool on_start_array (uint32_t depth) noexcept ; // /< @private
12111217 // TODO we're not checking this bool
1212- really_inline bool on_end_document (uint32_t depth) noexcept ;
1213- really_inline bool on_end_object (uint32_t depth) noexcept ;
1214- really_inline bool on_end_array (uint32_t depth) noexcept ;
1215- really_inline bool on_true_atom () noexcept ;
1216- really_inline bool on_false_atom () noexcept ;
1217- really_inline bool on_null_atom () noexcept ;
1218- really_inline uint8_t *on_start_string () noexcept ;
1219- really_inline bool on_end_string (uint8_t *dst) noexcept ;
1220- really_inline bool on_number_s64 (int64_t value) noexcept ;
1221- really_inline bool on_number_u64 (uint64_t value) noexcept ;
1222- really_inline bool on_number_double (double value) noexcept ;
1218+ really_inline bool on_end_document (uint32_t depth) noexcept ; // /< @private
1219+ really_inline bool on_end_object (uint32_t depth) noexcept ; // /< @private
1220+ really_inline bool on_end_array (uint32_t depth) noexcept ; // /< @private
1221+ really_inline bool on_true_atom () noexcept ; // /< @private
1222+ really_inline bool on_false_atom () noexcept ; // /< @private
1223+ really_inline bool on_null_atom () noexcept ; // /< @private
1224+ really_inline uint8_t *on_start_string () noexcept ; // /< @private
1225+ really_inline bool on_end_string (uint8_t *dst) noexcept ; // /< @private
1226+ really_inline bool on_number_s64 (int64_t value) noexcept ; // /< @private
1227+ really_inline bool on_number_u64 (uint64_t value) noexcept ; // /< @private
1228+ really_inline bool on_number_double (double value) noexcept ; // /< @private
12231229
12241230private:
1225- //
1226- // The maximum document length this parser supports.
1227- //
1228- // Buffers are large enough to handle any document up to this length.
1229- / /
1231+ /* *
1232+ * The maximum document length this parser supports.
1233+ *
1234+ * Buffers are large enough to handle any document up to this length.
1235+ * /
12301236 size_t _capacity{0 };
12311237
1232- //
1233- // The maximum document length this parser will automatically support.
1234- //
1235- // The parser will not be automatically allocated above this amount.
1236- / /
1238+ /* *
1239+ * The maximum document length this parser will automatically support.
1240+ *
1241+ * The parser will not be automatically allocated above this amount.
1242+ * /
12371243 size_t _max_capacity;
12381244
1239- //
1240- // The maximum depth (number of nested objects and arrays) supported by this parser.
1241- //
1242- // Defaults to DEFAULT_MAX_DEPTH.
1243- / /
1245+ /* *
1246+ * The maximum depth (number of nested objects and arrays) supported by this parser.
1247+ *
1248+ * Defaults to DEFAULT_MAX_DEPTH.
1249+ * /
12441250 size_t _max_depth;
12451251
1246- //
1247- // The loaded buffer (reused each time load() is called)
1248- / /
1252+ /* *
1253+ * The loaded buffer (reused each time load() is called)
1254+ * /
12491255 std::unique_ptr<char [], decltype (&aligned_free_char)> loaded_bytes;
12501256
1251- // Capacity of loaded_bytes buffer.
1257+ /* * Capacity of loaded_bytes buffer. */
12521258 size_t _loaded_bytes_capacity{0 };
12531259
12541260 // all nodes are stored on the doc.tape using a 64-bit word.
@@ -1268,13 +1274,13 @@ class parser {
12681274 inline void write_tape (uint64_t val, internal::tape_type t) noexcept ;
12691275 inline void annotate_previous_loc (uint32_t saved_loc, uint64_t val) noexcept ;
12701276
1271- // Ensure we have enough capacity to handle at least desired_capacity bytes,
1272- // and auto-allocate if not.
1277+ /* *
1278+ * Ensure we have enough capacity to handle at least desired_capacity bytes,
1279+ * and auto-allocate if not.
1280+ */
12731281 inline error_code ensure_capacity (size_t desired_capacity) noexcept ;
12741282
1275- //
1276- // Read the file into loaded_bytes
1277- //
1283+ /* * Read the file into loaded_bytes */
12781284 inline simdjson_result<size_t > read_file (const std::string &path) noexcept ;
12791285
12801286 friend class parser ::Iterator;
0 commit comments