@@ -339,12 +339,12 @@ class Map : public Vector {
339
339
340
340
template <typename T>
341
341
void AppendToString (std::string &s, T &&v, bool keys_quoted) {
342
- s += " [ " ;
343
- for (size_t i = 0 ; i < v.size (); i++) {
344
- if (i) s += " , " ;
345
- v[i].ToString (true , keys_quoted, s);
346
- }
347
- s += " ]" ;
342
+ s += " [ " ;
343
+ for (size_t i = 0 ; i < v.size (); i++) {
344
+ if (i) s += " , " ;
345
+ v[i].ToString (true , keys_quoted, s);
346
+ }
347
+ s += " ]" ;
348
348
}
349
349
350
350
class Reference {
@@ -386,13 +386,17 @@ class Reference {
386
386
bool IsVector () const { return type_ == FBT_VECTOR || type_ == FBT_MAP; }
387
387
bool IsUntypedVector () const { return type_ == FBT_VECTOR; }
388
388
bool IsTypedVector () const { return flexbuffers::IsTypedVector (type_); }
389
- bool IsFixedTypedVector () const { return flexbuffers::IsFixedTypedVector (type_); }
390
- bool IsAnyVector () const { return (IsTypedVector () || IsFixedTypedVector () || IsVector ());}
389
+ bool IsFixedTypedVector () const {
390
+ return flexbuffers::IsFixedTypedVector (type_);
391
+ }
392
+ bool IsAnyVector () const {
393
+ return (IsTypedVector () || IsFixedTypedVector () || IsVector ());
394
+ }
391
395
bool IsMap () const { return type_ == FBT_MAP; }
392
396
bool IsBlob () const { return type_ == FBT_BLOB; }
393
397
bool AsBool () const {
394
398
return (type_ == FBT_BOOL ? ReadUInt64 (data_, parent_width_)
395
- : AsUInt64 ()) != 0 ;
399
+ : AsUInt64 ()) != 0 ;
396
400
}
397
401
398
402
// Reads any type as a int64_t. Never fails, does most sensible conversion.
@@ -555,7 +559,8 @@ class Reference {
555
559
AppendToString<FixedTypedVector>(s, AsFixedTypedVector (), keys_quoted);
556
560
} else if (IsBlob ()) {
557
561
auto blob = AsBlob ();
558
- flatbuffers::EscapeString (reinterpret_cast <const char *>(blob.data ()), blob.size (), &s, true , false );
562
+ flatbuffers::EscapeString (reinterpret_cast <const char *>(blob.data ()),
563
+ blob.size (), &s, true , false );
559
564
} else {
560
565
s += " (?)" ;
561
566
}
@@ -729,9 +734,15 @@ template<> inline int32_t Reference::As<int32_t>() const { return AsInt32(); }
729
734
template <> inline int64_t Reference::As<int64_t >() const { return AsInt64 (); }
730
735
731
736
template <> inline uint8_t Reference::As<uint8_t >() const { return AsUInt8 (); }
732
- template <> inline uint16_t Reference::As<uint16_t >() const { return AsUInt16 (); }
733
- template <> inline uint32_t Reference::As<uint32_t >() const { return AsUInt32 (); }
734
- template <> inline uint64_t Reference::As<uint64_t >() const { return AsUInt64 (); }
737
+ template <> inline uint16_t Reference::As<uint16_t >() const {
738
+ return AsUInt16 ();
739
+ }
740
+ template <> inline uint32_t Reference::As<uint32_t >() const {
741
+ return AsUInt32 ();
742
+ }
743
+ template <> inline uint64_t Reference::As<uint64_t >() const {
744
+ return AsUInt64 ();
745
+ }
735
746
736
747
template <> inline double Reference::As<double >() const { return AsDouble (); }
737
748
template <> inline float Reference::As<float >() const { return AsFloat (); }
@@ -920,9 +931,7 @@ class Builder FLATBUFFERS_FINAL_CLASS {
920
931
Bool (b);
921
932
}
922
933
923
- void IndirectInt (int64_t i) {
924
- PushIndirect (i, FBT_INDIRECT_INT, WidthI (i));
925
- }
934
+ void IndirectInt (int64_t i) { PushIndirect (i, FBT_INDIRECT_INT, WidthI (i)); }
926
935
void IndirectInt (const char *key, int64_t i) {
927
936
Key (key);
928
937
IndirectInt (i);
@@ -1214,9 +1223,7 @@ class Builder FLATBUFFERS_FINAL_CLASS {
1214
1223
// Works on any data type.
1215
1224
struct Value ;
1216
1225
Value LastValue () { return stack_.back (); }
1217
- void ReuseValue (Value v) {
1218
- stack_.push_back (v);
1219
- }
1226
+ void ReuseValue (Value v) { stack_.push_back (v); }
1220
1227
void ReuseValue (const char *key, Value v) {
1221
1228
Key (key);
1222
1229
ReuseValue (v);
@@ -1462,7 +1469,9 @@ class Builder FLATBUFFERS_FINAL_CLASS {
1462
1469
1463
1470
Value CreateVector (size_t start, size_t vec_len, size_t step, bool typed,
1464
1471
bool fixed, const Value *keys = nullptr ) {
1465
- FLATBUFFERS_ASSERT (!fixed || typed); // typed=false, fixed=true combination is not supported.
1472
+ FLATBUFFERS_ASSERT (
1473
+ !fixed ||
1474
+ typed); // typed=false, fixed=true combination is not supported.
1466
1475
// Figure out smallest bit width we can store this vector with.
1467
1476
auto bit_width = (std::max)(force_min_bit_width_, WidthU (vec_len));
1468
1477
auto prefix_elems = 1 ;
@@ -1542,7 +1551,8 @@ class Builder FLATBUFFERS_FINAL_CLASS {
1542
1551
1543
1552
typedef std::pair<size_t , size_t > StringOffset;
1544
1553
struct StringOffsetCompare {
1545
- explicit StringOffsetCompare (const std::vector<uint8_t > &buf) : buf_(&buf) {}
1554
+ explicit StringOffsetCompare (const std::vector<uint8_t > &buf)
1555
+ : buf_(&buf) {}
1546
1556
bool operator ()(const StringOffset &a, const StringOffset &b) const {
1547
1557
auto stra = reinterpret_cast <const char *>(
1548
1558
flatbuffers::vector_data (*buf_) + a.first );
@@ -1562,8 +1572,8 @@ class Builder FLATBUFFERS_FINAL_CLASS {
1562
1572
1563
1573
} // namespace flexbuffers
1564
1574
1565
- # if defined(_MSC_VER)
1566
- # pragma warning(pop)
1567
- # endif
1575
+ #if defined(_MSC_VER)
1576
+ # pragma warning(pop)
1577
+ #endif
1568
1578
1569
1579
#endif // FLATBUFFERS_FLEXBUFFERS_H_
0 commit comments