CUBRID Engine  latest
db_json_path.cpp File Reference
#include "db_json_path.hpp"
#include "db_json.hpp"
#include "db_rapidjson.hpp"
#include "memory_alloc.h"
#include "string_opfunc.h"
#include "system_parameter.h"
#include <algorithm>
#include <cctype>
#include <cerrno>
#include <cstdlib>
#include <limits>
#include <string>
#include <unordered_set>
#include <vector>
Include dependency graph for db_json_path.cpp:

Go to the source code of this file.

Enumerations

enum  JSON_PATH_TYPE { JSON_PATH_TYPE::JSON_PATH_SQL_JSON, JSON_PATH_TYPE::JSON_PATH_POINTER }
 

Functions

static void db_json_trim_leading_spaces (std::string &path_string)
 
static JSON_PATH_TYPE db_json_get_path_type (std::string &path_string)
 
static bool db_json_isspace (const unsigned char &ch)
 
static std::size_t skip_whitespaces (const std::string &path, std::size_t token_begin)
 
static int db_json_path_is_token_valid_array_index (const std::string &str, bool allow_wildcards, unsigned long &index, std::size_t start=0, std::size_t end=0)
 
static bool db_json_path_is_token_valid_quoted_object_key (const std::string &path, std::size_t &token_begin)
 
static bool db_json_path_quote_and_validate_unquoted_object_key (std::string &path, std::size_t &token_begin)
 
static bool db_json_path_is_token_valid_unquoted_object_key (const std::string &path, std::size_t &token_begin)
 
static bool db_json_path_is_valid_identifier_start_char (unsigned char ch)
 
static bool db_json_path_is_valid_identifier_char (unsigned char ch)
 
static void db_json_remove_leading_zeros_index (std::string &index)
 
static bool db_json_iszero (const unsigned char &ch)
 
int db_json_split_path_by_delimiters (const std::string &path, const std::string &delim, bool allow_empty, std::vector< std::string > &split_path)
 
int db_json_path_unquote_object_keys (std::string &sql_path)
 

Enumeration Type Documentation

enum JSON_PATH_TYPE
strong
Enumerator
JSON_PATH_SQL_JSON 
JSON_PATH_POINTER 

Definition at line 36 of file db_json_path.cpp.

Function Documentation

static JSON_PATH_TYPE db_json_get_path_type ( std::string &  path_string)
static

Definition at line 287 of file db_json_path.cpp.

References db_json_trim_leading_spaces(), JSON_PATH_POINTER, and JSON_PATH_SQL_JSON.

Referenced by JSON_PATH::parse().

Here is the caller graph for this function:

static bool db_json_isspace ( const unsigned char &  ch)
static

Definition at line 273 of file db_json_path.cpp.

Referenced by db_json_trim_leading_spaces().

Here is the caller graph for this function:

static bool db_json_iszero ( const unsigned char &  ch)
static

Definition at line 57 of file db_json_path.cpp.

Referenced by db_json_remove_leading_zeros_index().

Here is the caller graph for this function:

static int db_json_path_is_token_valid_array_index ( const std::string &  str,
bool  allow_wildcards,
unsigned long &  index,
std::size_t  start = 0,
std::size_t  end = 0 
)
static
static bool db_json_path_is_token_valid_quoted_object_key ( const std::string &  path,
std::size_t &  token_begin 
)
static

Definition at line 70 of file db_json_path.cpp.

References i, and skip_whitespaces().

Referenced by JSON_PATH::validate_and_create_from_json_path().

Here is the caller graph for this function:

static bool db_json_path_is_token_valid_unquoted_object_key ( const std::string &  path,
std::size_t &  token_begin 
)
static
static bool db_json_path_is_valid_identifier_char ( unsigned char  ch)
static

Definition at line 130 of file db_json_path.cpp.

Referenced by db_json_path_is_token_valid_unquoted_object_key().

Here is the caller graph for this function:

static bool db_json_path_is_valid_identifier_start_char ( unsigned char  ch)
static

Definition at line 120 of file db_json_path.cpp.

Referenced by db_json_path_is_token_valid_unquoted_object_key().

Here is the caller graph for this function:

static bool db_json_path_quote_and_validate_unquoted_object_key ( std::string &  path,
std::size_t &  token_begin 
)
static

Definition at line 104 of file db_json_path.cpp.

References db_json_path_is_token_valid_unquoted_object_key(), i, and skip_whitespaces().

Referenced by JSON_PATH::validate_and_create_from_json_path().

Here is the caller graph for this function:

int db_json_path_unquote_object_keys ( std::string &  sql_path)

Definition at line 554 of file db_json_path.cpp.

References assert, ASSERT_ERROR, db_json_path_is_token_valid_unquoted_object_key(), db_json_split_path_by_delimiters(), i, and NO_ERROR.

Referenced by db_json_path_unquote_object_keys_external().

Here is the caller graph for this function:

static void db_json_remove_leading_zeros_index ( std::string &  index)
static

Definition at line 602 of file db_json_path.cpp.

References db_json_iszero().

Referenced by db_json_split_path_by_delimiters().

Here is the caller graph for this function:

int db_json_split_path_by_delimiters ( const std::string &  path,
const std::string &  delim,
bool  allow_empty,
std::vector< std::string > &  split_path 
)
static void db_json_trim_leading_spaces ( std::string &  path_string)
static

Definition at line 279 of file db_json_path.cpp.

References db_json_isspace().

Referenced by db_json_get_path_type(), and JSON_PATH::validate_and_create_from_json_path().

Here is the caller graph for this function:

static std::size_t skip_whitespaces ( const std::string &  path,
std::size_t  token_begin 
)
static