Guitarix
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)
 

Detailed Description

Definition at line 111 of file gx_json.h.

Member Enumeration Documentation

◆ 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 120 of file gx_json.h.

Constructor & Destructor Documentation

◆ JsonParser()

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

Definition at line 258 of file gx_json.cpp.

◆ ~JsonParser()

gx_system::JsonParser::~JsonParser ( )
virtual

Definition at line 270 of file gx_json.cpp.

Member Function Documentation

◆ check_expect()

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

Definition at line 141 of file gx_json.h.

◆ close()

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

Reimplemented in gx_system::JsonReader.

Definition at line 274 of file gx_json.cpp.

Referenced by ladspa::PluginDesc::set_state().

◆ copy_object()

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

Definition at line 577 of file gx_json.cpp.

◆ current_value()

◆ current_value_double()

double gx_system::JsonParser::current_value_double ( )
inline

Definition at line 151 of file gx_json.h.

◆ current_value_float()

float gx_system::JsonParser::current_value_float ( )
inline

◆ current_value_int()

◆ current_value_uint()

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

Definition at line 144 of file gx_json.h.

◆ get_stream()

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

Definition at line 119 of file gx_json.h.

◆ get_streampos()

streampos gx_system::JsonParser::get_streampos ( )
inline

Definition at line 139 of file gx_json.h.

◆ get_token_name()

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

Definition at line 281 of file gx_json.cpp.

◆ good()

bool gx_system::JsonParser::good ( )
inline

Definition at line 136 of file gx_json.h.

◆ is_closed()

bool gx_system::JsonParser::is_closed ( )
inline

Definition at line 117 of file gx_json.h.

◆ next()

◆ peek()

◆ read_kv() [1/7]

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

Definition at line 518 of file gx_json.cpp.

◆ read_kv() [2/7]

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

◆ read_kv() [3/7]

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

Definition at line 558 of file gx_json.cpp.

◆ read_kv() [4/7]

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

Definition at line 528 of file gx_json.cpp.

◆ read_kv() [5/7]

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

Definition at line 548 of file gx_json.cpp.

◆ read_kv() [6/7]

template<class T >
bool gx_system::JsonParser::read_kv ( const char *  key,
T &  v 
)
inline

Definition at line 163 of file gx_json.h.

◆ read_kv() [7/7]

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

Definition at line 538 of file gx_json.cpp.

◆ reset()

void gx_system::JsonParser::reset ( void  )

Definition at line 247 of file gx_json.cpp.

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

◆ set_stream()

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

Definition at line 118 of file gx_json.h.

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

◆ set_streampos()

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

Definition at line 568 of file gx_json.cpp.

◆ skip_object()

◆ throw_unexpected()

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

Definition at line 300 of file gx_json.cpp.

Referenced by current_value().


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