rapidjson
A fast JSON parser/generator for C++ with both SAX/DOM style API
 All Classes Functions Variables Typedefs Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
rapidjson::Writer< Stream, Encoding, Allocator > Class Template Reference

JSON writer. More...

#include <writer.h>

Inheritance diagram for rapidjson::Writer< Stream, Encoding, Allocator >:
rapidjson::Handler rapidjson::PrettyWriter< Stream, Encoding, Allocator >

Classes

struct  Level
 Information for each nested level. More...

Public Types

typedef Encoding::Ch Ch

Public Member Functions

 Writer (Stream &stream, Allocator *allocator=0, size_t levelDepth=kDefaultLevelDepth)
WriterString (const Ch *str)
 Simpler but slower overload.
WriterNull ()
WriterBool (bool b)
WriterInt (int i)
WriterUint (unsigned u)
WriterInt64 (int64_t i64)
WriterUint64 (uint64_t u64)
WriterDouble (double d)
WriterString (const Ch *str, SizeType length, bool copy=false)
WriterStartObject ()
WriterEndObject (SizeType memberCount=0)
WriterStartArray ()
WriterEndArray (SizeType elementCount=0)

Protected Member Functions

void WriteNull ()
void WriteBool (bool b)
void WriteInt (int i)
void WriteUint (unsigned u)
void WriteInt64 (int64_t i64)
void WriteUint64 (uint64_t u64)
void WriteDouble (double d)
void WriteString (const Ch *str, SizeType length)
void WriteStartObject ()
void WriteEndObject ()
void WriteStartArray ()
void WriteEndArray ()
void Prefix (Type type)

Protected Attributes

Streamstream_
internal::Stack< Allocatorlevel_stack_

Static Protected Attributes

static const size_t kDefaultLevelDepth = 32

Detailed Description

template<typename Stream, typename Encoding = UTF8<>, typename Allocator = MemoryPoolAllocator<>>
class rapidjson::Writer< Stream, Encoding, Allocator >

JSON writer.

Writer implements the concept Handler. It generates JSON text by events to an output stream.

User may programmatically calls the functions of a writer to generate JSON text.

On the other side, a writer can also be passed to objects that generates events,

for example Reader::Parse() and Document::Accept().

Template Parameters
StreamType of ouptut stream.
EncodingEncoding of both source strings and output.

Member Function Documentation

template<typename Stream , typename Encoding = UTF8<>, typename Allocator = MemoryPoolAllocator<>>
void rapidjson::Writer< Stream, Encoding, Allocator >::WriteDouble ( double  d)
inlineprotected
Todo:
Optimization with custom double-to-string converter.

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