Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
JsonWriter Class Reference

#include <archiver.h>

Public Member Functions

 JsonWriter ()
 Constructor.
 
 ~JsonWriter ()
 Destructor.
 
const char * GetString () const
 Obtains the serialized JSON string.
 
 operator bool () const
 
JsonWriterStartObject ()
 
JsonWriterMember (const char *name)
 
bool HasMember (const char *name) const
 
JsonWriterEndObject ()
 
JsonWriterStartArray (size_t *size=0)
 
JsonWriterEndArray ()
 
JsonWriteroperator& (bool &b)
 
JsonWriteroperator& (unsigned &u)
 
JsonWriteroperator& (int &i)
 
JsonWriteroperator& (double &d)
 
JsonWriteroperator& (std::string &s)
 
JsonWriterSetNull ()
 

Static Public Attributes

static const bool IsReader = false
 
static const bool IsWriter = !IsReader
 

Detailed Description

Definition at line 103 of file archiver.h.

Constructor & Destructor Documentation

◆ JsonWriter()

JsonWriter::JsonWriter ( )

Definition at line 216 of file archiver.cpp.

216 : mWriter(), mStream() {
217 mStream = new StringBuffer;
218 mWriter = new PrettyWriter<StringBuffer>(*STREAM);
219}
#define STREAM
Definition archiver.cpp:214
Writer with indentation and spacing.
GenericStringBuffer< UTF8< char >, CrtAllocator > StringBuffer
Definition fwd.h:61

◆ ~JsonWriter()

JsonWriter::~JsonWriter ( )

Definition at line 221 of file archiver.cpp.

221 {
222 delete WRITER;
223 delete STREAM;
224}
#define WRITER
Definition archiver.cpp:213

Member Function Documentation

◆ EndArray()

JsonWriter & JsonWriter::EndArray ( )

Definition at line 256 of file archiver.cpp.

256 {
257 WRITER->EndArray();
258 return *this;
259}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EndObject()

JsonWriter & JsonWriter::EndObject ( )

Definition at line 235 of file archiver.cpp.

235 {
236 WRITER->EndObject();
237 return *this;
238}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetString()

const char * JsonWriter::GetString ( ) const

Definition at line 226 of file archiver.cpp.

226 {
227 return STREAM->GetString();
228}
Here is the caller graph for this function:

◆ HasMember()

bool JsonWriter::HasMember ( const char * name) const

Definition at line 245 of file archiver.cpp.

245 {
246 // This function is for JsonReader only.
247 assert(false);
248 return false;
249}

◆ Member()

JsonWriter & JsonWriter::Member ( const char * name)

Definition at line 240 of file archiver.cpp.

240 {
241 WRITER->String(name, static_cast<SizeType>(strlen(name)));
242 return *this;
243}
std::string name
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition rapidjson.h:384

◆ operator bool()

JsonWriter::operator bool ( ) const
inline

Definition at line 116 of file archiver.h.

116{ return true; }

◆ operator&() [1/5]

JsonWriter & JsonWriter::operator& ( bool & b)

Definition at line 261 of file archiver.cpp.

261 {
262 WRITER->Bool(b);
263 return *this;
264}

◆ operator&() [2/5]

JsonWriter & JsonWriter::operator& ( double & d)

Definition at line 276 of file archiver.cpp.

276 {
277 WRITER->Double(d);
278 return *this;
279}

◆ operator&() [3/5]

JsonWriter & JsonWriter::operator& ( int & i)

Definition at line 271 of file archiver.cpp.

271 {
272 WRITER->Int(i);
273 return *this;
274}

◆ operator&() [4/5]

JsonWriter & JsonWriter::operator& ( std::string & s)

Definition at line 281 of file archiver.cpp.

281 {
282 WRITER->String(s.c_str(), static_cast<SizeType>(s.size()));
283 return *this;
284}
char * s

◆ operator&() [5/5]

JsonWriter & JsonWriter::operator& ( unsigned & u)

Definition at line 266 of file archiver.cpp.

266 {
267 WRITER->Uint(u);
268 return *this;
269}

◆ SetNull()

JsonWriter & JsonWriter::SetNull ( )

Definition at line 286 of file archiver.cpp.

286 {
287 WRITER->Null();
288 return *this;
289}

◆ StartArray()

JsonWriter & JsonWriter::StartArray ( size_t * size = 0)

Definition at line 251 of file archiver.cpp.

251 {
252 WRITER->StartArray();
253 return *this;
254}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartObject()

JsonWriter & JsonWriter::StartObject ( )

Definition at line 230 of file archiver.cpp.

230 {
231 WRITER->StartObject();
232 return *this;
233}
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ IsReader

const bool JsonWriter::IsReader = false
static

Definition at line 133 of file archiver.h.

◆ IsWriter

const bool JsonWriter::IsWriter = !IsReader
static

Definition at line 134 of file archiver.h.


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