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),
"%g", d);
165 int ret = snprintf(buffer,
sizeof(buffer),
"%g", 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,
182 Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16, Z16
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_