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

JSON writer. More...

#include <fwd.h>

Inheritance diagram for Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >:
PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >

Classes

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

Public Types

typedef SourceEncoding::Ch Ch
 

Public Member Functions

 Writer (OutputStream &os, StackAllocator *stackAllocator=0, size_t levelDepth=kDefaultLevelDepth)
 Constructor. More...
 
 Writer (StackAllocator *allocator=0, size_t levelDepth=kDefaultLevelDepth)
 
void Reset (OutputStream &os)
 Reset the writer with a new stream. More...
 
bool IsComplete () const
 Checks whether the output is a complete JSON. More...
 
int GetMaxDecimalPlaces () const
 
void SetMaxDecimalPlaces (int maxDecimalPlaces)
 Sets the maximum number of decimal places for double output. More...
 
bool RawValue (const Ch *json, size_t length, Type type)
 Write a raw JSON value. More...
 
void Flush ()
 Flush the output stream. More...
 
Implementation of Handler
See also
Handler
bool Null ()
 
bool Bool (bool b)
 
bool Int (int i)
 
bool Uint (unsigned u)
 
bool Int64 (int64_t i64)
 
bool Uint64 (uint64_t u64)
 
bool Double (double d)
 Writes the given double value to the stream. More...
 
bool RawNumber (const Ch *str, SizeType length, bool copy=false)
 
bool String (const Ch *str, SizeType length, bool copy=false)
 
bool StartObject ()
 
bool Key (const Ch *str, SizeType length, bool copy=false)
 
bool EndObject (SizeType memberCount=0)
 
bool StartArray ()
 
bool EndArray (SizeType elementCount=0)
 
Convenience extensions
bool String (const Ch *const &str)
 Simpler but slower overload. More...
 
bool Key (const Ch *const &str)
 

Static Public Attributes

static const int kDefaultMaxDecimalPlaces = 324
 

Protected Member Functions

bool WriteNull ()
 
bool WriteBool (bool b)
 
bool WriteInt (int i)
 
bool WriteUint (unsigned u)
 
bool WriteInt64 (int64_t i64)
 
bool WriteUint64 (uint64_t u64)
 
bool WriteDouble (double d)
 
bool WriteString (const Ch *str, SizeType length)
 
bool ScanWriteUnescapedString (GenericStringStream< SourceEncoding > &is, size_t length)
 
bool WriteStartObject ()
 
bool WriteEndObject ()
 
bool WriteStartArray ()
 
bool WriteEndArray ()
 
bool WriteRawValue (const Ch *json, size_t length)
 
void Prefix (Type type)
 
bool EndValue (bool ret)
 
template<>
bool WriteInt (int i)
 
template<>
bool WriteUint (unsigned u)
 
template<>
bool WriteInt64 (int64_t i64)
 
template<>
bool WriteUint64 (uint64_t u)
 
template<>
bool WriteDouble (double d)
 

Protected Attributes

OutputStream * os_
 
internal::Stack< StackAllocator > level_stack_
 
int maxDecimalPlaces_
 
bool hasRoot_
 

Static Protected Attributes

static const size_t kDefaultLevelDepth = 32
 

Private Member Functions

 Writer (const Writer &)
 
Writeroperator= (const Writer &)
 

Detailed Description

template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
class Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >

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
OutputStreamType of output stream.
SourceEncodingEncoding of source string.
TargetEncodingEncoding of output stream.
StackAllocatorType of allocator for allocating memory of stack.
Note
implements Handler concept

Definition at line 95 of file fwd.h.

Member Typedef Documentation

template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
typedef SourceEncoding::Ch Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Ch

Definition at line 91 of file writer.h.

Constructor & Destructor Documentation

template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Writer ( OutputStream &  os,
StackAllocator *  stackAllocator = 0,
size_t  levelDepth = kDefaultLevelDepth 
)
inlineexplicit

Constructor.

Parameters
osOutput stream.
stackAllocatorUser supplied allocator. If it is null, it will create a private one.
levelDepthInitial capacity of stack.

Definition at line 101 of file writer.h.

