@@ -338,18 +338,14 @@ Json::Value obj_value(Json::objectValue); // {}
338
338
Value (const CppTL::ConstString& value);
339
339
#endif
340
340
Value (bool value);
341
- // / Deep copy.
342
341
Value (const Value& other);
343
- #if JSON_HAS_RVALUE_REFERENCES
344
- // / Move constructor
345
342
Value (Value&& other);
346
- #endif
347
343
~Value ();
348
344
349
- // / Deep copy, then swap(other).
350
- // / \note Over-write existing comments. To preserve comments, use
345
+ // / \note Overwrite existing comments. To preserve comments, use
351
346
// / #swapPayload().
352
- Value& operator =(Value other);
347
+ Value& operator =(const Value& other);
348
+ Value& operator =(Value&& other);
353
349
354
350
// / Swap everything.
355
351
void swap (Value& other);
@@ -616,6 +612,10 @@ Json::Value obj_value(Json::objectValue); // {}
616
612
ptrdiff_t getOffsetLimit () const ;
617
613
618
614
private:
615
+ void setType (ValueType v) { bits_.value_type_ = v; }
616
+ bool isAllocated () const { return bits_.allocated_ ; }
617
+ void setIsAllocated (bool v) { bits_.allocated_ = v; }
618
+
619
619
void initBasic (ValueType type, bool allocated = false );
620
620
void dupPayload (const Value& other);
621
621
void releasePayload ();
@@ -647,14 +647,17 @@ Json::Value obj_value(Json::objectValue); // {}
647
647
LargestUInt uint_;
648
648
double real_;
649
649
bool bool_;
650
- char * string_; // actually ptr to unsigned, followed by str, unless
651
- // !allocated_
650
+ char * string_; // if allocated_, ptr to { unsigned, char[] }.
652
651
ObjectValues* map_;
653
652
} value_;
654
- ValueType type_ : 8 ;
655
- unsigned int allocated_ : 1 ; // Notes: if declared as bool, bitfield is
656
- // useless. If not allocated_, string_ must be
657
- // null-terminated.
653
+
654
+ struct {
655
+ // Really a ValueType, but types should agree for bitfield packing.
656
+ unsigned int value_type_ : 8 ;
657
+ // Unless allocated_, string_ must be null-terminated.
658
+ unsigned int allocated_ : 1 ;
659
+ } bits_;
660
+
658
661
CommentInfo* comments_;
659
662
660
663
// [start, limit) byte offsets in the source JSON text from which this Value
0 commit comments