File tree 3 files changed +13
-11
lines changed
3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,18 @@ namespace ARDUINOJSON_NAMESPACE {
16
16
enum {
17
17
VALUE_MASK = 0x7F ,
18
18
19
- VALUE_IS_OWNED = 0x01 ,
19
+ OWNED_VALUE_BIT = 0x01 ,
20
20
VALUE_IS_NULL = 0 ,
21
21
VALUE_IS_LINKED_RAW = 0x02 ,
22
22
VALUE_IS_OWNED_RAW = 0x03 ,
23
23
VALUE_IS_LINKED_STRING = 0x04 ,
24
24
VALUE_IS_OWNED_STRING = 0x05 ,
25
25
26
- // CAUTION: no VALUE_IS_OWNED below
26
+ // CAUTION: no OWNED_VALUE_BIT below
27
+
27
28
VALUE_IS_BOOLEAN = 0x06 ,
29
+
30
+ NUMBER_BIT = 0x08 ,
28
31
VALUE_IS_UNSIGNED_INTEGER = 0x08 ,
29
32
VALUE_IS_SIGNED_INTEGER = 0x0A ,
30
33
VALUE_IS_FLOAT = 0x0C ,
33
36
VALUE_IS_OBJECT = 0x20 ,
34
37
VALUE_IS_ARRAY = 0x40 ,
35
38
36
- KEY_IS_OWNED = 0x80
39
+ OWNED_KEY_BIT = 0x80
37
40
};
38
41
39
42
struct RawData {
Original file line number Diff line number Diff line change @@ -141,8 +141,7 @@ class VariantData {
141
141
}
142
142
143
143
bool isFloat () const {
144
- return type () == VALUE_IS_FLOAT || type () == VALUE_IS_UNSIGNED_INTEGER ||
145
- type () == VALUE_IS_SIGNED_INTEGER;
144
+ return (_flags & NUMBER_BIT) != 0 ;
146
145
}
147
146
148
147
bool isString () const {
@@ -308,7 +307,7 @@ class VariantData {
308
307
}
309
308
310
309
void movePointers (ptrdiff_t stringDistance, ptrdiff_t variantDistance) {
311
- if (_flags & VALUE_IS_OWNED )
310
+ if (_flags & OWNED_VALUE_BIT )
312
311
_content.asString += stringDistance;
313
312
if (_flags & COLLECTION_MASK)
314
313
_content.asCollection .movePointers (stringDistance, variantDistance);
@@ -320,7 +319,7 @@ class VariantData {
320
319
321
320
private:
322
321
void setType (uint8_t t) {
323
- _flags &= KEY_IS_OWNED ;
322
+ _flags &= OWNED_KEY_BIT ;
324
323
_flags |= t;
325
324
}
326
325
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class VariantSlot {
79
79
80
80
void setKey (const char * k, storage_policies::store_by_copy) {
81
81
ARDUINOJSON_ASSERT (k != NULL );
82
- _flags |= KEY_IS_OWNED ;
82
+ _flags |= OWNED_KEY_BIT ;
83
83
_key = k;
84
84
}
85
85
@@ -94,7 +94,7 @@ class VariantSlot {
94
94
}
95
95
96
96
bool ownsKey () const {
97
- return (_flags & KEY_IS_OWNED ) != 0 ;
97
+ return (_flags & OWNED_KEY_BIT ) != 0 ;
98
98
}
99
99
100
100
void clear () {
@@ -104,9 +104,9 @@ class VariantSlot {
104
104
}
105
105
106
106
void movePointers (ptrdiff_t stringDistance, ptrdiff_t variantDistance) {
107
- if (_flags & KEY_IS_OWNED )
107
+ if (_flags & OWNED_KEY_BIT )
108
108
_key += stringDistance;
109
- if (_flags & VALUE_IS_OWNED )
109
+ if (_flags & OWNED_VALUE_BIT )
110
110
_content.asString += stringDistance;
111
111
if (_flags & COLLECTION_MASK)
112
112
_content.asCollection .movePointers (stringDistance, variantDistance);
You can’t perform that action at this time.
0 commit comments