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

`#include <gx_json.h>`

Inheritance diagram for gx_system::JsonWriter:

## Public Member Functions

| JsonWriter (ostream *o=0, bool enable_newlines=true)
virtual | ~JsonWriter ()
void | reset ()
void | set_stream (ostream *o)
bool | good ()
void | flush ()
virtual void | close ()
bool | is_closed ()
void | write (float v, bool nl=false)
void | write (double v, bool nl=false)
void | write (int i, bool nl=false)
void | write (unsigned int i, bool nl=false)
void | write (const char *p, bool nl=false)
void | write (const string &s, bool nl=false)
void | write_kv (const char *key, float v)
void | write_kv (const char *key, double v)
void | write_kv (const char *key, int i)
void | write_kv (const char *key, unsigned int i)
void | write_kv (const char *key, const char *p)
void | write_kv (const char *key, const std::string &s)
void | write_lit (const string &s, bool nl=false)
void | begin_object (bool nl=false)
void | end_object (bool nl=false)
void | begin_array (bool nl=false)
void | end_array (bool nl=false)
void | write_key (const char *p, bool nl=false)
void | write_key (const string &p, bool nl=false)
void | write_null (bool nl=false)
void | newline ()

## Private Member Functions

void | snl (bool v)
void | komma ()
void | space ()
void | iplus ()
void | iminus ()

## Private Attributes

ostream * | os
bool | first
int | deferred_nl
string | indent

## Detailed Description

Definition at line 55 of file gx_json.h.

## Constructor & Destructor Documentation

## JsonWriter()

gx_system::JsonWriter::JsonWriter | ( | ostream * | o = 0,
|  | bool | enable_newlines = true )

Referenced by gx_system::JsonStringWriter::JsonStringWriter().

## ~JsonWriter()

virtual gx_system::JsonWriter::~JsonWriter | ( |  | ) |

virtual

## Member Function Documentation

## begin_array()

void gx_system::JsonWriter::begin_array | ( | bool | nl = false | ) |

## begin_object()

void gx_system::JsonWriter::begin_object | ( | bool | nl = false | ) |

## close()

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

virtual

Reimplemented in gx_system::PresetTransformer.

## end_array()

void gx_system::JsonWriter::end_array | ( | bool | nl = false | ) |

## end_object()

void gx_system::JsonWriter::end_object | ( | bool | nl = false | ) |

## flush()

void gx_system::JsonWriter::flush | ( |  | ) |

## good()

bool gx_system::JsonWriter::good | ( |  | ) |

inline

Definition at line 71 of file gx_json.h.

## iminus()

void gx_system::JsonWriter::iminus | ( |  | ) |

private

## iplus()

void gx_system::JsonWriter::iplus | ( |  | ) |

private

## is_closed()

bool gx_system::JsonWriter::is_closed | ( |  | ) |

inline

Definition at line 74 of file gx_json.h.

## komma()

void gx_system::JsonWriter::komma | ( |  | ) |

private

## newline()

void gx_system::JsonWriter::newline | ( |  | ) |

inline

Definition at line 95 of file gx_json.h.

## reset()

void gx_system::JsonWriter::reset | ( |  | ) |

## set_stream()

void gx_system::JsonWriter::set_stream | ( | ostream * | o | ) |

inline

Definition at line 70 of file gx_json.h.

Referenced by gx_system::JsonStringWriter::JsonStringWriter().

## snl()

void gx_system::JsonWriter::snl | ( | bool | v | ) |

inline private

Definition at line 61 of file gx_json.h.

Referenced by newline().

## space()

void gx_system::JsonWriter::space | ( |  | ) |

private

## write() [1/6]

void gx_system::JsonWriter::write | ( | const char * | p,
|  | bool | nl = false )

## write() [2/6]

void gx_system::JsonWriter::write | ( | const string & | s,
|  | bool | nl = false )

inline

Definition at line 80 of file gx_json.h.

Referenced by write().

## write() [3/6]

void gx_system::JsonWriter::write | ( | double | v,
|  | bool | nl = false )

## write() [4/6]

void gx_system::JsonWriter::write | ( | float | v,
|  | bool | nl = false )

Referenced by write_kv(), write_kv(), write_kv(), write_kv(), write_kv(), and write_kv().

## write() [5/6]

void gx_system::JsonWriter::write | ( | int | i,
|  | bool | nl = false )

## write() [6/6]

void gx_system::JsonWriter::write | ( | unsigned int | i,
|  | bool | nl = false )

## write_key() [1/2]

void gx_system::JsonWriter::write_key | ( | const char * | p,
|  | bool | nl = false )

Referenced by write_kv(), write_kv(), write_kv(), write_kv(), write_kv(), and write_kv().

## write_key() [2/2]

void gx_system::JsonWriter::write_key | ( | const string & | p,
|  | bool | nl = false )

## write_kv() [1/6]

void gx_system::JsonWriter::write_kv | ( | const char * | key,
|  | const char * | p )

inline

Definition at line 85 of file gx_json.h.

## write_kv() [2/6]

void gx_system::JsonWriter::write_kv | ( | const char * | key,
|  | const std::string & | s )

inline

Definition at line 86 of file gx_json.h.

## write_kv() [3/6]

void gx_system::JsonWriter::write_kv | ( | const char * | key,
|  | double | v )

inline

Definition at line 82 of file gx_json.h.

## write_kv() [4/6]

void gx_system::JsonWriter::write_kv | ( | const char * | key,
|  | float | v )

inline

Definition at line 81 of file gx_json.h.

## write_kv() [5/6]

void gx_system::JsonWriter::write_kv | ( | const char * | key,
|  | int | i )

inline

Definition at line 83 of file gx_json.h.

## write_kv() [6/6]

void gx_system::JsonWriter::write_kv | ( | const char * | key,
|  | unsigned int | i )

inline

Definition at line 84 of file gx_json.h.

## write_lit()

void gx_system::JsonWriter::write_lit | ( | const string & | s,
|  | bool | nl = false )

Referenced by write_null().

## write_null()

void gx_system::JsonWriter::write_null | ( | bool | nl = false | ) |

inline

Definition at line 94 of file gx_json.h.

## Member Data Documentation

## deferred_nl

int gx_system::JsonWriter::deferred_nl

private

Definition at line 59 of file gx_json.h.

Referenced by snl().

## first

bool gx_system::JsonWriter::first

private

Definition at line 58 of file gx_json.h.

## indent

string gx_system::JsonWriter::indent

private

Definition at line 60 of file gx_json.h.

## os

ostream* gx_system::JsonWriter::os

private

Definition at line 57 of file gx_json.h.

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

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

- src/headers/gx_json.h