101  :
102  os_(&os), level_stack_(stackAllocator, levelDepth * sizeof(Level)), maxDecimalPlaces_(kDefaultMaxDecimalPlaces), hasRoot_(false) {}
Level
Definition: Level.h:13
bool hasRoot_
Definition: writer.h:503
OutputStream * os_
Definition: writer.h:500
int maxDecimalPlaces_
Definition: writer.h:502
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
static const int kDefaultMaxDecimalPlaces
Definition: writer.h:93
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Writer ( StackAllocator *  allocator = 0,
size_t  levelDepth = kDefaultLevelDepth 
)
inlineexplicit

Definition at line 105 of file writer.h.

105  :
106  os_(0), level_stack_(allocator, levelDepth * sizeof(Level)), maxDecimalPlaces_(kDefaultMaxDecimalPlaces), hasRoot_(false) {}
Level
Definition: Level.h:13
bool hasRoot_
Definition: writer.h:503
OutputStream * os_
Definition: writer.h:500
int maxDecimalPlaces_
Definition: writer.h:502
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
static const int kDefaultMaxDecimalPlaces
Definition: writer.h:93
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Writer ( const Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags > &  )
private

Member Function Documentation

template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Bool ( bool  b)
inline

Definition at line 182 of file writer.h.

182 { Prefix(b ? kTrueType : kFalseType); return EndValue(WriteBool(b)); }
bool EndValue(bool ret)
Definition: writer.h:494
false
Definition: rapidjson.h:620
void Prefix(Type type)
Definition: writer.h:473
static bool * b
Definition: config.cpp:1043
true
Definition: rapidjson.h:621
bool WriteBool(bool b)
Definition: writer.h:300
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Double ( double  d)
inline

Writes the given double value to the stream.

Parameters
dThe value to be written.
Returns
Whether it is succeed.

Definition at line 193 of file writer.h.

193 { Prefix(kNumberType); return EndValue(WriteDouble(d)); }
bool EndValue(bool ret)
Definition: writer.h:494
number
Definition: rapidjson.h:625
void Prefix(Type type)
Definition: writer.h:473
bool WriteDouble(double d)
Definition: writer.h:348
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::EndArray ( SizeType  elementCount = 0)
inline

Definition at line 245 of file writer.h.

245  {
246  (void)elementCount;
248  RAPIDJSON_ASSERT(level_stack_.template Top<Level>()->inArray);
249  level_stack_.template Pop<Level>(1);
250  return EndValue(WriteEndArray());
251  }
bool EndValue(bool ret)
Definition: writer.h:494
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Level
Definition: Level.h:13
size_t GetSize() const
Definition: stack.h:177
bool WriteEndArray()
Definition: writer.h:457
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::EndObject ( SizeType  memberCount = 0)
inline

Definition at line 230 of file writer.h.

230  {
231  (void)memberCount;
232  RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level)); // not inside an Object
233  RAPIDJSON_ASSERT(!level_stack_.template Top<Level>()->inArray); // currently inside an Array, not Object
234  RAPIDJSON_ASSERT(0 == level_stack_.template Top<Level>()->valueCount % 2); // Object has a Key without a Value
235  level_stack_.template Pop<Level>(1);
236  return EndValue(WriteEndObject());
237  }
bool EndValue(bool ret)
Definition: writer.h:494
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Level
Definition: Level.h:13
size_t GetSize() const
Definition: stack.h:177
bool WriteEndObject()
Definition: writer.h:455
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::EndValue ( bool  ret)
inlineprotected

Definition at line 494 of file writer.h.

494  {
495  if (RAPIDJSON_UNLIKELY(level_stack_.Empty())) // end of json text
496  Flush();
497  return ret;
498  }
void Flush()
Flush the output stream.
Definition: writer.h:281
bool Empty() const
Definition: stack.h:176
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
#define RAPIDJSON_UNLIKELY(x)
Compiler branching hint for expression with low probability to be true.
Definition: rapidjson.h:476
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
void Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Flush ( )
inline

Flush the output stream.

Allows the user to flush the output stream immediately.

Definition at line 281 of file writer.h.

281  {
282  os_->Flush();
283  }
OutputStream * os_
Definition: writer.h:500
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
int Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::GetMaxDecimalPlaces ( ) const
inline

