File tree 5 files changed +840
-1026
lines changed
5 files changed +840
-1026
lines changed Original file line number Diff line number Diff line change @@ -62,12 +62,10 @@ inline size_t array::size() const noexcept {
62
62
return tape.scope_count ();
63
63
}
64
64
inline simdjson_result<element> array::at_pointer (std::string_view json_pointer) const noexcept {
65
- if (json_pointer[0 ] != ' /' ) {
66
- if (json_pointer.empty ()) { // an empty string means that we return the current node
65
+ if (json_pointer.empty ()) { // an empty string means that we return the current node
67
66
return element (this ->tape ); // copy the current node
68
- } else { // otherwise there is an error
67
+ } else if (json_pointer[ 0 ] != ' / ' ) { // otherwise there is an error
69
68
return INVALID_JSON_POINTER;
70
- }
71
69
}
72
70
json_pointer = json_pointer.substr (1 );
73
71
// - means "the append position" or "the element after the end of the array"
@@ -102,6 +100,7 @@ inline simdjson_result<element> array::at_pointer(std::string_view json_pointer)
102
100
}
103
101
return child;
104
102
}
103
+
105
104
inline simdjson_result<element> array::at (size_t index) const noexcept {
106
105
size_t i=0 ;
107
106
for (auto element : *this ) {
Original file line number Diff line number Diff line change @@ -81,12 +81,10 @@ inline simdjson_result<element> object::operator[](const char *key) const noexce
81
81
return at_key (key);
82
82
}
83
83
inline simdjson_result<element> object::at_pointer (std::string_view json_pointer) const noexcept {
84
- if (json_pointer[0 ] != ' /' ) {
85
- if (json_pointer.empty ()) { // an empty string means that we return the current node
84
+ if (json_pointer.empty ()) { // an empty string means that we return the current node
86
85
return element (this ->tape ); // copy the current node
87
- } else { // otherwise there is an error
86
+ } else if (json_pointer[ 0 ] != ' / ' ) { // otherwise there is an error
88
87
return INVALID_JSON_POINTER;
89
- }
90
88
}
91
89
json_pointer = json_pointer.substr (1 );
92
90
size_t slash = json_pointer.find (' /' );
You can’t perform that action at this time.
0 commit comments