Loading...
Searching...
No Matches
gx_system::JsonParser Class Reference

`#include <gx_json.h>`

Inheritance diagram for gx_system::JsonParser:

## Public Types

enum | token { no_token = 0x0000 , end_token = 0x0001 , begin_object = 0x002 , end_object = 0x0004 , begin_array = 0x0008 , end_array = 0x0010 , value_string = 0x0020 , value_number = 0x0040 , value_key = 0x0080 , value_null = 0x0100 , value_false = 0x0200 , value_true = 0x0400 , value_bool = 0x0600 }

## Public Member Functions

| JsonParser (istream *i=0)
virtual | ~JsonParser ()
virtual void | close ()
void | reset ()
bool | is_closed ()
void | set_stream (istream *i)
istream * | get_stream ()
const char * | get_token_name (token tok)
bool | good ()
token | next (token expect=no_token)
token | peek ()
streampos | get_streampos ()
void | set_streampos (streampos pos)
void | check_expect (token expect)
string | current_value () const
int | current_value_int ()
unsigned int | current_value_uint ()
float | current_value_float ()
double | current_value_double ()
bool | read_kv (const char *key, float &v)
bool | read_kv (const char *key, double &v)
bool | read_kv (const char *key, int &i)
bool | read_kv (const char *key, unsigned int &i)
bool | read_kv (const char *key, std::string &s)
bool | read_kv (const char *key, Glib::ustring &s)
template<class T>
bool | read_kv (const char *key, T &v)
void | copy_object (JsonWriter &jw)
void | skip_object ()
void | throw_unexpected (token expect)

## Private Member Functions

const char * | readcode ()
string | readstring ()
token | read_value_token (char c)
string | readnumber (char c)
void | read_next ()

## Private Attributes

istream * | is
int | depth
token | cur_tok
string | str
bool | nl
int | next_depth
token | next_tok
string | next_str
string | log_tok
streampos | next_pos

## Detailed Description

Definition at line 112 of file gx_json.h.

## Member Enumeration Documentation

## token

enum gx_system::JsonParser::token

Enumerator
no_token |
end_token |
begin_object |
end_object |
begin_array |
end_array |
value_string |
value_number |
value_key |
value_null |
value_false |
value_true |
value_bool |

Definition at line 121 of file gx_json.h.

## Constructor & Destructor Documentation

## JsonParser()

gx_system::JsonParser::JsonParser | ( | istream * | i = 0 | ) |

Referenced by gx_system::JsonSubParser::JsonSubParser().

## ~JsonParser()

virtual gx_system::JsonParser::~JsonParser | ( |  | ) |

virtual

## Member Function Documentation

## check_expect()

void gx_system::JsonParser::check_expect | ( | token | expect | ) |

inline

Definition at line 142 of file gx_json.h.

## close()

virtual void gx_system::JsonParser::close | ( |  | ) |

virtual

## copy_object()

void gx_system::JsonParser::copy_object | ( | JsonWriter & | jw | ) |

## current_value()

string gx_system::JsonParser::current_value | ( |  | ) | const

inline

Definition at line 143 of file gx_json.h.

## current_value_double()

double gx_system::JsonParser::current_value_double | ( |  | ) |

inline

Definition at line 152 of file gx_json.h.

## current_value_float()

float gx_system::JsonParser::current_value_float | ( |  | ) |

inline

Definition at line 146 of file gx_json.h.

## current_value_int()

int gx_system::JsonParser::current_value_int | ( |  | ) |

inline

Definition at line 144 of file gx_json.h.

## current_value_uint()

unsigned int gx_system::JsonParser::current_value_uint | ( |  | ) |

inline

Definition at line 145 of file gx_json.h.

## get_stream()

istream * gx_system::JsonParser::get_stream | ( |  | ) |

inline

Definition at line 120 of file gx_json.h.

## get_streampos()

streampos gx_system::JsonParser::get_streampos | ( |  | ) |

inline

Definition at line 140 of file gx_json.h.

## get_token_name()