Definition at line 147 of file writer.h.

147  {
148  return maxDecimalPlaces_;
149  }
int maxDecimalPlaces_
Definition: writer.h:502
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Int ( int  i)
inline

Definition at line 183 of file writer.h.

183 { Prefix(kNumberType); return EndValue(WriteInt(i)); }
bool EndValue(bool ret)
Definition: writer.h:494
number
Definition: rapidjson.h:625
void Prefix(Type type)
Definition: writer.h:473
bool WriteInt(int i)
Definition: writer.h:312
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Int64 ( int64_t  i64)
inline

Definition at line 185 of file writer.h.

185 { Prefix(kNumberType); return EndValue(WriteInt64(i64)); }
bool EndValue(bool ret)
Definition: writer.h:494
bool WriteInt64(int64_t i64)
Definition: writer.h:330
number
Definition: rapidjson.h:625
void Prefix(Type type)
Definition: writer.h:473
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::IsComplete ( ) const
inline

Checks whether the output is a complete JSON.

A complete JSON has a complete root object or array.

Definition at line 143 of file writer.h.

143  {
144  return hasRoot_ && level_stack_.Empty();
145  }
bool hasRoot_
Definition: writer.h:503
bool Empty() const
Definition: stack.h:176
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Key ( const Ch str,
SizeType  length,
bool  copy = false 
)
inline

Definition at line 221 of file writer.h.

221 { return String(str, length, copy); }
bool String(const Ch *str, SizeType length, bool copy=false)
Definition: writer.h:202
T copy(T const &v)
static QCString str
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Key ( const Ch *const &  str)
inline

Definition at line 259 of file writer.h.

259 { return Key(str, internal::StrLen(str)); }
bool Key(const Ch *str, SizeType length, bool copy=false)
Definition: writer.h:221
SizeType StrLen(const Ch *s)
Custom strlen() which works on different character types.
Definition: strfunc.h:31
static QCString str
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Null ( )
inline

Definition at line 181 of file writer.h.

181 { Prefix(kNullType); return EndValue(WriteNull()); }
bool EndValue(bool ret)
Definition: writer.h:494
bool WriteNull()
Definition: writer.h:295
void Prefix(Type type)
Definition: writer.h:473
null
Definition: rapidjson.h:619
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
Writer& Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::operator= ( const Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags > &  )
private
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
void Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Prefix ( Type  type)
inlineprotected

Definition at line 473 of file writer.h.

473  {
474  (void)type;
475  if (RAPIDJSON_LIKELY(level_stack_.GetSize() != 0)) { // this value is not at root
476  Level* level = level_stack_.template Top<Level>();
477  if (level->valueCount > 0) {
478  if (level->inArray)
479  os_->Put(','); // add comma if it is not the first element in array
480  else // in object
481  os_->Put((level->valueCount % 2 == 0) ? ',' : ':');
482  }
483  if (!level->inArray && level->valueCount % 2 == 0)
484  RAPIDJSON_ASSERT(type == kStringType); // if it's in object, then even number should be a name
485  level->valueCount++;
486  }
487  else {
488  RAPIDJSON_ASSERT(!hasRoot_); // Should only has one and only one root.
489  hasRoot_ = true;
490  }
491  }
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Level
Definition: Level.h:13
bool hasRoot_
Definition: writer.h:503
OutputStream * os_
Definition: writer.h:500
string
Definition: rapidjson.h:624
size_t GetSize() const
Definition: stack.h:177
#define RAPIDJSON_LIKELY(x)
Compiler branching hint for expression with high probability to be true.
Definition: rapidjson.h:463
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::RawNumber ( const Ch str,
SizeType  length,
bool  copy = false 
)
inline

Definition at line 195 of file writer.h.

195  {
196  RAPIDJSON_ASSERT(str != 0);
197  (void)copy;
199  return EndValue(WriteString(str, length));
200  }
bool EndValue(bool ret)
Definition: writer.h:494
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
number
Definition: rapidjson.h:625
void Prefix(Type type)
Definition: writer.h:473
bool WriteString(const Ch *str, SizeType length)
Definition: writer.h:376
T copy(T const &v)
static QCString str
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::RawValue ( const Ch json,
size_t  length,
Type  type 
)
inline

