Operator Console
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
jsonChildren Class Reference

#include <JSONChildren.h>

Classes

struct  iteratorKeeper
 

Public Member Functions

 jsonChildren (void) json_nothrow
 
childrenVirtual ~jsonChildren (void) json_nothrow
 
void inc (json_index_t amount) json_nothrow
 
void inc (void) json_nothrow
 
void push_back (JSONNode *item) json_nothrow
 
void push_front (JSONNode *item) json_nothrow
 
JSONNodeoperator[] (json_index_t position) const json_nothrow
 
json_index_t capacity () const json_nothrow
 
json_index_t size () const json_nothrow
 
bool empty () const json_nothrow
 
void clear () json_nothrow
 
JSONNode ** begin (void) const json_nothrow
 
JSONNode ** end (void) const json_nothrow
 
void erase (JSONNode **&position) json_nothrow
 
void erase (JSONNode **&position, json_index_t number) json_nothrow
 
void erase (JSONNode **position, json_index_t number, JSONNode **&starter) json_nothrow
 
void insert (JSONNode **&position, JSONNode *item, bool reverse=false) json_nothrow
 
void insert (JSONNode **&position, JSONNode **items, json_index_t num) json_nothrow
 
void reserve (json_index_t amount) json_nothrow
 
childrenVirtual void shrink () json_nothrow
 
JSON_PROTECTED jsonChildren (const jsonChildren &)
 
jsonChildrenoperator= (const jsonChildren &)
 
void deleteAll (void) json_nothrow json_hot
 
void doerase (JSONNode **position, json_index_t number) json_nothrow
 
 jsonChildren (void) json_nothrow
 
childrenVirtual ~jsonChildren (void) json_nothrow
 
void inc (json_index_t amount) json_nothrow
 
void inc (void) json_nothrow
 
void push_back (JSONNode *item) json_nothrow
 
void push_front (JSONNode *item) json_nothrow
 
JSONNodeoperator[] (json_index_t position) const json_nothrow
 
json_index_t capacity () const json_nothrow
 
json_index_t size () const json_nothrow
 
bool empty () const json_nothrow
 
void clear () json_nothrow
 
JSONNode ** begin (void) const json_nothrow
 
JSONNode ** end (void) const json_nothrow
 
void erase (JSONNode **&position) json_nothrow
 
void erase (JSONNode **&position, json_index_t number) json_nothrow
 
void erase (JSONNode **position, json_index_t number, JSONNode **&starter) json_nothrow
 
void insert (JSONNode **&position, JSONNode *item, bool reverse=false) json_nothrow
 
void insert (JSONNode **&position, JSONNode **items, json_index_t num) json_nothrow
 
void reserve (json_index_t amount) json_nothrow
 
childrenVirtual void shrink () json_nothrow
 
JSON_PROTECTED jsonChildren (const jsonChildren &)
 
jsonChildrenoperator= (const jsonChildren &)
 
void deleteAll (void) json_nothrow json_hot
 
void doerase (JSONNode **position, json_index_t number) json_nothrow
 

Static Public Member Functions

static void reserve2 (jsonChildren *&mine, json_index_t amount) json_nothrow
 
static void deleteChildren (jsonChildren *ptr) json_nothrow
 
static jsonChildrennewChildren (void)
 
static void reserve2 (jsonChildren *&mine, json_index_t amount) json_nothrow
 
static void deleteChildren (jsonChildren *ptr) json_nothrow
 
static jsonChildrennewChildren (void)
 

Public Attributes

JSONNode ** array
 
json_index_t mysize
 
json_index_t mycapacity
 

Constructor & Destructor Documentation

jsonChildren::jsonChildren ( void  )
inline

References addAllocCount.

Referenced by newChildren().

45  : array(0), mysize(0), mycapacity(0) {
46  addAllocCount();
47  }
JSONNode ** array
Definition: JSONChildren.h:281
#define addAllocCount()
Definition: JSONChildren.h:38
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283

Here is the caller graph for this function:

childrenVirtual jsonChildren::~jsonChildren ( void  )
inline

References array, deleteAll(), json_unlikely, and subAllocCount.

Referenced by deleteChildren().

