CUBRID Engine
latest
|
#include <db_json_path.hpp>
Public Types | |
enum | MATCH_RESULT { NO_MATCH, PREFIX_MATCH, FULL_MATCH } |
Public Member Functions | |
std::string | dump_json_path () const |
int | parse (const char *path) |
JSON_PATH | get_parent () const |
JSON_VALUE * | get (JSON_DOC &jd) const |
const JSON_VALUE * | get (const JSON_DOC &jd) const |
std::vector< const JSON_VALUE * > | extract (const JSON_DOC &) const |
void | set (JSON_DOC &jd, const JSON_VALUE &jv) const |
void | set (JSON_VALUE &jd, const JSON_VALUE &jv, JSON_PRIVATE_MEMPOOL &allocator) const |
bool | erase (JSON_DOC &jd) const |
const PATH_TOKEN * | get_last_token () const |
size_t | get_token_count () const |
bool | is_root_path () const |
bool | is_last_array_index_less_than (size_t size) const |
bool | is_last_token_array_index_zero () const |
bool | points_to_array_cell () const |
bool | parent_exists (JSON_DOC &jd) const |
bool | contains_wildcard () const |
void | push_array_index (unsigned long idx) |
void | push_array_index_wildcard () |
void | push_object_key (std::string &&object_key) |
void | push_object_key_wildcard () |
void | push_double_wildcard () |
void | pop () |
Static Public Member Functions | |
static MATCH_RESULT | match_pattern (const JSON_PATH &pattern, const JSON_PATH &path) |
Private Types | |
using | token_containter_type = std::vector< PATH_TOKEN > |
Private Member Functions | |
int | from_json_pointer (const std::string &pointer_path) |
int | validate_and_create_from_json_path (std::string &sql_path) |
Static Private Member Functions | |
static MATCH_RESULT | match_pattern (const JSON_PATH &pattern, const token_containter_type::const_iterator &it1, const JSON_PATH &path, const token_containter_type::const_iterator &it2) |
static void | extract_from_subtree (const JSON_PATH &path, size_t tkn_array_offset, const JSON_VALUE &jv, std::unordered_set< const JSON_VALUE * > &unique_elements, std::vector< const JSON_VALUE * > &vals) |
Private Attributes | |
token_containter_type | m_path_tokens |
Definition at line 62 of file db_json_path.hpp.
|
private |
Definition at line 103 of file db_json_path.hpp.
enum JSON_PATH::MATCH_RESULT |
Enumerator | |
---|---|
NO_MATCH | |
PREFIX_MATCH | |
FULL_MATCH |
Definition at line 65 of file db_json_path.hpp.
bool JSON_PATH::contains_wildcard | ( | ) | const |
Definition at line 715 of file db_json_path.cpp.
Referenced by match_pattern().
std::string JSON_PATH::dump_json_path | ( | ) | const |
Definition at line 728 of file db_json_path.cpp.
References PATH_TOKEN::array_end_index, PATH_TOKEN::array_index, PATH_TOKEN::array_index_wildcard, assert, PATH_TOKEN::double_wildcard, PATH_TOKEN::object_key, and PATH_TOKEN::object_key_wildcard.
Referenced by db_json_array_insert_func(), db_json_er_set_expected_other_type(), db_json_er_set_path_does_not_exist(), and db_json_normalize_path_string().
Definition at line 1014 of file db_json_path.cpp.
References db_json_json_string_as_utf8(), PATH_TOKEN::get_array_index(), PATH_TOKEN::get_object_key(), PATH_TOKEN::m_type, and PATH_TOKEN::object_key.
Referenced by db_json_remove_func().
std::vector< const JSON_VALUE * > JSON_PATH::extract | ( | const JSON_DOC & | jd | ) | const |
Definition at line 1003 of file db_json_path.cpp.
References db_json_doc_to_value().
|
staticprivate |
Definition at line 914 of file db_json_path.cpp.
References db_json_json_string_as_utf8(), PATH_TOKEN::get_array_index(), PATH_TOKEN::get_object_key(), get_token_count(), i, m_path_tokens, and PATH_TOKEN::m_type.
|
private |
Definition at line 1160 of file db_json_path.cpp.
References ARG_FILE_LINE, db_private_free, db_string_escape_str(), ER_ERROR_SEVERITY, ER_JSON_INVALID_PATH, er_set(), i, NO_ERROR, and NULL.
JSON_VALUE * JSON_PATH::get | ( | JSON_DOC & | jd | ) | const |
Definition at line 859 of file db_json_path.cpp.
Referenced by db_json_array_append_func(), db_json_array_insert_func(), db_json_get_all_paths_func(), db_json_insert_func(), db_json_keys_func(), db_json_remove_func(), db_json_replace_func(), and db_json_set_func().
const JSON_VALUE * JSON_PATH::get | ( | const JSON_DOC & | jd | ) | const |
Definition at line 871 of file db_json_path.cpp.
References db_json_doc_to_value(), db_json_json_string_as_utf8(), and NULL.
const PATH_TOKEN * JSON_PATH::get_last_token | ( | ) | const |
Definition at line 1052 of file db_json_path.cpp.
References NULL.
Referenced by db_json_array_insert_func().
JSON_PATH JSON_PATH::get_parent | ( | ) | const |
Definition at line 1070 of file db_json_path.cpp.
Referenced by db_json_array_append_func(), db_json_array_insert_func(), db_json_insert_func(), db_json_remove_func(), db_json_replace_func(), and db_json_set_func().
size_t JSON_PATH::get_token_count | ( | ) | const |
Definition at line 1058 of file db_json_path.cpp.
Referenced by extract_from_subtree().
bool JSON_PATH::is_last_array_index_less_than | ( | size_t | size | ) | const |
Definition at line 1089 of file db_json_path.cpp.
References PATH_TOKEN::array_index, assert, PATH_TOKEN::get_array_index(), PATH_TOKEN::m_type, and NULL.
Referenced by db_json_array_append_func(), db_json_array_insert_func(), db_json_insert_func(), and db_json_replace_func().
bool JSON_PATH::is_last_token_array_index_zero | ( | ) | const |
Definition at line 1098 of file db_json_path.cpp.
Referenced by db_json_array_append_func(), db_json_insert_func(), db_json_remove_func(), db_json_replace_func(), and db_json_set_func().
bool JSON_PATH::is_root_path | ( | ) | const |
Definition at line 1064 of file db_json_path.cpp.
Referenced by db_json_array_append_func(), db_json_insert_func(), db_json_remove_func(), and db_json_replace_func().
|
static |
Definition at line 540 of file db_json_path.cpp.
References assert, contains_wildcard(), and m_path_tokens.
Referenced by db_json_contains_path(), db_json_search_func(), and db_json_split_path_by_delimiters().
|
staticprivate |
Definition at line 1112 of file db_json_path.cpp.
References NULL.
Referenced by db_json_array_append_func(), db_json_array_insert_func(), db_json_insert_func(), db_json_remove_func(), db_json_replace_func(), and db_json_set_func().
int JSON_PATH::parse | ( | const char * | path | ) |
Definition at line 1135 of file db_json_path.cpp.
References ASSERT_ERROR, db_json_get_path_type(), JSON_PATH_POINTER, and NO_ERROR.
Referenced by db_json_array_append_func(), db_json_array_insert_func(), db_json_insert_func(), db_json_keys_func(), db_json_normalize_path_string(), db_json_remove_func(), db_json_replace_func(), and db_json_set_func().
bool JSON_PATH::points_to_array_cell | ( | ) | const |
Definition at line 1104 of file db_json_path.cpp.
References PATH_TOKEN::array_end_index, PATH_TOKEN::array_index, PATH_TOKEN::m_type, and NULL.
Referenced by db_json_array_append_func(), db_json_array_insert_func(), db_json_insert_func(), db_json_replace_func(), and db_json_set_func().
void JSON_PATH::pop | ( | ) |
Definition at line 709 of file db_json_path.cpp.
Referenced by JSON_PATH_MAPPER::CallAfter(), JSON_PATH_MAPPER::CallOnArrayIterate(), JSON_PATH_MAPPER::CallOnKeyIterate(), and get_parent().
void JSON_PATH::push_array_index | ( | unsigned long | idx | ) |
Definition at line 679 of file db_json_path.cpp.
Referenced by JSON_PATH_MAPPER::CallBefore(), and JSON_PATH_MAPPER::CallOnArrayIterate().
void JSON_PATH::push_array_index_wildcard | ( | ) |
Definition at line 685 of file db_json_path.cpp.
void JSON_PATH::push_double_wildcard | ( | ) |
Definition at line 703 of file db_json_path.cpp.
void JSON_PATH::push_object_key | ( | std::string && | object_key | ) |
Definition at line 691 of file db_json_path.cpp.
References PATH_TOKEN::object_key.
Referenced by JSON_PATH_MAPPER::CallOnKeyIterate().
void JSON_PATH::push_object_key_wildcard | ( | ) |
Definition at line 697 of file db_json_path.cpp.
void JSON_PATH::set | ( | JSON_DOC & | jd, |
const JSON_VALUE & | jv | ||
) | const |
Definition at line 769 of file db_json_path.cpp.
References db_json_doc_to_value().
Referenced by db_json_array_insert_func(), db_json_insert_func(), db_json_replace_func(), and db_json_set_func().
void JSON_PATH::set | ( | JSON_VALUE & | jd, |
const JSON_VALUE & | jv, | ||
JSON_PRIVATE_MEMPOOL & | allocator | ||
) | const |
Definition at line 789 of file db_json_path.cpp.
References assert, and db_json_json_string_as_utf8().
|
private |
Definition at line 308 of file db_json_path.cpp.
References ARG_FILE_LINE, ASSERT_ERROR, db_json_path_is_token_valid_array_index(), db_json_path_is_token_valid_quoted_object_key(), db_json_path_quote_and_validate_unquoted_object_key(), db_json_trim_leading_spaces(), ER_ERROR_SEVERITY, ER_JSON_INVALID_PATH, er_set(), i, NO_ERROR, and skip_whitespaces().
|
private |
Definition at line 116 of file db_json_path.hpp.
Referenced by db_json_split_path_by_delimiters(), extract_from_subtree(), and match_pattern().