CUBRID Engine  latest
JSON_PATH Class Reference

#include <db_json_path.hpp>

Collaboration diagram for JSON_PATH:
Collaboration graph

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_VALUEget (JSON_DOC &jd) const
 
const JSON_VALUEget (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_TOKENget_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
 

Detailed Description

Definition at line 62 of file db_json_path.hpp.

Member Typedef Documentation

using JSON_PATH::token_containter_type = std::vector<PATH_TOKEN>
private

Definition at line 103 of file db_json_path.hpp.

Member Enumeration Documentation

enum JSON_PATH::MATCH_RESULT
Enumerator
NO_MATCH 
PREFIX_MATCH 
FULL_MATCH 

Definition at line 65 of file db_json_path.hpp.

Member Function Documentation

bool JSON_PATH::contains_wildcard ( ) const

Definition at line 715 of file db_json_path.cpp.

Referenced by match_pattern().

Here is the caller graph for this function:

bool JSON_PATH::erase ( JSON_DOC jd) const

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().

Here is the caller graph for this function:

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().

void JSON_PATH::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 
)
staticprivate
int JSON_PATH::from_json_pointer ( const std::string &  pointer_path)
private
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().

Here is the caller graph for this function:

JSON_PATH JSON_PATH::get_parent ( ) const

Definition at line 1070 of file db_json_path.cpp.

References assert, and pop().

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().

Here is the caller graph for this function:

size_t JSON_PATH::get_token_count ( ) const

Definition at line 1058 of file db_json_path.cpp.

Referenced by extract_from_subtree().

Here is the caller graph for this function:

bool JSON_PATH::is_last_array_index_less_than ( size_t  size) const
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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

JSON_PATH::MATCH_RESULT JSON_PATH::match_pattern ( const JSON_PATH pattern,
const JSON_PATH path 
)
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().

Here is the caller graph for this function:

static MATCH_RESULT JSON_PATH::match_pattern ( const JSON_PATH pattern,
const token_containter_type::const_iterator &  it1,
const JSON_PATH path,
const token_containter_type::const_iterator &  it2 
)
staticprivate
bool JSON_PATH::parent_exists ( JSON_DOC jd) const

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().

Here is the caller graph for this function:

bool JSON_PATH::points_to_array_cell ( ) const
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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Member Data Documentation

token_containter_type JSON_PATH::m_path_tokens
private

The documentation for this class was generated from the following files: