Skip to content

Commit 435a32a

Browse files
committed
Formatted value.h
1 parent 466b4ea commit 435a32a

File tree

1 file changed

+17
-31
lines changed

1 file changed

+17
-31
lines changed

include/json/value.h

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -399,39 +399,32 @@ class JSON_API Value {
399399
double asDouble() const;
400400
bool asBool() const;
401401

402-
template <class T>
403-
struct asLookupHelper;
404-
405-
#define defAsLookupHelper(type, lookup) \
406-
template<> \
407-
struct asLookupHelper< type > { \
408-
static type as(const Value& val) { \
409-
return val. lookup (); \
410-
} \
402+
template <class T> struct asLookupHelper;
403+
404+
#define defAsLookupHelper(type, lookup) \
405+
template <> struct asLookupHelper<type> { \
406+
static type as(const Value& val) { return val.lookup(); } \
411407
}
412408

413409
defAsLookupHelper(const char*, asCString);
414410
defAsLookupHelper(String, asString);
415-
#ifdef JSON_USE_CPPTL
411+
#ifdef JSON_USE_CPPTL
416412
defAsLookupHelper(CppTL::ConstString, asConstString);
417-
#endif
413+
#endif
418414
defAsLookupHelper(Int, asInt);
419415
defAsLookupHelper(UInt, asUInt);
420-
#if defined(JSON_HAS_INT64)
416+
#if defined(JSON_HAS_INT64)
421417
defAsLookupHelper(Int64, asInt64);
422418
defAsLookupHelper(UInt64, asUInt64);
423-
#endif // if defined(JSON_HAS_INT64)
419+
#endif // if defined(JSON_HAS_INT64)
424420
// (U)LargestInt is a type alias of int or int64 and thus cannot be defined
425421
defAsLookupHelper(float, asFloat);
426422
defAsLookupHelper(double, asDouble);
427423
defAsLookupHelper(bool, asBool);
428424

429-
#undef defAsLookupHelper
425+
#undef defAsLookupHelper
430426

431-
template <class T>
432-
T as() const {
433-
return asLookupHelper<T>::as(*this);
434-
}
427+
template <class T> T as() const { return asLookupHelper<T>::as(*this); }
435428

436429
bool isNull() const;
437430
bool isBool() const;
@@ -446,15 +439,11 @@ class JSON_API Value {
446439
bool isArray() const;
447440
bool isObject() const;
448441

449-
template <class T>
450-
struct isLookupHelper;
442+
template <class T> struct isLookupHelper;
451443

452-
#define defIsLookupHelper(type, lookup) \
453-
template<> \
454-
struct isLookupHelper< type > { \
455-
static bool is(const Value& val) { \
456-
return val. lookup (); \
457-
} \
444+
#define defIsLookupHelper(type, lookup) \
445+
template <> struct isLookupHelper<type> { \
446+
static bool is(const Value& val) { return val.lookup(); } \
458447
}
459448

460449
defIsLookupHelper(bool, isBool);
@@ -466,12 +455,9 @@ class JSON_API Value {
466455
defIsLookupHelper(const char*, isString);
467456
defIsLookupHelper(String, isString);
468457

469-
#undef defIsLookupHelper
458+
#undef defIsLookupHelper
470459

471-
template <class T>
472-
bool is() const {
473-
return isLookupHelper<T>::is(*this);
474-
}
460+
template <class T> bool is() const { return isLookupHelper<T>::is(*this); }
475461

476462
bool isConvertibleTo(ValueType other) const;
477463

0 commit comments

Comments
 (0)