minor code formatting cleanup;

Bryan Biedenkapp 4 years ago
parent 64dd627210
commit 1a69a63626

@ -256,19 +256,19 @@ namespace json
u_.p = v; \ u_.p = v; \
break break
INIT(boolean_, false); INIT(boolean_, false);
INIT(number_, 0.0); INIT(number_, 0.0);
#ifdef PICOJSON_USE_INT64 #ifdef PICOJSON_USE_INT64
INIT(int64_, 0); INIT(int64_, 0);
#endif #endif
INIT(int32_, 0); INIT(int32_, 0);
INIT(uint32_, 0); INIT(uint32_, 0);
INIT(uint16_, 0); INIT(uint16_, 0);
INIT(uint8_, 0); INIT(uint8_, 0);
INIT(float_, 0.0f); INIT(float_, 0.0f);
INIT(string_, new std::string()); INIT(string_, new std::string());
INIT(array_, new array()); INIT(array_, new array());
INIT(object_, new object()); INIT(object_, new object());
#undef INIT #undef INIT
default: default:
break; break;
@ -341,9 +341,9 @@ namespace json
delete u_.p; \ delete u_.p; \
break break
DEINIT(string_); DEINIT(string_);
DEINIT(array_); DEINIT(array_);
DEINIT(object_); DEINIT(object_);
#undef DEINIT #undef DEINIT
default: default:
break; break;
@ -361,9 +361,9 @@ namespace json
u_.p = v; \ u_.p = v; \
break break
INIT(string_, new std::string(*x.u_.string_)); INIT(string_, new std::string(*x.u_.string_));
INIT(array_, new array(*x.u_.array_)); INIT(array_, new array(*x.u_.array_));
INIT(object_, new object(*x.u_.object_)); INIT(object_, new object(*x.u_.object_));
#undef INIT #undef INIT
default: default:
u_ = x.u_; u_ = x.u_;
@ -632,20 +632,20 @@ namespace json
Iter oi; Iter oi;
void operator()(char c) { void operator()(char c) {
switch (c) { switch (c) {
#define MAP(val, sym) \ #define MAP(val, sym) \
case val: \ case val: \
copy(sym, oi); \ copy(sym, oi); \
break break
MAP('"', "\\\""); MAP('"', "\\\"");
MAP('\\', "\\\\"); MAP('\\', "\\\\");
MAP('/', "\\/"); MAP('/', "\\/");
MAP('\b', "\\b"); MAP('\b', "\\b");
MAP('\f', "\\f"); MAP('\f', "\\f");
MAP('\n', "\\n"); MAP('\n', "\\n");
MAP('\r', "\\r"); MAP('\r', "\\r");
MAP('\t', "\\t"); MAP('\t', "\\t");
#undef MAP #undef MAP
default: default:
if (static_cast<unsigned char>(c) < 0x20 || c == 0x7f) { if (static_cast<unsigned char>(c) < 0x20 || c == 0x7f) {
char buf[7]; char buf[7];
@ -935,14 +935,14 @@ namespace json
out.push_back(val); \ out.push_back(val); \
break break
MAP('"', '\"'); MAP('"', '\"');
MAP('\\', '\\'); MAP('\\', '\\');
MAP('/', '/'); MAP('/', '/');
MAP('b', '\b'); MAP('b', '\b');
MAP('f', '\f'); MAP('f', '\f');
MAP('n', '\n'); MAP('n', '\n');
MAP('r', '\r'); MAP('r', '\r');
MAP('t', '\t'); MAP('t', '\t');
#undef MAP #undef MAP
case 'u': case 'u':
if (!_parse_codepoint(out, in)) { if (!_parse_codepoint(out, in)) {
@ -1027,18 +1027,18 @@ namespace json
in.skip_ws(); in.skip_ws();
int ch = in.getc(); int ch = in.getc();
switch (ch) { switch (ch) {
#define IS(ch, text, op) \ #define IS(ch, text, op) \
case ch: \ case ch: \
if (in.match(text) && op) { \ if (in.match(text) && op) { \
return true; \ return true; \
} else { \ } else { \
return false; \ return false; \
} }
IS('n', "ull", ctx.set_null()); IS('n', "ull", ctx.set_null());
IS('f', "alse", ctx.set_bool(false)); IS('f', "alse", ctx.set_bool(false));
IS('t', "rue", ctx.set_bool(true)); IS('t', "rue", ctx.set_bool(true));
#undef IS #undef IS
case '"': case '"':
return ctx.parse_string(in); return ctx.parse_string(in);
case '[': case '[':

Loading…
Cancel
Save

Powered by TurnKey Linux.