apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

JsonWriter Class Reference

Simple JSON writer. More...

Collaboration diagram for JsonWriter:
[legend]

Public Member Functions

 JsonWriter (std::ostream &os)
 
 ~JsonWriter ()
 
JsonWriterbeginArray ()
 
JsonWriterendArray ()
 
JsonWriterbeginObject ()
 
JsonWriterendObject ()
 
std::ostream & encodeString (std::ostream &out, std::string const &str)
 
JsonWritername (std::string const &name)
 
JsonWritervalue (std::string const &value)
 
JsonWritervalue (const char *value)
 
JsonWritervalue (int value)
 
JsonWritervalue (long value)
 
JsonWritervalue (long long value)
 
JsonWritervalue (unsigned long long value)
 
JsonWritervalue (unsigned long value)
 
JsonWritervalue (unsigned int value)
 
JsonWritervalue (bool value)
 
JsonWritervalue (double value)
 

Private Types

enum  write_state {
  empty , in_array_first_element , in_array , in_object_first_key ,
  in_object_key , in_object_val
}
 

Private Member Functions

void maybeComma ()
 
void pushState (write_state state)
 
void popState ()
 

Private Attributes

std::ostream & os
 
std::locale old_locale
 
enum JsonWriter::write_state state = empty
 
std::stack< write_stateold_states
 

Detailed Description

Simple JSON writer.

This performs no error checking, so be careful.

Definition at line 30 of file private-json-hooks.cc.

Member Enumeration Documentation

◆ write_state

enum write_state
private
Enumerator
empty 
in_array_first_element 
in_array 
in_object_first_key 
in_object_key 
in_object_val 

Definition at line 35 of file private-json-hooks.cc.

Constructor & Destructor Documentation

◆ JsonWriter()

JsonWriter ( std::ostream &  os)
inlineexplicit

Definition at line 87 of file private-json-hooks.cc.

◆ ~JsonWriter()

~JsonWriter ( )
inline

Definition at line 88 of file private-json-hooks.cc.

Member Function Documentation

◆ beginArray()

JsonWriter& beginArray ( )
inline

Definition at line 89 of file private-json-hooks.cc.

Referenced by BuildHelloMessage(), and NotifyHook().

◆ beginObject()

JsonWriter& beginObject ( )
inline

◆ encodeString()

std::ostream& encodeString ( std::ostream &  out,
std::string const &  str 
)
inline

Definition at line 115 of file private-json-hooks.cc.

References ioprintf().

◆ endArray()

JsonWriter& endArray ( )
inline

Definition at line 96 of file private-json-hooks.cc.

Referenced by BuildHelloMessage(), and NotifyHook().

◆ endObject()

JsonWriter& endObject ( )
inline

Definition at line 109 of file private-json-hooks.cc.

Referenced by BuildByeMessage(), BuildHelloMessage(), and verIterToJson().

◆ maybeComma()

void maybeComma ( )
inlineprivate

Definition at line 47 of file private-json-hooks.cc.

◆ name()

JsonWriter& name ( std::string const &  name)
inline

◆ popState()

void popState ( )
inlineprivate

Definition at line 80 of file private-json-hooks.cc.

◆ pushState()

void pushState ( write_state  state)
inlineprivate

Definition at line 74 of file private-json-hooks.cc.

◆ value() [1/10]

JsonWriter& value ( bool  value)
inline

Definition at line 187 of file private-json-hooks.cc.

◆ value() [2/10]

JsonWriter& value ( const char *  value)
inline

Definition at line 142 of file private-json-hooks.cc.

◆ value() [3/10]

JsonWriter& value ( double  value)
inline

Definition at line 193 of file private-json-hooks.cc.

◆ value() [4/10]

JsonWriter& value ( int  value)
inline

Definition at line 151 of file private-json-hooks.cc.

◆ value() [5/10]

JsonWriter& value ( long long  value)
inline

Definition at line 163 of file private-json-hooks.cc.

◆ value() [6/10]

JsonWriter& value ( long  value)
inline

Definition at line 157 of file private-json-hooks.cc.

◆ value() [7/10]

JsonWriter& value ( std::string const &  value)
inline

◆ value() [8/10]

JsonWriter& value ( unsigned int  value)
inline

Definition at line 181 of file private-json-hooks.cc.

◆ value() [9/10]

JsonWriter& value ( unsigned long long  value)
inline

Definition at line 169 of file private-json-hooks.cc.

◆ value() [10/10]

JsonWriter& value ( unsigned long  value)
inline

Definition at line 175 of file private-json-hooks.cc.

Member Data Documentation

◆ old_locale

std::locale old_locale
private

Definition at line 33 of file private-json-hooks.cc.

◆ old_states

std::stack<write_state> old_states
private

Definition at line 45 of file private-json-hooks.cc.

◆ os

std::ostream& os
private

Definition at line 32 of file private-json-hooks.cc.

◆ state

enum JsonWriter::write_state state = empty
private

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