@@ -15,7 +15,7 @@ struct VariantData;
1515class ResourceManager ;
1616
1717class CollectionIterator {
18- friend class CollectionImpl ;
18+ friend class VariantImpl ;
1919
2020 public:
2121 CollectionIterator () : slot_(nullptr ), currentId_(NULL_SLOT) {}
@@ -65,76 +65,4 @@ class CollectionIterator {
6565 SlotId currentId_;
6666};
6767
68- class CollectionImpl {
69- protected:
70- VariantData* data_;
71- ResourceManager* resources_;
72-
73- public:
74- using iterator = CollectionIterator;
75-
76- CollectionImpl () : data_(nullptr ), resources_(nullptr ) {}
77-
78- CollectionImpl (VariantData* data, ResourceManager* resources)
79- : data_(data), resources_(resources) {}
80-
81- explicit operator bool () const {
82- return data_ && data_->isCollection ();
83- }
84-
85- bool isNull () const {
86- return !operator bool ();
87- }
88-
89- VariantData* getData () const {
90- return data_;
91- }
92-
93- ResourceManager* getResourceManager () const {
94- return resources_;
95- }
96-
97- iterator createIterator () const ;
98-
99- size_t size () const ;
100- size_t nesting () const ;
101-
102- void clear ();
103-
104- SlotId head () const {
105- return getCollectionData ()->head ;
106- }
107-
108- protected:
109- void appendOne (Slot<VariantData> slot);
110- void appendPair (Slot<VariantData> key, Slot<VariantData> value);
111-
112- void removeOne (iterator it);
113- void removePair (iterator it);
114-
115- VariantData* getVariant (SlotId id) const {
116- ARDUINOJSON_ASSERT (resources_ != nullptr );
117- return resources_->getVariant (id);
118- }
119-
120- void freeVariant (Slot<VariantData> slot) {
121- ARDUINOJSON_ASSERT (resources_ != nullptr );
122- resources_->freeVariant (slot);
123- }
124-
125- Slot<VariantData> allocVariant () {
126- ARDUINOJSON_ASSERT (resources_ != nullptr );
127- return resources_->allocVariant ();
128- }
129-
130- private:
131- Slot<VariantData> getPreviousSlot (VariantData*) const ;
132-
133- CollectionData* getCollectionData () const {
134- ARDUINOJSON_ASSERT (data_ != nullptr );
135- ARDUINOJSON_ASSERT (data_->isCollection ());
136- return &data_->content .asCollection ;
137- }
138- };
139-
14068ARDUINOJSON_END_PRIVATE_NAMESPACE
0 commit comments