MCPcopy Create free account
hub / github.com/WheretIB/nullc / xpath_node_set_raw

Class xpath_node_set_raw

external/pugixml/pugixml.cpp:6181–6292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6179 }
6180 }
6181 class xpath_node_set_raw
6182 {
6183 xpath_node_set::type_t _type;
6184
6185 xpath_node* _begin;
6186 xpath_node* _end;
6187 xpath_node* _eos;
6188
6189 public:
6190 xpath_node_set_raw(): _type(xpath_node_set::type_unsorted), _begin(0), _end(0), _eos(0)
6191 {
6192 }
6193
6194 xpath_node* begin() const
6195 {
6196 return _begin;
6197 }
6198
6199 xpath_node* end() const
6200 {
6201 return _end;
6202 }
6203
6204 bool empty() const
6205 {
6206 return _begin == _end;
6207 }
6208
6209 size_t size() const
6210 {
6211 return static_cast<size_t>(_end - _begin);
6212 }
6213
6214 xpath_node first() const
6215 {
6216 return xpath_first(_begin, _end, _type);
6217 }
6218
6219 void push_back(const xpath_node& node, xpath_allocator* alloc)
6220 {
6221 if (_end == _eos)
6222 {
6223 size_t capacity = static_cast<size_t>(_eos - _begin);
6224
6225 // get new capacity (1.5x rule)
6226 size_t new_capacity = capacity + capacity / 2 + 1;
6227
6228 // reallocate the old array or allocate a new one
6229 xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), new_capacity * sizeof(xpath_node)));
6230 assert(data);
6231
6232 // finalize
6233 _begin = data;
6234 _end = data + capacity;
6235 _eos = data + new_capacity;
6236 }
6237
6238 *_end++ = node;

Callers 1

eval_node_setMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected