15 #ifndef RAPIDJSON_PRETTYWRITER_H_ 16 #define RAPIDJSON_PRETTYWRITER_H_ 22 RAPIDJSON_DIAG_OFF(effc++)
25 #if defined(__clang__) 27 RAPIDJSON_DIAG_OFF(
c++98-compat)
47 template<
typename OutputStream,
typename SourceEncoding = UTF8<>,
typename TargetEncoding = UTF8<>,
typename StackAllocator = CrtAllocator,
unsigned writeFlags = kWriteDefaultFlags>
48 class PrettyWriter :
public Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags> {
65 #if RAPIDJSON_HAS_CXX11_RVALUE_REFS 76 RAPIDJSON_ASSERT(indentChar ==
' ' || indentChar ==
'\t' || indentChar ==
'\n' || indentChar ==
'\r');
117 #if RAPIDJSON_HAS_STDSTRING 118 bool String(
const std::basic_string<Ch>&
str) {
131 #if RAPIDJSON_HAS_STDSTRING 132 bool Key(
const std::basic_string<Ch>& str) {
269 #if defined(__clang__) 277 #endif // RAPIDJSON_RAPIDJSON_H_ PrettyFormatOptions
Combination of PrettyWriter format flags.
unsigned indentCharCount_
bool RawValue(const Ch *json, size_t length, Type type)
Write a raw JSON value.
size_t valueCount
number of values in this level
void Flush()
Flush the output stream.
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
bool inArray
true if in array, otherwise in object
#define RAPIDJSON_ASSERT(x)
Assertion.
PrettyFormatOptions formatOptions_
bool WriteInt64(int64_t i64)
void PrettyPrefix(Type type)
PrettyWriter & SetIndent(Ch indentChar, unsigned indentCharCount)
Set custom indentation.
bool String(const Ch *str)
Simpler but slower overload.
bool WriteUint64(uint64_t u64)
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
static const size_t kDefaultLevelDepth
void PutN(FileWriteStream &stream, char c, size_t n)
Implement specialized version of PutN() with memset() for better performance.
bool Key(const Ch *str, SizeType length, bool copy=false)
bool WriteRawValue(const Ch *json, size_t length)
PrettyWriter & operator=(const PrettyWriter &)
PrettyWriter(StackAllocator *allocator=0, size_t levelDepth=Base::kDefaultLevelDepth)
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Default pretty formatting.
bool RawNumber(const Ch *str, SizeType length, bool copy=false)
bool WriteUint(unsigned u)
Information for each nested level.
bool EndObject(SizeType memberCount=0)
unsigned __int64 uint64_t
bool WriteString(const Ch *str, SizeType length)
bool EndArray(SizeType memberCount=0)
PrettyWriter(OutputStream &os, StackAllocator *allocator=0, size_t levelDepth=Base::kDefaultLevelDepth)
Constructor.
SizeType StrLen(const Ch *s)
Custom strlen() which works on different character types.
bool String(const Ch *str, SizeType length, bool copy=false)
internal::Stack< StackAllocator > level_stack_
bool WriteDouble(double d)
Format arrays on a single line.
Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator, writeFlags > Base
PrettyWriter & SetFormatOptions(PrettyFormatOptions options)
Set pretty writer formatting options.
bool Uint64(uint64_t u64)
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Writer with indentation and spacing.