MySQL 8.0.39
Source Code Documentation
options_parser Namespace Reference

Classes

struct  result
 Struct for storing the parsing result. More...
 

Enumerations

enum class  parser_status {
  OK , MISSING_SEPARATOR , MORE_THAN_ONE_SEPARATOR , SEQUENTIAL_SEPARATORS ,
  SEQUENTIAL_DELIMITERS , STARTS_WITH_INVALID_CHARACTER , ENDS_WITH_INVALID_CHARACTER , DUPLICATE_KEY
}
 

Functions

result parse_options_string (String *str, char delimiter, char key_value_separator, std::map< std::string, std::string > *options)
 Parses the options string into keys and values. More...
 
bool resolve_parser_result (result result, const char *function_name)
 Determines result of parsing operation, raises error if parsing was unsuccessful. More...
 
bool parse_string (String *str, std::map< std::string, std::string > *map, const char *func_name)
 Parses options string into a map of keys and values, raises an error if parsing is unsuccessful. More...
 

Enumeration Type Documentation

◆ parser_status

enum class options_parser::parser_status
strong
Enumerator
OK 
MISSING_SEPARATOR 
MORE_THAN_ONE_SEPARATOR 
SEQUENTIAL_SEPARATORS 
SEQUENTIAL_DELIMITERS 
STARTS_WITH_INVALID_CHARACTER 
ENDS_WITH_INVALID_CHARACTER 
DUPLICATE_KEY 

Function Documentation

◆ parse_options_string()

result options_parser::parse_options_string ( String str,
char  delimiter,
char  key_value_separator,
std::map< std::string, std::string > *  options 
)

Parses the options string into keys and values.

Parses an options string into a set of keys and values, and stores the result in an an std::map pointer. The string is split based on a delimiter and a key-value separator, and might look something like: "key1=value1, key2=value2, key3=value3...".

Parameters
strunparsed options string
delimitercharacter to split the options string into several substrings
key_value_separatorvalue which separates string into key and value
optionspointer to an std::map
Returns
result

◆ parse_string()

bool options_parser::parse_string ( String str,
std::map< std::string, std::string > *  map,
const char *  func_name 
)

Parses options string into a map of keys and values, raises an error if parsing is unsuccessful.

Parameters
strunparsed options string
mapmap to fill with keys and values
func_namefunction name used in error reporting
Return values
falseparsing was successful
trueparsing was successful

◆ resolve_parser_result()

bool options_parser::resolve_parser_result ( result  result,
const char *  function_name 
)

Determines result of parsing operation, raises error if parsing was unsuccessful.

Determines the result of parsing operation by looking at the status field of the result struct, and raises an appropriate error if the parsing operation is unsuccessful.

Parameters
resultstruct returned from parsing function
function_namename of function that uses parsing function
Return values
falseparsing was successful
trueparsing was ununsuccessful