1 #ifndef RAPIDJSON_WRITER_H_
2 #define RAPIDJSON_WRITER_H_
12 #pragma warning(disable : 4127) // conditional expression is constant
31 template<
typename Stream,
typename Encoding = UTF8<>,
typename Allocator = MemoryPoolAllocator<> >
34 typedef typename Encoding::Ch
Ch;
127 *p++ = (u % 10) +
'0';
134 }
while (p != buffer);
149 *p++ = char(u64 % 10) +
'0';
156 }
while (p != buffer);
163 int ret = sprintf_s(buffer,
sizeof(buffer),
"%0.16g", d);
165 int ret = snprintf(buffer,
sizeof(buffer),
"%0.16g", d);
168 for (
int i = 0; i < ret; i++)
173 static const char hexDigits[] =
"0123456789ABCDEF";
174 static const char escape[256] = {
175 #define Z16 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
177 'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'b',
't',
'n',
'u',
'f',
'r',
'u',
'u',
178 'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
'u',
179 0, 0,
'"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
'\\', 0, 0, 0,
187 for (
const Ch* p = str; p != str + length; ++p) {
188 if ((
sizeof(
Ch) == 1 || *p < 256) && escape[(
unsigned char)*p]) {
190 stream_.Put(escape[(
unsigned char)*p]);
191 if (escape[(
unsigned char)*p] ==
'u') {
194 stream_.Put(hexDigits[(*p) >> 4]);
195 stream_.Put(hexDigits[(*p) & 0xF]);
241 #endif // RAPIDJSON_RAPIDJSON_H_
Writer & EndArray(SizeType elementCount=0)
internal::Stack< Allocator > level_stack_
bool inArray
true if in array, otherwise in object
SizeType StrLen(const Ch *s)
Custom strlen() which works on different character types.
A type-unsafe stack for storing different types of data.
unsigned SizeType
Use 32-bit array/string indices even for 64-bit platform, instead of using size_t.
Writer & Uint(unsigned u)
void WriteUint64(uint64_t u64)
Writer & String(const Ch *str, SizeType length, bool copy=false)
void WriteInt64(int64_t i64)
Writer(Stream &stream, Allocator *allocator=0, size_t levelDepth=kDefaultLevelDepth)
void WriteString(const Ch *str, SizeType length)
void WriteUint(unsigned u)
Information for each nested level.
Writer & EndObject(SizeType memberCount=0)
Writer & String(const Ch *str)
Simpler but slower overload.
#define RAPIDJSON_ASSERT(x)
Assertion.
size_t valueCount
number of values in this level
static const size_t kDefaultLevelDepth
Writer & Double(double d)
Concept for reading and writing characters.
void WriteDouble(double d)
Writer & Uint64(uint64_t u64)
double double double *typedef void(CALLCONV AGdll_TYPE)(double *
Concept for allocating, resizing and freeing memory block.
Writer & Int64(int64_t i64)