|
Simpleson
|
Namespace used for JSON parsing functions. More...
Classes | |
| struct | parse_results |
| Structure for capturing the results of parsing. More... | |
Functions | |
| const char * | tlws (const char *start) |
| (t)rims (l)eading (w)hite (s)pace More... | |
| std::string | read_digits (const char *input) |
| Reads a set of digits from a string. More... | |
| std::string | escape_quotes (const char *input) |
| Escape quotes in a string. More... | |
| std::string | unescape_quotes (const char *input) |
| Removes the escape charater from quotes. More... | |
| parse_results | parse (const char *input) |
| Parses the first value encountered in a JSON string. More... | |
| template<typename T > | |
| T | get_number (const char *input, const char *format) |
| Template for reading a numeric value. More... | |
| template<typename T > | |
| std::string | get_number_string (const T &number, const char *format) |
| Converts a number to a string. More... | |
| std::vector< std::string > | parse_array (const char *input) |
| Parses a JSON array. More... | |
Namespace used for JSON parsing functions.
| std::string json::parsing::escape_quotes | ( | const char * | input | ) |
Escape quotes in a string.
See json::parsing::unescape_quotes() for the reverse function
| input | A string potentially containing quotes |
| T json::parsing::get_number | ( | const char * | input, |
| const char * | format | ||
| ) |
Template for reading a numeric value.
| T | The C data type the input will be convered to |
| input | The string to conver to a number |
| format | The format to use when converting the string to a number |
| std::string json::parsing::get_number_string | ( | const T & | number, |
| const char * | format | ||
| ) |
Converts a number to a string.
| The | C data type of the number to be converted |
| number | A reference to the number to be converted |
| format | The format to be used when converting the number |
| json::parsing::parse_results json::parsing::parse | ( | const char * | input | ) |
Parses the first value encountered in a JSON string.
| input | The string to be parsed |
| json::parsing_error | Exception thrown when the input is not valid JSON |
| std::vector< std::string > json::parsing::parse_array | ( | const char * | input | ) |
Parses a JSON array.
Converts a serialized JSON array into a vector of the values in the array
| input | The serialized JSON array |
| std::string json::parsing::read_digits | ( | const char * | input | ) |
Reads a set of digits from a string.
This function will take an input string and read the digits at the front of the string until a character other than a digit (0-9) is encountered.
| input | A string that starts with a set of digits (0-9) |
| const char * json::parsing::tlws | ( | const char * | start | ) |
(t)rims (l)eading (w)hite (s)pace
Given a string, returns a pointer to the first character that is not white space. Spaces, tabs, and carriage returns are all considered white space.
| start | The string to examine |
| std::string json::parsing::unescape_quotes | ( | const char * | input | ) |
Removes the escape charater from quotes.
See json::parsing::escape_quotes for the reverse function
| input | A string potentially containing escaped quotes |