Write a raw JSON value.

For user to write a stringified JSON as a value.

Parameters
jsonA well-formed JSON value. It should not contain null character within [0, length - 1] range.
lengthLength of the json.
typeType of the root of json.

Definition at line 271 of file writer.h.

271  {
272  RAPIDJSON_ASSERT(json != 0);
273  Prefix(type);
274  return EndValue(WriteRawValue(json, length));
275  }
bool EndValue(bool ret)
Definition: writer.h:494
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
bool WriteRawValue(const Ch *json, size_t length)
Definition: writer.h:459
void Prefix(Type type)
Definition: writer.h:473
template<typename OutputStream , typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
void Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Reset ( OutputStream &  os)
inline

Reset the writer with a new stream.

This function reset the writer with a new stream and default settings, in order to make a Writer object reusable for output multiple JSONs.

Parameters
osNew output stream.
writer.StartObject();
// ...
writer.EndObject();
writer.Reset(os2);
writer.StartObject();
// ...
writer.EndObject();

Definition at line 133 of file writer.h.

133  {
134  os_ = &os;
135  hasRoot_ = false;
137  }
bool hasRoot_
Definition: writer.h:503
void Clear()
Definition: stack.h:98
OutputStream * os_
Definition: writer.h:500
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::ScanWriteUnescapedString ( GenericStringStream< SourceEncoding > &  is,
size_t  length 
)
inlineprotected

Definition at line 450 of file writer.h.

450  {
451  return RAPIDJSON_LIKELY(is.Tell() < length);
452  }
#define RAPIDJSON_LIKELY(x)
Compiler branching hint for expression with high probability to be true.
Definition: rapidjson.h:463
size_t Tell() const
Definition: stream.h:161
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
void Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::SetMaxDecimalPlaces ( int  maxDecimalPlaces)
inline

Sets the maximum number of decimal places for double output.

This setting truncates the output with specified number of decimal places.

For example,

writer.SetMaxDecimalPlaces(3);
writer.StartArray();
writer.Double(0.12345); // "0.123"
writer.Double(0.0001); // "0.0"
writer.Double(1.234567890123456e30); // "1.234567890123456e30" (do not truncate significand for positive exponent)
writer.Double(1.23e-4); // "0.0" (do truncate significand for negative exponent)
writer.EndArray();

The default setting does not truncate any decimal places. You can restore to this setting by calling

writer.SetMaxDecimalPlaces(Writer::kDefaultMaxDecimalPlaces);

Definition at line 172 of file writer.h.

172  {
173  maxDecimalPlaces_ = maxDecimalPlaces;
174  }
int maxDecimalPlaces_
Definition: writer.h:502
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::StartArray ( )
inline

Definition at line 239 of file writer.h.

239  {
241  new (level_stack_.template Push<Level>()) Level(true);
242  return WriteStartArray();
243  }
array
Definition: rapidjson.h:623
Level
Definition: Level.h:13
void Prefix(Type type)
Definition: writer.h:473
bool WriteStartArray()
Definition: writer.h:456
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::StartObject ( )
inline

Definition at line 215 of file writer.h.

215  {
217  new (level_stack_.template Push<Level>()) Level(false);
218  return WriteStartObject();
219  }
object
Definition: rapidjson.h:622
Level
Definition: Level.h:13
bool WriteStartObject()
Definition: writer.h:454
void Prefix(Type type)
Definition: writer.h:473
internal::Stack< StackAllocator > level_stack_
Definition: writer.h:501
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::String ( const Ch str,
SizeType  length,
bool  copy = false 
)
inline

Definition at line 202 of file writer.h.

202  {
203  RAPIDJSON_ASSERT(str != 0);
204  (void)copy;
206  return EndValue(WriteString(str, length));
207  }
bool EndValue(bool ret)
Definition: writer.h:494
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
string
Definition: rapidjson.h:624
void Prefix(Type type)
Definition: writer.h:473
bool WriteString(const Ch *str, SizeType length)
Definition: writer.h:376
T copy(T const &v)
static QCString str
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::String ( const Ch *const &  str)
inline

Simpler but slower overload.