const char * gx_system::JsonParser::get_token_name | ( | token | tok | ) |

## good()

bool gx_system::JsonParser::good | ( |  | ) |

inline

Definition at line 137 of file gx_json.h.

## is_closed()

bool gx_system::JsonParser::is_closed | ( |  | ) |

inline

Definition at line 118 of file gx_json.h.

## next()

token gx_system::JsonParser::next | ( | token | expect = no_token | ) |

## peek()

token gx_system::JsonParser::peek | ( |  | ) |

inline

Definition at line 139 of file gx_json.h.

## read_kv() [1/7]

bool gx_system::JsonParser::read_kv | ( | const char * | key,
|  | double & | v )

## read_kv() [2/7]

bool gx_system::JsonParser::read_kv | ( | const char * | key,
|  | float & | v )

Referenced by read_kv().

## read_kv() [3/7]

bool gx_system::JsonParser::read_kv | ( | const char * | key,
|  | Glib::ustring & | s )

## read_kv() [4/7]

bool gx_system::JsonParser::read_kv | ( | const char * | key,
|  | int & | i )

## read_kv() [5/7]

bool gx_system::JsonParser::read_kv | ( | const char * | key,
|  | std::string & | s )

## read_kv() [6/7]

template<class T>

bool gx_system::JsonParser::read_kv | ( | const char * | key,
|  | T & | v )

inline

Definition at line 164 of file gx_json.h.

## read_kv() [7/7]

bool gx_system::JsonParser::read_kv | ( | const char * | key,
|  | unsigned int & | i )

## read_next()

void gx_system::JsonParser::read_next | ( |  | ) |

private

## read_value_token()

token gx_system::JsonParser::read_value_token | ( | char | c | ) |

private

## readcode()

const char * gx_system::JsonParser::readcode | ( |  | ) |

private

## readnumber()

string gx_system::JsonParser::readnumber | ( | char | c | ) |

private

## readstring()

string gx_system::JsonParser::readstring | ( |  | ) |

private

## reset()

void gx_system::JsonParser::reset | ( |  | ) |

Referenced by gx_system::JsonStringParser::reset().

## set_stream()

void gx_system::JsonParser::set_stream | ( | istream * | i | ) |

inline

Definition at line 119 of file gx_json.h.

Referenced by gx_system::JsonStringParser::start_parser().

## set_streampos()

void gx_system::JsonParser::set_streampos | ( | streampos | pos | ) |

## skip_object()

void gx_system::JsonParser::skip_object | ( |  | ) |

## throw_unexpected()

void gx_system::JsonParser::throw_unexpected | ( | token | expect | ) |

Referenced by check_expect().

## Member Data Documentation

## cur_tok

token gx_system::JsonParser::cur_tok

private

Definition at line 178 of file gx_json.h.

Referenced by check_expect().

## depth

int gx_system::JsonParser::depth

private

Definition at line 177 of file gx_json.h.

## is

istream* gx_system::JsonParser::is

private

Definition at line 176 of file gx_json.h.

Referenced by get_stream(), good(), is_closed(), and set_stream().

## log_tok

string gx_system::JsonParser::log_tok

private

Definition at line 184 of file gx_json.h.

## next_depth

int gx_system::JsonParser::next_depth

private

Definition at line 181 of file gx_json.h.

## next_pos

streampos gx_system::JsonParser::next_pos

private

Definition at line 185 of file gx_json.h.

Referenced by get_streampos().

## next_str

string gx_system::JsonParser::next_str

private

Definition at line 183 of file gx_json.h.

## next_tok

token gx_system::JsonParser::next_tok

private

Definition at line 182 of file gx_json.h.

Referenced by peek().

## nl

bool gx_system::JsonParser::nl

private

Definition at line 180 of file gx_json.h.

## str

string gx_system::JsonParser::str

private

Definition at line 179 of file gx_json.h.

Referenced by current_value(), current_value_double(), current_value_float(), current_value_int(), and current_value_uint().

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

- src/headers/gx_json.h