@@ -180,6 +180,20 @@ 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
+
183
197
std::unique_ptr<uint64_t []> tape;
184
198
std::unique_ptr<uint8_t []> string_buf;// should be at least byte_capacity
185
199
@@ -635,14 +649,18 @@ class document::element : protected internal::tape_ref {
635
649
inline element_result at_key (std::string_view s) const noexcept ;
636
650
637
651
/* *
638
- * Get the value associated with the given key in a case-insensitive manner .
652
+ * Get the value associated with the given key.
639
653
*
640
- * Note: The key will be matched against **unescaped** JSON.
654
+ * Note: The key will be matched against **unescaped** JSON:
655
+ *
656
+ * document::parser parser;
657
+ * parser.parse(R"({ "a\n": 1 })")["a\n"].as_uint64_t().value == 1
658
+ * parser.parse(R"({ "a\n": 1 })")["a\\n"].as_uint64_t().error == NO_SUCH_FIELD
641
659
*
642
660
* @return The value associated with this field, or:
643
661
* - NO_SUCH_FIELD if the field does not exist in the object
644
662
*/
645
- inline element_result at_key_case_insensitive (std::string_view s) const noexcept ;
663
+ inline element_result at_key ( const char * s) const noexcept ;
646
664
647
665
private:
648
666
really_inline element (const document *_doc, size_t _json_index) noexcept ;
@@ -876,7 +894,7 @@ class document::object : protected internal::tape_ref {
876
894
* @return The value associated with this field, or:
877
895
* - NO_SUCH_FIELD if the field does not exist in the object
878
896
*/
879
- inline element_result at_key (std::string_view key ) const noexcept ;
897
+ inline element_result at_key (std::string_view s ) const noexcept ;
880
898
881
899
/* *
882
900
* Get the value associated with the given key.
@@ -886,18 +904,18 @@ class document::object : protected internal::tape_ref {
886
904
* @return The value associated with this field, or:
887
905
* - NO_SUCH_FIELD if the field does not exist in the object
888
906
*/
889
- inline element_result at_key (const char *key ) const noexcept ;
907
+ inline element_result at_key (const char *s ) const noexcept ;
890
908
891
909
/* *
892
- * Get the value associated with the given key in a case-insensitive manner.
910
+ * Get the value associated with the given key, the provided key is
911
+ * considered to have length characters.
893
912
*
894
913
* Note: The key will be matched against **unescaped** JSON.
895
914
*
896
915
* @return The value associated with this field, or:
897
916
* - NO_SUCH_FIELD if the field does not exist in the object
898
917
*/
899
- inline element_result at_key_case_insensitive (std::string_view key) const noexcept ;
900
-
918
+ inline element_result at_key (const char *s, size_t length) const noexcept ;
901
919
/* *
902
920
* Get the value associated with the given key in a case-insensitive manner.
903
921
*
@@ -906,7 +924,7 @@ class document::object : protected internal::tape_ref {
906
924
* @return The value associated with this field, or:
907
925
* - NO_SUCH_FIELD if the field does not exist in the object
908
926
*/
909
- inline element_result at_key_case_insensitive (const char *key ) const noexcept ;
927
+ inline element_result at_key_case_insensitive (const char *s ) const noexcept ;
910
928
911
929
private:
912
930
really_inline object (const document *_doc, size_t _json_index) noexcept ;
@@ -954,8 +972,6 @@ class document::element_result : public simdjson_result<document::element> {
954
972
inline element_result at (size_t index) const noexcept ;
955
973
inline element_result at_key (std::string_view key) const noexcept ;
956
974
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 ;
959
975
960
976
#if SIMDJSON_EXCEPTIONS
961
977
inline operator bool () const noexcept (false );
@@ -998,7 +1014,7 @@ class document::object_result : public simdjson_result<document::object> {
998
1014
inline element_result operator [](const char *json_pointer) const noexcept ;
999
1015
inline element_result at (std::string_view json_pointer) const noexcept ;
1000
1016
inline element_result at_key (std::string_view key) const noexcept ;
1001
- inline element_result at_key_case_insensitive (std::string_view key) const noexcept ;
1017
+ inline element_result at_key ( const char * key) const noexcept ;
1002
1018
1003
1019
#if SIMDJSON_EXCEPTIONS
1004
1020
inline object::iterator begin () const noexcept (false );
0 commit comments