Definition at line 258 of file writer.h.

258 { return String(str, internal::StrLen(str)); }
bool String(const Ch *str, SizeType length, bool copy=false)
Definition: writer.h:202
SizeType StrLen(const Ch *s)
Custom strlen() which works on different character types.
Definition: strfunc.h:31
static QCString str
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Uint ( unsigned  u)
inline

Definition at line 184 of file writer.h.

184 { Prefix(kNumberType); return EndValue(WriteUint(u)); }
bool EndValue(bool ret)
Definition: writer.h:494
bool WriteUint(unsigned u)
Definition: writer.h:321
number
Definition: rapidjson.h:625
void Prefix(Type type)
Definition: writer.h:473
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::Uint64 ( uint64_t  u64)
inline

Definition at line 186 of file writer.h.

186 { Prefix(kNumberType); return EndValue(WriteUint64(u64)); }
bool EndValue(bool ret)
Definition: writer.h:494
bool WriteUint64(uint64_t u64)
Definition: writer.h:339
number
Definition: rapidjson.h:625
void Prefix(Type type)
Definition: writer.h:473
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteBool ( bool  b)
inlineprotected

Definition at line 300 of file writer.h.

300  {
301  if (b) {
302  PutReserve(*os_, 4);
303  PutUnsafe(*os_, 't'); PutUnsafe(*os_, 'r'); PutUnsafe(*os_, 'u'); PutUnsafe(*os_, 'e');
304  }
305  else {
306  PutReserve(*os_, 5);
307  PutUnsafe(*os_, 'f'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'l'); PutUnsafe(*os_, 's'); PutUnsafe(*os_, 'e');
308  }
309  return true;
310  }
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
static bool * b
Definition: config.cpp:1043
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteDouble ( double  d)
inlineprotected

Definition at line 348 of file writer.h.

348  {
349  if (internal::Double(d).IsNanOrInf()) {
350  if (!(writeFlags & kWriteNanAndInfFlag))
351  return false;
352  if (internal::Double(d).IsNan()) {
353  PutReserve(*os_, 3);
354  PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
355  return true;
356  }
357  if (internal::Double(d).Sign()) {
358  PutReserve(*os_, 9);
359  PutUnsafe(*os_, '-');
360  }
361  else
362  PutReserve(*os_, 8);
363  PutUnsafe(*os_, 'I'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'f');
364  PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 't'); PutUnsafe(*os_, 'y');
365  return true;
366  }
367 
368  char buffer[25];
369  char* end = internal::dtoa(d, buffer, maxDecimalPlaces_);
370  PutReserve(*os_, static_cast<size_t>(end - buffer));
371  for (char* p = buffer; p != end; ++p)
372  PutUnsafe(*os_, static_cast<typename OutputStream::Ch>(*p));
373  return true;
374  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
p
Definition: test.py:223
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
int maxDecimalPlaces_
Definition: writer.h:502
Allow writing of Infinity, -Infinity and NaN.
Definition: writer.h:68
char * dtoa(double value, char *buffer, int maxDecimalPlaces=324)
Definition: dtoa.h:216
template<>
bool Writer< StringBuffer >::WriteDouble ( double  d)
inlineprotected

Definition at line 546 of file writer.h.

546  {
547  if (internal::Double(d).IsNanOrInf()) {
548  // Note: This code path can only be reached if (RAPIDJSON_WRITE_DEFAULT_FLAGS & kWriteNanAndInfFlag).
550  return false;
551  if (internal::Double(d).IsNan()) {
552  PutReserve(*os_, 3);
553  PutUnsafe(*os_, 'N'); PutUnsafe(*os_, 'a'); PutUnsafe(*os_, 'N');
554  return true;
555  }
556  if (internal::Double(d).Sign()) {
557  PutReserve(*os_, 9);
558  PutUnsafe(*os_, '-');
559  }
560  else
561  PutReserve(*os_, 8);
562  PutUnsafe(*os_, 'I'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'f');
563  PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'i'); PutUnsafe(*os_, 't'); PutUnsafe(*os_, 'y');
564  return true;
565  }
566 
567  char *buffer = os_->Push(25);
568  char* end = internal::dtoa(d, buffer, maxDecimalPlaces_);
569  os_->Pop(static_cast<size_t>(25 - (end - buffer)));
570  return true;
571 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Default write flags. Can be customized by defining RAPIDJSON_WRITE_DEFAULT_FLAGS. ...
Definition: writer.h:69
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
int maxDecimalPlaces_
Definition: writer.h:502
Allow writing of Infinity, -Infinity and NaN.
Definition: writer.h:68
char * dtoa(double value, char *buffer, int maxDecimalPlaces=324)
Definition: dtoa.h:216
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteEndArray ( )
inlineprotected