56  {
57  if (json_unlikely(array != 0)){ //the following function calls are safe, but take more time than a check here
58  deleteAll();
59  libjson_free<JSONNode*>(array);
60  }
61  subAllocCount();
62  }
JSONNode ** array
Definition: JSONChildren.h:281
void deleteAll(void) json_nothrow json_hot
Definition: JSONChildren.cpp:73
#define json_unlikely(x)
Definition: Unknown_C.h:17
#define subAllocCount()
Definition: JSONChildren.h:39

Here is the call graph for this function:

Here is the caller graph for this function:

JSON_PROTECTED jsonChildren::jsonChildren ( const jsonChildren )
jsonChildren::jsonChildren ( void  )
inline

References addAllocCount.

45  : array(0), mysize(0), mycapacity(0) {
46  addAllocCount();
47  }
JSONNode ** array
Definition: JSONChildren.h:281
json_index_t mycapacity
Definition: JSONChildren.h:284
#define addAllocCount()
Definition: JSONChildren.h:38
json_index_t mysize
Definition: JSONChildren.h:283
childrenVirtual jsonChildren::~jsonChildren ( void  )
inline

References array, deleteAll(), json_unlikely, and subAllocCount.

56  {
57  if (json_unlikely(array != 0)){ //the following function calls are safe, but take more time than a check here
58  deleteAll();
59  libjson_free<JSONNode*>(array);
60  }
61  subAllocCount();
62  }
JSONNode ** array
Definition: JSONChildren.h:281
void deleteAll(void) json_nothrow json_hot
Definition: JSONChildren.cpp:73
#define json_unlikely(x)
Definition: Unknown_C.h:17
#define subAllocCount()
Definition: JSONChildren.h:39

Here is the call graph for this function:

JSON_PROTECTED jsonChildren::jsonChildren ( const jsonChildren )

Member Function Documentation

JSONNode** jsonChildren::begin ( void  ) const
inline

References array, JSON_ASSERT, and JSON_TEXT.

