Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Writer< OutputStream, SourceEncoding, TargetEncoding, Allocator > Class Template Reference

JSON writer. More...

`#include <writer.h>`

Inheritance diagram for Writer< OutputStream, SourceEncoding, TargetEncoding, Allocator >:

## Classes
struct | Level
| Information for each nested level. More...

## Public Types
typedef SourceEncoding::Ch | Ch

## Public Member Functions
| Writer (OutputStream &os, Allocator *allocator=0, size_t levelDepth=kDefaultLevelDepth)
Writer & | String (const Ch *str)
| Simpler but slower overload. More...
Writer & | Null ()
Writer & | Bool (bool b)
Writer & | Int (int i)
Writer & | Uint (unsigned u)
Writer & | Int64 (int64_t i64)
Writer & | Uint64 (uint64_t u64)
Writer & | Double (double d)
Writer & | String (const Ch *str, SizeType length, bool copy=false)
Writer & | StartObject ()
Writer & | EndObject (SizeType memberCount=0)
Writer & | StartArray ()
Writer & | EndArray (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
OutputStream & | os_
internal::Stack< Allocator > | level_stack_

## Static Protected Attributes
static const size_t | kDefaultLevelDepth = 32

## Detailed Description

### template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename Allocator = MemoryPoolAllocator<>>
class rapidjson::Writer< OutputStream, SourceEncoding, TargetEncoding, Allocator >

JSON writer.

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

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

  OutputStream | Type of output stream.
  SourceEncoding | Encoding of both source strings.
  TargetEncoding | Encoding of and output stream.

## Member Typedef Documentation

typedef SourceEncoding::Ch Ch

## Constructor & Destructor Documentation

Writer | ( | OutputStream & | os,
|  | Allocator * | allocator = `0`,
|  | size_t | levelDepth = `kDefaultLevelDepth`
| ) |  |
| inline

## Member Function Documentation

Writer& Bool | ( | bool | b | ) |
| inline

Writer& Double | ( | double | d | ) |
| inline

Writer& EndArray | ( | SizeType | elementCount = `0` | ) |
| inline

Writer& EndObject | ( | SizeType | memberCount = `0` | ) |
| inline

Writer& Int | ( | int | i | ) |
| inline

Writer& Int64 | ( | int64_t | i64 | ) |
| inline

Writer& Null | ( |  | ) |
| inline

void Prefix | ( | Type | type | ) |
| inline protected

Writer& StartArray | ( |  | ) |
| inline

Writer& StartObject | ( |  | ) |
| inline

Writer& String | ( | const Ch * | str,
|  | SizeType | length,
|  | bool | copy = `false`
| ) |  |
| inline

Writer& String | ( | const Ch * | str | ) |
| inline

Simpler but slower overload.

Writer& Uint | ( | unsigned | u | ) |
| inline

Writer& Uint64 | ( | uint64_t | u64 | ) |
| inline

void WriteBool | ( | bool | b | ) |
| inline protected

void WriteDouble | ( | double | d | ) |
| inline protected

Todo:
  Optimization with custom double-to-string converter.

void WriteEndArray | ( |  | ) |
| inline protected

void WriteEndObject | ( |  | ) |
| inline protected

void WriteInt | ( | int | i | ) |
| inline protected

void WriteInt64 | ( | int64_t | i64 | ) |
| inline protected

void WriteNull | ( |  | ) |
| inline protected

void WriteStartArray | ( |  | ) |
| inline protected

void WriteStartObject | ( |  | ) |
| inline protected

void WriteString | ( | const Ch * | str,
|  | SizeType | length
| ) |  |
| inline protected

void WriteUint | ( | unsigned | u | ) |
| inline protected

void WriteUint64 | ( | uint64_t | u64 | ) |
| inline protected

## Member Data Documentation

const size_t kDefaultLevelDepth = 32
| static protected

internal::Stack<Allocator> level_stack_
| protected

OutputStream& os_
| protected

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

- persistence/rapidjson/include/rapidjson/writer.h