@@ -180,20 +180,6 @@ class document {
180
180
*/
181
181
inline element_result at_key (std::string_view s) const noexcept ;
182
182
183
- /* *
184
- * Get the value associated with the given key.
185
- *
186
- * Note: The key will be matched against **unescaped** JSON:
187
- *
188
- * document::parser parser;
189
- * parser.parse(R"({ "a\n": 1 })")["a\n"].as_uint64_t().value == 1
190
- * parser.parse(R"({ "a\n": 1 })")["a\\n"].as_uint64_t().error == NO_SUCH_FIELD
191
- *
192
- * @return The value associated with this field, or:
193
- * - NO_SUCH_FIELD if the field does not exist in the object
194
- */
195
- inline element_result at_key (const char *s) const noexcept ;
196
-
197
183
std::unique_ptr<uint64_t []> tape;
198
184
std::unique_ptr<uint8_t []> string_buf;// should be at least byte_capacity
199
185
@@ -256,6 +242,11 @@ class document::doc_result : public simdjson_result<document&> {
256
242
*/
257
243
inline array_result as_array () const noexcept ;
258
244
245
+ /* *
246
+ * Get the root element of this document.
247
+ */
248
+ inline element_result root () const noexcept ;
249
+
259
250
/* *
260
251
* Get the value associated with the given JSON pointer.
261
252
*
@@ -644,18 +635,14 @@ class document::element : protected internal::tape_ref {
644
635
inline element_result at_key (std::string_view s) const noexcept ;
645
636
646
637
/* *
647
- * Get the value associated with the given key.
648
- *
649
- * Note: The key will be matched against **unescaped** JSON:
638
+ * Get the value associated with the given key in a case-insensitive manner.
650
639
*
651
- * document::parser parser;
652
- * parser.parse(R"({ "a\n": 1 })")["a\n"].as_uint64_t().value == 1
653
- * parser.parse(R"({ "a\n": 1 })")["a\\n"].as_uint64_t().error == NO_SUCH_FIELD
640
+ * Note: The key will be matched against **unescaped** JSON.
654
641
*
655
642
* @return The value associated with this field, or:
656
643
* - NO_SUCH_FIELD if the field does not exist in the object
657
644
*/
658
- inline element_result at_key ( const char * s) const noexcept ;
645
+ inline element_result at_key_case_insensitive (std::string_view s) const noexcept ;
659
646
660
647
private:
661
648
really_inline element (const document *_doc, size_t _json_index) noexcept ;
@@ -889,7 +876,7 @@ class document::object : protected internal::tape_ref {
889
876
* @return The value associated with this field, or:
890
877
* - NO_SUCH_FIELD if the field does not exist in the object
891
878
*/
892
- inline element_result at_key (std::string_view s ) const noexcept ;
879
+ inline element_result at_key (std::string_view key ) const noexcept ;
893
880
894
881
/* *
895
882
* Get the value associated with the given key.
@@ -899,18 +886,18 @@ class document::object : protected internal::tape_ref {
899
886
* @return The value associated with this field, or:
900
887
* - NO_SUCH_FIELD if the field does not exist in the object
901
888
*/
902
- inline element_result at_key (const char *s ) const noexcept ;
889
+ inline element_result at_key (const char *key ) const noexcept ;
903
890
904
891
/* *
905
- * Get the value associated with the given key, the provided key is
906
- * considered to have length characters.
892
+ * Get the value associated with the given key in a case-insensitive manner.
907
893
*
908
894
* Note: The key will be matched against **unescaped** JSON.
909
895
*
910
896
* @return The value associated with this field, or:
911
897
* - NO_SUCH_FIELD if the field does not exist in the object
912
898
*/
913
- inline element_result at_key (const char *s, size_t length) const noexcept ;
899
+ inline element_result at_key_case_insensitive (std::string_view key) const noexcept ;
900
+
914
901
/* *
915
902
* Get the value associated with the given key in a case-insensitive manner.
916
903
*
@@ -919,7 +906,7 @@ class document::object : protected internal::tape_ref {
919
906
* @return The value associated with this field, or:
920
907
* - NO_SUCH_FIELD if the field does not exist in the object
921
908
*/
922
- inline element_result at_key_case_insensitive (const char *s ) const noexcept ;
909
+ inline element_result at_key_case_insensitive (const char *key ) const noexcept ;
923
910
924
911
private:
925
912
really_inline object (const document *_doc, size_t _json_index) noexcept ;
@@ -967,6 +954,8 @@ class document::element_result : public simdjson_result<document::element> {
967
954
inline element_result at (size_t index) const noexcept ;
968
955
inline element_result at_key (std::string_view key) const noexcept ;
969
956
inline element_result at_key (const char *key) const noexcept ;
957
+ inline element_result at_key_case_insensitive (std::string_view key) const noexcept ;
958
+ inline element_result at_key_case_insensitive (const char *key) const noexcept ;
970
959
971
960
#if SIMDJSON_EXCEPTIONS
972
961
inline operator bool () const noexcept (false );
@@ -1009,7 +998,7 @@ class document::object_result : public simdjson_result<document::object> {
1009
998
inline element_result operator [](const char *json_pointer) const noexcept ;
1010
999
inline element_result at (std::string_view json_pointer) const noexcept ;
1011
1000
inline element_result at_key (std::string_view key) const noexcept ;
1012
- inline element_result at_key ( const char * key) const noexcept ;
1001
+ inline element_result at_key_case_insensitive (std::string_view key) const noexcept ;
1013
1002
1014
1003
#if SIMDJSON_EXCEPTIONS
1015
1004
inline object::iterator begin () const noexcept (false );
0 commit comments