42template<typename OutputStream, typename SourceEncoding = UTF8<>, typename TargetEncoding = UTF8<>, typename StackAllocator = CrtAllocator, unsigned writeFlags = kWriteDefaultFlags>
43class PrettyWriter : public Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags> {
53 explicit PrettyWriter(OutputStream& os, StackAllocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
54 Base(os, allocator, levelDepth), indentChar_(' '), indentCharCount_(4), formatOptions_(kFormatDefault) {}
57 explicit PrettyWriter(StackAllocator* allocator = 0, size_t levelDepth = Base::kDefaultLevelDepth) :
61 /*! \param indentChar Character for indentation. Must be whitespace character (' ', '\\t', '\\n', '\\r').
66 RAPIDJSON_ASSERT(indentChar == ' ' || indentChar == '\t' || indentChar == '\n' || indentChar == '\r');
117 bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); }
182 \param json A well-formed JSON value. It should not contain null character within [0, length - 1] range.
187 bool RawValue(const Ch* json, size_t length, Type type) { PrettyPrefix(type); return Base::WriteRawValue(json, length); }
bool RawValue(const Ch *json, size_t length, Type type)
Write a raw JSON value.
Definition prettywriter.h:187
bool String(const Ch *str)
Simpler but slower overload.
Definition prettywriter.h:173
PrettyWriter & SetFormatOptions(PrettyFormatOptions options)
Set pretty writer formatting options.
Definition prettywriter.h:75
PrettyWriter & SetIndent(Ch indentChar, unsigned indentCharCount)
Set custom indentation.
Definition prettywriter.h:65
PrettyWriter(OutputStream &os, StackAllocator *allocator=0, size_t levelDepth=Base::kDefaultLevelDepth)
Constructor.
Definition prettywriter.h:53
Writer(OutputStream &os, CrtAllocator *stackAllocator=0, size_t levelDepth=kDefaultLevelDepth)
Definition writer.h:99
PrettyFormatOptions
Combination of PrettyWriter format flags.
Definition prettywriter.h:30
@ kFormatSingleLineArray
Format arrays on a single line.
Definition prettywriter.h:32
void PutN(FileWriteStream &stream, char c, size_t n)
Implement specialized version of PutN() with memset() for better performance.
Definition filewritestream.h:94
unsigned SizeType
Size type (for string lengths, array sizes, etc.).
Definition rapidjson.h:380