127  {
128  JSON_ASSERT(this != 0, JSON_TEXT("Children is null begin"));
129  return array;
130  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
JSONNode** jsonChildren::begin ( void  ) const
inline

References array, JSON_ASSERT, and JSON_TEXT.

127  {
128  JSON_ASSERT(this != 0, JSON_TEXT("Children is null begin"));
129  return array;
130  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t jsonChildren::capacity ( ) const
inline

References JSON_ASSERT, JSON_TEXT, and mycapacity.

98  {
99  JSON_ASSERT(this != 0, JSON_TEXT("Children is null capacity"));
100  return mycapacity;
101  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t jsonChildren::capacity ( ) const
inline

References JSON_ASSERT, JSON_TEXT, and mycapacity.

98  {
99  JSON_ASSERT(this != 0, JSON_TEXT("Children is null capacity"));
100  return mycapacity;
101  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
void jsonChildren::clear ( void  )
inline

References array, deleteAll(), JSON_ASSERT, json_likely, JSON_TEXT, mycapacity, and mysize.

116  {
117  JSON_ASSERT(this != 0, JSON_TEXT("Children is null clear"));
118  if (json_likely(array != 0)){ //don't bother clearing anything if there is nothing in it
119  JSON_ASSERT(mycapacity != 0, JSON_TEXT("mycapacity is not zero, but array is null"));
120  deleteAll();
121  mysize = 0;
122  }
123  JSON_ASSERT(mysize == 0, JSON_TEXT("mysize is not zero after clear"));
124  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void deleteAll(void) json_nothrow json_hot
Definition: JSONChildren.cpp:73
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
#define json_likely(x)
Definition: Unknown_C.h:16
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::clear ( )
inline

References array, deleteAll(), JSON_ASSERT, json_likely, JSON_TEXT, mycapacity, and mysize.

116  {
117  JSON_ASSERT(this != 0, JSON_TEXT("Children is null clear"));
118  if (json_likely(array != 0)){ //don't bother clearing anything if there is nothing in it
119  JSON_ASSERT(mycapacity != 0, JSON_TEXT("mycapacity is not zero, but array is null"));
120  deleteAll();
121  mysize = 0;
122  }
123  JSON_ASSERT(mysize == 0, JSON_TEXT("mysize is not zero after clear"));
124  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void deleteAll(void) json_nothrow json_hot
Definition: JSONChildren.cpp:73
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
#define json_likely(x)
Definition: Unknown_C.h:16
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::deleteAll ( void  )

References JSONNode::deleteJSONNode(), JSON_ASSERT, json_foreach, and JSON_TEXT.

Referenced by clear(), and ~jsonChildren().

73  {
74  JSON_ASSERT(this != 0, JSON_TEXT("Children is null deleteAll"));
75  json_foreach(this, runner){
76  JSON_ASSERT(*runner != JSON_TEXT('\0'), JSON_TEXT("a null pointer within the children"));
77  JSONNode::deleteJSONNode(*runner); //this is why I can't do forward declaration
78  }
79 }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
static void deleteJSONNode(JSONNode *ptr) json_nothrow json_hot
Definition: JSONNode.cpp:325
#define json_foreach(chldrn, itrtr)
Definition: JSONChildren.h:15
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53

Here is the call graph for this function:

Here is the caller graph for this function:

void jsonChildren::deleteAll ( void  )
static void jsonChildren::deleteChildren ( jsonChildren ptr)
inlinestatic

References ~jsonChildren().

264  {
265  #ifdef JSON_MEMORY_CALLBACKS
266  ptr -> ~jsonChildren();
267  libjson_free<jsonChildren>(ptr);
268  #else
269  delete ptr;
270  #endif
271  }
childrenVirtual ~jsonChildren(void) json_nothrow
Definition: JSONChildren.h:56

Here is the call graph for this function:

static void jsonChildren::deleteChildren ( jsonChildren ptr)
inlinestatic

References ~jsonChildren().

264  {
265  #ifdef JSON_MEMORY_CALLBACKS
266  ptr -> ~jsonChildren();
267  libjson_free<jsonChildren>(ptr);
268  #else
269  delete ptr;
270  #endif
271  }
childrenVirtual ~jsonChildren(void) json_nothrow
Definition: JSONChildren.h:56

Here is the call graph for this function:

void jsonChildren::doerase ( JSONNode **  position,
json_index_t  number 
)
void jsonChildren::doerase ( JSONNode **  position,
json_index_t  number 
)

References JSON_ASSERT, and JSON_TEXT.

Referenced by erase().

81  {
82  JSON_ASSERT(this != 0, JSON_TEXT("Children is null doerase"));
83  JSON_ASSERT(array != 0, JSON_TEXT("erasing something from a null array 2"));
84  JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array 2"));
85  JSON_ASSERT(position + number <= array + mysize, JSON_TEXT("erasing out of bounds 2"));
86  if (position + number >= array + mysize){
87  mysize = (json_index_t)(position - array);
88  #ifndef JSON_ISO_STRICT
89  JSON_ASSERT((long long)position - (long long)array >= 0, JSON_TEXT("doing negative allocation"));
90  #endif
91  } else {
92  std::memmove(position, position + number, (mysize - (position - array) - number) * sizeof(JSONNode *));
93  mysize -= number;
94  }
95 }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
unsigned int json_index_t
Definition: JSONDefs.h:109
json_index_t mysize
Definition: JSONChildren.h:283

Here is the caller graph for this function:

bool jsonChildren::empty ( void  ) const
inline

References JSON_ASSERT, JSON_TEXT, and mysize.

110  {
111  JSON_ASSERT(this != 0, JSON_TEXT("Children is null empty"));
112  return mysize == 0;
113  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283
bool jsonChildren::empty ( void  ) const
inline

References JSON_ASSERT, JSON_TEXT, and mysize.

110  {
111  JSON_ASSERT(this != 0, JSON_TEXT("Children is null empty"));
112  return mysize == 0;
113  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283
JSONNode** jsonChildren::end ( void  ) const
inline

References array, JSON_ASSERT, JSON_TEXT, and mysize.

133  {
134  JSON_ASSERT(this != 0, JSON_TEXT("Children is null end"));
135  return array + mysize;
136  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283
JSONNode** jsonChildren::end ( void  ) const
inline

References array, JSON_ASSERT, JSON_TEXT, and mysize.

133  {
134  JSON_ASSERT(this != 0, JSON_TEXT("Children is null end"));
135  return array + mysize;
136  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283
void jsonChildren::erase ( JSONNode **&  position)
inline

References array, JSON_ASSERT, JSON_TEXT, mysize, and shrink().

176  {
177  JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase"));
178  JSON_ASSERT(array != 0, JSON_TEXT("erasing something from a null array 1"));
179  JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array 1"));
180  JSON_ASSERT(position <= array + mysize, JSON_TEXT("erasing out of bounds 1"));
181  std::memmove(position, position + 1, (mysize-- - (position - array) - 1) * sizeof(JSONNode *));
182  iteratorKeeper ik(this, position);
183  shrink();
184  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
childrenVirtual void shrink() json_nothrow
Definition: JSONChildren.h:249
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::erase ( JSONNode **&  position)
inline

References array, JSON_ASSERT, JSON_TEXT, mysize, and shrink().

176  {
177  JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase"));
178  JSON_ASSERT(array != 0, JSON_TEXT("erasing something from a null array 1"));
179  JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array 1"));
180  JSON_ASSERT(position <= array + mysize, JSON_TEXT("erasing out of bounds 1"));
181  std::memmove(position, position + 1, (mysize-- - (position - array) - 1) * sizeof(JSONNode *));
182  iteratorKeeper ik(this, position);
183  shrink();
184  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
childrenVirtual void shrink() json_nothrow
Definition: JSONChildren.h:249
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::erase ( JSONNode **&  position,
json_index_t  number 
)
inline

References doerase(), JSON_ASSERT, JSON_TEXT, and shrink().

187  {
188  JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase 2"));
189  doerase(position, number);
190  iteratorKeeper ik(this, position);
191  shrink();
192  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
childrenVirtual void shrink() json_nothrow
Definition: JSONChildren.h:249
void doerase(JSONNode **position, json_index_t number) json_nothrow
Definition: JSONChildren.cpp:81

Here is the call graph for this function:

void jsonChildren::erase ( JSONNode **&  position,
json_index_t  number 
)
inline

References doerase(), JSON_ASSERT, JSON_TEXT, and shrink().

187  {
188  JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase 2"));
189  doerase(position, number);
190  iteratorKeeper ik(this, position);
191  shrink();
192  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
childrenVirtual void shrink() json_nothrow
Definition: JSONChildren.h:249
void doerase(JSONNode **position, json_index_t number) json_nothrow
Definition: JSONChildren.cpp:81

Here is the call graph for this function:

void jsonChildren::erase ( JSONNode **  position,
json_index_t  number,
JSONNode **&  starter 
)
inline

References doerase(), JSON_ASSERT, JSON_TEXT, and shrink().

196  {
197  JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase 3"));
198  doerase(position, number);
199  iteratorKeeper ik(this, starter);
200  shrink();
201  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
childrenVirtual void shrink() json_nothrow
Definition: JSONChildren.h:249
void doerase(JSONNode **position, json_index_t number) json_nothrow
Definition: JSONChildren.cpp:81

Here is the call graph for this function:

void jsonChildren::erase ( JSONNode **  position,
json_index_t  number,
JSONNode **&  starter 
)
inline

References doerase(), JSON_ASSERT, JSON_TEXT, and shrink().

196  {
197  JSON_ASSERT(this != 0, JSON_TEXT("Children is null erase 3"));
198  doerase(position, number);
199  iteratorKeeper ik(this, starter);
200  shrink();
201  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
childrenVirtual void shrink() json_nothrow
Definition: JSONChildren.h:249
void doerase(JSONNode **position, json_index_t number) json_nothrow
Definition: JSONChildren.cpp:81

Here is the call graph for this function:

void jsonChildren::inc ( json_index_t  amount)
void jsonChildren::inc ( json_index_t  amount)

References JSON_ASSERT, json_likely, JSON_TEXT, and json_unlikely.

46  {
47  JSON_ASSERT(this != 0, JSON_TEXT("Children is null inc(amount)"));
48  if (json_unlikely(amount == 0)) return;
49  if (json_likely(mysize + amount >= mycapacity)){ //it's full
50  if (json_unlikely(mycapacity == 0)){ //the array hasn't been created yet
51  JSON_ASSERT(!array, JSON_TEXT("Expanding a 0 capacity array, but not null"));
52  #ifdef JSON_LESS_MEMORY
53  array = json_malloc<JSONNode*>(amount);
54  mycapacity = amount;
55  #else
56  array = json_malloc<JSONNode*>(amount > 8 ? amount : 8); //8 seems average for JSON, and it's only 64 bytes
57  mycapacity = amount > 8 ? amount : 8;
58  #endif
59  } else {
60  #ifdef JSON_LESS_MEMORY
61  mycapacity = mysize + amount; //increment the size of the array
62  #else
63  while(mysize + amount > mycapacity){
64  mycapacity <<= 1; //double the size of the array
65  }
66  #endif
67  array = json_realloc<JSONNode*>(array, mycapacity);
68  }
69  }
70 }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define json_unlikely(x)
Definition: Unknown_C.h:17
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
#define json_likely(x)
Definition: Unknown_C.h:16
json_index_t mysize
Definition: JSONChildren.h:283
void jsonChildren::inc ( void  )

References array, JSON_ASSERT, JSON_TEXT, json_unlikely, mycapacity, and mysize.

Referenced by insert(), push_back(), and push_front().

22  {
23  JSON_ASSERT(this != 0, JSON_TEXT("Children is null inc"));
24  if (json_unlikely(mysize == mycapacity)){ //it's full
25  if (json_unlikely(mycapacity == 0)){ //the array hasn't been created yet
26  JSON_ASSERT(!array, JSON_TEXT("Expanding a 0 capacity array, but not null"));
27  #ifdef JSON_LESS_MEMORY
28  array = json_malloc<JSONNode*>(1);
29  mycapacity = 1;
30  #else
31  array = json_malloc<JSONNode*>(8); //8 seems average for JSON, and it's only 64 bytes
32  mycapacity = 8;
33  #endif
34  } else {
35  #ifdef JSON_LESS_MEMORY
36  mycapacity += 1; //increment the size of the array
37  #else
38  mycapacity <<= 1; //double the size of the array
39  #endif
40  array = json_realloc<JSONNode*>(array, mycapacity);
41  }
42  }
43 }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define json_unlikely(x)
Definition: Unknown_C.h:17
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283

Here is the caller graph for this function:

void jsonChildren::inc ( void  )
void jsonChildren::insert ( JSONNode **&  position,
JSONNode item,
bool  reverse = false 
)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

206  {
207  #endif
208  JSON_ASSERT(this != 0, JSON_TEXT("Children is null insert"));
209  //position isnt relative to array because of realloc
210  JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array insert 1"));
211  JSON_ASSERT(position <= array + mysize, JSON_TEXT("position is above the end of the array insert 1"));
212  {
213  #ifdef JSON_LIBRARY
214  iteratorKeeper ik(this, position);
215  #else
216  iteratorKeeper ik(this, position, reverse);
217  #endif
218  inc();
219  }
220  std::memmove(position + 1, position, (mysize++ - (position - array)) * sizeof(JSONNode *));
221  *position = item;
222  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::insert ( JSONNode **&  position,
JSONNode item,
bool  reverse = false 
)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

206  {
207  #endif
208  JSON_ASSERT(this != 0, JSON_TEXT("Children is null insert"));
209  //position isnt relative to array because of realloc
210  JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array insert 1"));
211  JSON_ASSERT(position <= array + mysize, JSON_TEXT("position is above the end of the array insert 1"));
212  {
213  #ifdef JSON_LIBRARY
214  iteratorKeeper ik(this, position);
215  #else
216  iteratorKeeper ik(this, position, reverse);
217  #endif
218  inc();
219  }
220  std::memmove(position + 1, position, (mysize++ - (position - array)) * sizeof(JSONNode *));
221  *position = item;
222  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::insert ( JSONNode **&  position,
JSONNode **  items,
json_index_t  num 
)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

224  {
225  JSON_ASSERT(this != 0, JSON_TEXT("Children is null insert 2"));
226  JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array insert 2"));
227  JSON_ASSERT(position <= array + mysize, JSON_TEXT("position is above the end of the array insert 2"));
228  {
229  iteratorKeeper ik(this, position);
230  inc(num);
231  }
232  const size_t ptrs = ((JSONNode **)(array + mysize)) - position;
233  std::memmove(position + num, position, ptrs * sizeof(JSONNode *));
234  std::memcpy(position, items, num * sizeof(JSONNode *));
235  mysize += num;
236  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::insert ( JSONNode **&  position,
JSONNode **  items,
json_index_t  num 
)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

224  {
225  JSON_ASSERT(this != 0, JSON_TEXT("Children is null insert 2"));
226  JSON_ASSERT(position >= array, JSON_TEXT("position is beneath the start of the array insert 2"));
227  JSON_ASSERT(position <= array + mysize, JSON_TEXT("position is above the end of the array insert 2"));
228  {
229  iteratorKeeper ik(this, position);
230  inc(num);
231  }
232  const size_t ptrs = ((JSONNode **)(array + mysize)) - position;
233  std::memmove(position + num, position, ptrs * sizeof(JSONNode *));
234  std::memcpy(position, items, num * sizeof(JSONNode *));
235  mysize += num;
236  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

static jsonChildren* jsonChildren::newChildren ( void  )
inlinestatic

References jsonChildren().

Referenced by internalJSONNode::internalJSONNode().

273  {
274  #ifdef JSON_MEMORY_CALLBACKS
275  return new(json_malloc<jsonChildren>(1)) jsonChildren();
276  #else
277  return new jsonChildren();
278  #endif
279  }
jsonChildren(void) json_nothrow
Definition: JSONChildren.h:45

Here is the call graph for this function:

Here is the caller graph for this function:

static jsonChildren* jsonChildren::newChildren ( void  )
inlinestatic

References jsonChildren().

273  {
274  #ifdef JSON_MEMORY_CALLBACKS
275  return new(json_malloc<jsonChildren>(1)) jsonChildren();
276  #else
277  return new jsonChildren();
278  #endif
279  }
jsonChildren(void) json_nothrow
Definition: JSONChildren.h:45

Here is the call graph for this function:

jsonChildren& jsonChildren::operator= ( const jsonChildren )
jsonChildren& jsonChildren::operator= ( const jsonChildren )
JSONNode* jsonChildren::operator[] ( json_index_t  position) const
inline

References array, JSON_ASSERT, JSON_TEXT, mycapacity, and mysize.

89  {
90  JSON_ASSERT(this != 0, JSON_TEXT("Children is null []"));
91  JSON_ASSERT(position < mysize, JSON_TEXT("Using [] out of bounds"));
92  JSON_ASSERT(position < mycapacity, JSON_TEXT("Using [] out of bounds"));
93  JSON_ASSERT(array != 0, JSON_TEXT("Array is null"));
94  return array[position];
95  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283
JSONNode* jsonChildren::operator[] ( json_index_t  position) const
inline

References array, JSON_ASSERT, JSON_TEXT, mycapacity, and mysize.

89  {
90  JSON_ASSERT(this != 0, JSON_TEXT("Children is null []"));
91  JSON_ASSERT(position < mysize, JSON_TEXT("Using [] out of bounds"));
92  JSON_ASSERT(position < mycapacity, JSON_TEXT("Using [] out of bounds"));
93  JSON_ASSERT(array != 0, JSON_TEXT("Array is null"));
94  return array[position];
95  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283
void jsonChildren::push_back ( JSONNode item)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

74  {
75  JSON_ASSERT(this != 0, JSON_TEXT("Children is null push_back"));
76  inc();
77  array[mysize++] = item;
78  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::push_back ( JSONNode item)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

74  {
75  JSON_ASSERT(this != 0, JSON_TEXT("Children is null push_back"));
76  inc();
77  array[mysize++] = item;
78  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::push_front ( JSONNode item)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

81  {
82  JSON_ASSERT(this != 0, JSON_TEXT("Children is null push_front"));
83  inc();
84  std::memmove(array + 1, array, mysize++ * sizeof(JSONNode *));
85  array[0] = item;
86  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::push_front ( JSONNode item)
inline

References array, inc(), JSON_ASSERT, JSON_TEXT, and mysize.

81  {
82  JSON_ASSERT(this != 0, JSON_TEXT("Children is null push_front"));
83  inc();
84  std::memmove(array + 1, array, mysize++ * sizeof(JSONNode *));
85  array[0] = item;
86  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
Definition: JSONNode.h:132
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Here is the call graph for this function:

void jsonChildren::reserve ( json_index_t  amount)
inline

References array, JSON_ASSERT, JSON_TEXT, mycapacity, and mysize.

238  {
239  JSON_ASSERT(this != 0, JSON_TEXT("Children is null reserve"));
240  JSON_ASSERT(array == 0, JSON_TEXT("reserve is not meant to expand a preexisting array"));
241  JSON_ASSERT(mycapacity == 0, JSON_TEXT("reservec is not meant to expand a preexisting array"));
242  JSON_ASSERT(mysize == 0, JSON_TEXT("reserves is not meant to expand a preexisting array"));
243  array = json_malloc<JSONNode*>(mycapacity = amount);
244  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283
void jsonChildren::reserve ( json_index_t  amount)
inline

References array, JSON_ASSERT, JSON_TEXT, mycapacity, and mysize.

238  {
239  JSON_ASSERT(this != 0, JSON_TEXT("Children is null reserve"));
240  JSON_ASSERT(array == 0, JSON_TEXT("reserve is not meant to expand a preexisting array"));
241  JSON_ASSERT(mycapacity == 0, JSON_TEXT("reservec is not meant to expand a preexisting array"));
242  JSON_ASSERT(mysize == 0, JSON_TEXT("reserves is not meant to expand a preexisting array"));
243  array = json_malloc<JSONNode*>(mycapacity = amount);
244  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283
void jsonChildren::reserve2 ( jsonChildren *&  mine,
json_index_t  amount 
)
static

Referenced by internalJSONNode::reserve().

9  {
10  if (mine -> array != 0){
11  if (mine -> mycapacity < amount){
12  mine -> inc(amount - mine -> mycapacity);
13  #ifdef JSON_LESS_MEMORY
14  mine = jsonChildren_Reserved::newChildren_Reserved(mine, amount);
15  #endif
16  }
17  } else {
18  mine -> reserve(amount);
19  }
20 }
JSONNode ** array
Definition: JSONChildren.h:281
void inc(void) json_nothrow
Definition: JSONChildren.cpp:22
json_index_t mycapacity
Definition: JSONChildren.h:284
void reserve(json_index_t amount) json_nothrow
Definition: JSONChildren.h:238

Here is the caller graph for this function:

static void jsonChildren::reserve2 ( jsonChildren *&  mine,
json_index_t  amount 
)
static
childrenVirtual void jsonChildren::shrink ( )
inline

References array, JSON_ASSERT, JSON_TEXT, json_unlikely, mycapacity, and mysize.

249  {
250  JSON_ASSERT(this != 0, JSON_TEXT("Children is null shrink"));
251  if (json_unlikely(mysize == 0)){ //size is zero, we should completely free the array
252  libjson_free<JSONNode*>(array); //free does checks for a null pointer, so don't bother checking
253  array = 0;
254  #ifdef JSON_LESS_MEMORY
255  } else { //need to shrink it, using realloc
256  JSON_ASSERT(array != 0, JSON_TEXT("shrinking a null array that is not size 0"));
257  array = json_realloc<JSONNode*>(array, mysize);
258  #endif
259  }
260  mycapacity = mysize;
261  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define json_unlikely(x)
Definition: Unknown_C.h:17
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283
childrenVirtual void jsonChildren::shrink ( )
inline

References array, JSON_ASSERT, JSON_TEXT, json_unlikely, mycapacity, and mysize.

Referenced by erase().

249  {
250  JSON_ASSERT(this != 0, JSON_TEXT("Children is null shrink"));
251  if (json_unlikely(mysize == 0)){ //size is zero, we should completely free the array
252  libjson_free<JSONNode*>(array); //free does checks for a null pointer, so don't bother checking
253  array = 0;
254  #ifdef JSON_LESS_MEMORY
255  } else { //need to shrink it, using realloc
256  JSON_ASSERT(array != 0, JSON_TEXT("shrinking a null array that is not size 0"));
257  array = json_realloc<JSONNode*>(array, mysize);
258  #endif
259  }
260  mycapacity = mysize;
261  }
JSONNode ** array
Definition: JSONChildren.h:281
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define json_unlikely(x)
Definition: Unknown_C.h:17
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mycapacity
Definition: JSONChildren.h:284
json_index_t mysize
Definition: JSONChildren.h:283

Here is the caller graph for this function:

json_index_t jsonChildren::size ( void  ) const
inline

References JSON_ASSERT, JSON_TEXT, and mysize.

104  {
105  JSON_ASSERT(this != 0, JSON_TEXT("Children is null size"));
106  return mysize;
107  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283
json_index_t jsonChildren::size ( void  ) const
inline

References JSON_ASSERT, JSON_TEXT, and mysize.

104  {
105  JSON_ASSERT(this != 0, JSON_TEXT("Children is null size"));
106  return mysize;
107  }
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
#define JSON_ASSERT(condition, msg)
Definition: JSONDebug.h:53
json_index_t mysize
Definition: JSONChildren.h:283

Member Data Documentation

JSONNode ** jsonChildren::array
json_index_t jsonChildren::mycapacity
json_index_t jsonChildren::mysize

The documentation for this class was generated from the following files: