Move increment_count to stage 2

This commit is contained in:
John Keiser
2020-05-11 04:58:50 -07:00
parent 07fe7ad1a2
commit 2c8fd109de
3 changed files with 5 additions and 9 deletions
-1
View File
@@ -1042,7 +1042,6 @@ public:
really_inline bool on_number_u64(uint64_t value) noexcept; ///< @private
really_inline bool on_number_double(double value) noexcept; ///< @private
really_inline void increment_count(scope_descriptor &scope) noexcept; ///< @private
really_inline void end_scope(uint32_t depth) noexcept; ///< @private
private:
/**
-7
View File
@@ -26,13 +26,6 @@ really_inline error_code parser::on_success(error_code success_code) noexcept {
valid = true;
return success_code;
}
// increment_count increments the count of keys in an object or values in an array.
// Note that if you are at the level of the values or elements, the count
// must be increment in the preceding depth (depth-1) where the array or
// the object resides.
really_inline void parser::increment_count(scope_descriptor &scope) noexcept {
scope.count++;
}
really_inline bool parser::on_start_document(uint32_t depth) noexcept {
containing_scope[depth].tape_index = current_loc;
+5 -1
View File
@@ -162,8 +162,12 @@ struct structural_parser {
return false;
}
// increment_count increments the count of keys in an object or values in an array.
// Note that if you are at the level of the values or elements, the count
// must be increment in the preceding depth (depth-1) where the array or
// the object resides.
really_inline void increment_count() {
doc_parser.increment_count(doc_parser.containing_scope[depth - 1]); // we have a key value pair in the object at parser.depth - 1
doc_parser.containing_scope[depth - 1].count++; // we have a key value pair in the object at parser.depth - 1
}
WARN_UNUSED really_inline bool parse_string() {