Definition at line 457 of file writer.h.

457 { os_->Put(']'); return true; }
OutputStream * os_
Definition: writer.h:500
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteEndObject ( )
inlineprotected

Definition at line 455 of file writer.h.

455 { os_->Put('}'); return true; }
OutputStream * os_
Definition: writer.h:500
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteInt ( int  i)
inlineprotected

Definition at line 312 of file writer.h.

312  {
313  char buffer[11];
314  const char* end = internal::i32toa(i, buffer);
315  PutReserve(*os_, static_cast<size_t>(end - buffer));
316  for (const char* p = buffer; p != end; ++p)
317  PutUnsafe(*os_, static_cast<typename OutputStream::Ch>(*p));
318  return true;
319  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
p
Definition: test.py:223
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
char * i32toa(int32_t value, char *buffer)
Definition: itoa.h:115
template<>
bool Writer< StringBuffer >::WriteInt ( int  i)
inlineprotected

Definition at line 514 of file writer.h.

514  {
515  char *buffer = os_->Push(11);
516  const char* end = internal::i32toa(i, buffer);
517  os_->Pop(static_cast<size_t>(11 - (end - buffer)));
518  return true;
519 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
OutputStream * os_
Definition: writer.h:500
char * i32toa(int32_t value, char *buffer)
Definition: itoa.h:115
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteInt64 ( int64_t  i64)
inlineprotected

Definition at line 330 of file writer.h.

330  {
331  char buffer[21];
332  const char* end = internal::i64toa(i64, buffer);
333  PutReserve(*os_, static_cast<size_t>(end - buffer));
334  for (const char* p = buffer; p != end; ++p)
335  PutUnsafe(*os_, static_cast<typename OutputStream::Ch>(*p));
336  return true;
337  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
p
Definition: test.py:223
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
char * i64toa(int64_t value, char *buffer)
Definition: itoa.h:294
template<>
bool Writer< StringBuffer >::WriteInt64 ( int64_t  i64)
inlineprotected

Definition at line 530 of file writer.h.

530  {
531  char *buffer = os_->Push(21);
532  const char* end = internal::i64toa(i64, buffer);
533  os_->Pop(static_cast<size_t>(21 - (end - buffer)));
534  return true;
535 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
OutputStream * os_
Definition: writer.h:500
char * i64toa(int64_t value, char *buffer)
Definition: itoa.h:294
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteNull ( )
inlineprotected

Definition at line 295 of file writer.h.

295  {
296  PutReserve(*os_, 4);
297  PutUnsafe(*os_, 'n'); PutUnsafe(*os_, 'u'); PutUnsafe(*os_, 'l'); PutUnsafe(*os_, 'l'); return true;
298  }
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteRawValue ( const Ch json,
size_t  length 
)
inlineprotected

Definition at line 459 of file writer.h.

459  {
460  PutReserve(*os_, length);
462  while (RAPIDJSON_LIKELY(is.Tell() < length)) {
463  const Ch c = is.Peek();
464  RAPIDJSON_ASSERT(c != '\0');
465  if (RAPIDJSON_UNLIKELY(!(writeFlags & kWriteValidateEncodingFlag ?
468  return false;
469  }
470  return true;
471  }
Encoding conversion.
Definition: encodings.h:658
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Read-only string stream.
Definition: fwd.h:47
Validate encoding of JSON strings.
Definition: writer.h:67
OutputStream * os_
Definition: writer.h:500
SourceEncoding::Ch Ch
Definition: writer.h:91
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
#define RAPIDJSON_LIKELY(x)
Compiler branching hint for expression with high probability to be true.
Definition: rapidjson.h:463
#define RAPIDJSON_UNLIKELY(x)
Compiler branching hint for expression with low probability to be true.
Definition: rapidjson.h:476
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteStartArray ( )
inlineprotected

Definition at line 456 of file writer.h.

456 { os_->Put('['); return true; }
OutputStream * os_
Definition: writer.h:500
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteStartObject ( )
inlineprotected

Definition at line 454 of file writer.h.

454 { os_->Put('{'); return true; }
OutputStream * os_
Definition: writer.h:500
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteString ( const Ch str,
SizeType  length 
)
inlineprotected

Definition at line 376 of file writer.h.

376  {
377  static const typename OutputStream::Ch hexDigits[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
378  static const char escape[256] = {
379 #define Z16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
380  //0 1 2 3 4 5 6 7 8 9 A B C D E F
381  'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'b', 't', 'n', 'u', 'f', 'r', 'u', 'u', // 00
382  'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', // 10
383  0, 0, '"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20
384  Z16, Z16, // 30~4F
385  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,'\\', 0, 0, 0, // 50
386  Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16 // 60~FF
387 #undef Z16
388  };
389 
390  if (TargetEncoding::supportUnicode)
391  PutReserve(*os_, 2 + length * 6); // "\uxxxx..."
392  else
393  PutReserve(*os_, 2 + length * 12); // "\uxxxx\uyyyy..."
394 
395  PutUnsafe(*os_, '\"');
397  while (ScanWriteUnescapedString(is, length)) {
398  const Ch c = is.Peek();
399  if (!TargetEncoding::supportUnicode && static_cast<unsigned>(c) >= 0x80) {
400  // Unicode escaping
401  unsigned codepoint;
402  if (RAPIDJSON_UNLIKELY(!SourceEncoding::Decode(is, &codepoint)))
403  return false;
404  PutUnsafe(*os_, '\\');
405  PutUnsafe(*os_, 'u');
406  if (codepoint <= 0xD7FF || (codepoint >= 0xE000 && codepoint <= 0xFFFF)) {
407  PutUnsafe(*os_, hexDigits[(codepoint >> 12) & 15]);
408  PutUnsafe(*os_, hexDigits[(codepoint >> 8) & 15]);
409  PutUnsafe(*os_, hexDigits[(codepoint >> 4) & 15]);
410  PutUnsafe(*os_, hexDigits[(codepoint ) & 15]);
411  }
412  else {
413  RAPIDJSON_ASSERT(codepoint >= 0x010000 && codepoint <= 0x10FFFF);
414  // Surrogate pair
415  unsigned s = codepoint - 0x010000;
416  unsigned lead = (s >> 10) + 0xD800;
417  unsigned trail = (s & 0x3FF) + 0xDC00;
418  PutUnsafe(*os_, hexDigits[(lead >> 12) & 15]);
419  PutUnsafe(*os_, hexDigits[(lead >> 8) & 15]);
420  PutUnsafe(*os_, hexDigits[(lead >> 4) & 15]);
421  PutUnsafe(*os_, hexDigits[(lead ) & 15]);
422  PutUnsafe(*os_, '\\');
423  PutUnsafe(*os_, 'u');
424  PutUnsafe(*os_, hexDigits[(trail >> 12) & 15]);
425  PutUnsafe(*os_, hexDigits[(trail >> 8) & 15]);
426  PutUnsafe(*os_, hexDigits[(trail >> 4) & 15]);
427  PutUnsafe(*os_, hexDigits[(trail ) & 15]);
428  }
429  }
430  else if ((sizeof(Ch) == 1 || static_cast<unsigned>(c) < 256) && RAPIDJSON_UNLIKELY(escape[static_cast<unsigned char>(c)])) {
431  is.Take();
432  PutUnsafe(*os_, '\\');
433  PutUnsafe(*os_, static_cast<typename OutputStream::Ch>(escape[static_cast<unsigned char>(c)]));
434  if (escape[static_cast<unsigned char>(c)] == 'u') {
435  PutUnsafe(*os_, '0');
436  PutUnsafe(*os_, '0');
437  PutUnsafe(*os_, hexDigits[static_cast<unsigned char>(c) >> 4]);
438  PutUnsafe(*os_, hexDigits[static_cast<unsigned char>(c) & 0xF]);
439  }
440  }
441  else if (RAPIDJSON_UNLIKELY(!(writeFlags & kWriteValidateEncodingFlag ?
444  return false;
445  }
446  PutUnsafe(*os_, '\"');
447  return true;
448  }
Encoding conversion.
Definition: encodings.h:658
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition: rapidjson.h:406
Read-only string stream.
Definition: fwd.h:47
Validate encoding of JSON strings.
Definition: writer.h:67
bool ScanWriteUnescapedString(GenericStringStream< SourceEncoding > &is, size_t length)
Definition: writer.h:450
OutputStream * os_
Definition: writer.h:500
SourceEncoding::Ch Ch
Definition: writer.h:91
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
#define Z16
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
std::string escape(std::string const &str)
#define RAPIDJSON_UNLIKELY(x)
Compiler branching hint for expression with low probability to be true.
Definition: rapidjson.h:476
static QCString * s
Definition: config.cpp:1042
static QCString str
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteUint ( unsigned  u)
inlineprotected

Definition at line 321 of file writer.h.

321  {
322  char buffer[10];
323  const char* end = internal::u32toa(u, buffer);
324  PutReserve(*os_, static_cast<size_t>(end - buffer));
325  for (const char* p = buffer; p != end; ++p)
326  PutUnsafe(*os_, static_cast<typename OutputStream::Ch>(*p));
327  return true;
328  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
char * u32toa(uint32_t value, char *buffer)
Definition: itoa.h:39
p
Definition: test.py:223
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
template<>
bool Writer< StringBuffer >::WriteUint ( unsigned  u)
inlineprotected

Definition at line 522 of file writer.h.

522  {
523  char *buffer = os_->Push(10);
524  const char* end = internal::u32toa(u, buffer);
525  os_->Pop(static_cast<size_t>(10 - (end - buffer)));
526  return true;
527 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
OutputStream * os_
Definition: writer.h:500
char * u32toa(uint32_t value, char *buffer)
Definition: itoa.h:39
template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::WriteUint64 ( uint64_t  u64)
inlineprotected

Definition at line 339 of file writer.h.

339  {
340  char buffer[20];
341  char* end = internal::u64toa(u64, buffer);
342  PutReserve(*os_, static_cast<size_t>(end - buffer));
343  for (char* p = buffer; p != end; ++p)
344  PutUnsafe(*os_, static_cast<typename OutputStream::Ch>(*p));
345  return true;
346  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
char * u64toa(uint64_t value, char *buffer)
Definition: itoa.h:126
OutputStream * os_
Definition: writer.h:500
void PutReserve(Stream &stream, size_t count)
Reserve n characters for writing to a stream.
Definition: stream.h:84
p
Definition: test.py:223
void PutUnsafe(Stream &stream, typename Stream::Ch c)
Write character to a stream, presuming buffer is reserved.
Definition: stream.h:91
template<>
bool Writer< StringBuffer >::WriteUint64 ( uint64_t  u)
inlineprotected

Definition at line 538 of file writer.h.

538  {
539  char *buffer = os_->Push(20);
540  const char* end = internal::u64toa(u, buffer);
541  os_->Pop(static_cast<size_t>(20 - (end - buffer)));
542  return true;
543 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
char * u64toa(uint64_t value, char *buffer)
Definition: itoa.h:126
OutputStream * os_
Definition: writer.h:500

Member Data Documentation

template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
bool Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::hasRoot_
protected

Definition at line 503 of file writer.h.

template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
const size_t Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::kDefaultLevelDepth = 32
staticprotected

Definition at line 293 of file writer.h.

template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
const int Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::kDefaultMaxDecimalPlaces = 324
static

Definition at line 93 of file writer.h.

template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
internal::Stack<StackAllocator> Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::level_stack_
protected

Definition at line 501 of file writer.h.

template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
int Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::maxDecimalPlaces_
protected

Definition at line 502 of file writer.h.

template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
OutputStream* Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags >::os_
protected

Definition at line 500 of file writer.h.


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