Public Member Functions | Private Attributes | List of all members
xpath_node_set_raw Class Reference

Public Member Functions

 xpath_node_set_raw ()
 
xpath_node * begin () const
 
xpath_node * end () const
 
bool empty () const
 
size_t size () const
 
xpath_node first () const
 
void push_back (const xpath_node &node, xpath_allocator *alloc)
 
void append (const xpath_node *begin_, const xpath_node *end_, xpath_allocator *alloc)
 
void sort_do ()
 
void truncate (xpath_node *pos)
 
void remove_duplicates ()
 
xpath_node_set::type_t type () const
 
void set_type (xpath_node_set::type_t value)
 

Private Attributes

xpath_node_set::type_t _type
 
xpath_node * _begin
 
xpath_node * _end
 
xpath_node * _eos
 

Detailed Description

Definition at line 7339 of file pugixml.cpp.

Constructor & Destructor Documentation

◆ xpath_node_set_raw()

xpath_node_set_raw::xpath_node_set_raw ( )
inline

Definition at line 7348 of file pugixml.cpp.

7348  : _type(xpath_node_set::type_unsorted), _begin(0), _end(0), _eos(0)
7349  {
7350  }

Member Function Documentation

◆ append()

void xpath_node_set_raw::append ( const xpath_node *  begin_,
const xpath_node *  end_,
xpath_allocator alloc 
)
inline

Definition at line 7399 of file pugixml.cpp.

7400  {
7401  size_t size_ = static_cast<size_t>(_end - _begin);
7402  size_t capacity = static_cast<size_t>(_eos - _begin);
7403  size_t count = static_cast<size_t>(end_ - begin_);
7404 
7405  if (size_ + count > capacity)
7406  {
7407  // reallocate the old array or allocate a new one
7408  xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), (size_ + count) * sizeof(xpath_node)));
7409  assert(data);
7410 
7411  // finalize
7412  _begin = data;
7413  _end = data + size_;
7414  _eos = data + size_ + count;
7415  }
7416 
7417  memcpy(_end, begin_, count * sizeof(xpath_node));
7418  _end += count;
7419  }

References _begin, _end, _eos, and xpath_allocator::reallocate().

Referenced by xpath_ast_node::eval_node_set().

◆ begin()

xpath_node* xpath_node_set_raw::begin ( ) const
inline

◆ empty()

bool xpath_node_set_raw::empty ( ) const
inline

Definition at line 7362 of file pugixml.cpp.

7363  {
7364  return _begin == _end;
7365  }

References _begin, and _end.

Referenced by xpath_ast_node::eval_boolean(), and xpath_ast_node::eval_string().

◆ end()

xpath_node* xpath_node_set_raw::end ( ) const
inline

◆ first()

xpath_node xpath_node_set_raw::first ( ) const
inline

Definition at line 7372 of file pugixml.cpp.

7373  {
7374  return xpath_first(_begin, _end, _type);
7375  }

References _begin, _end, _type, and xpath_first().

Referenced by xpath_ast_node::eval_string().

◆ push_back()

void xpath_node_set_raw::push_back ( const xpath_node &  node,
xpath_allocator alloc 
)
inline

Definition at line 7377 of file pugixml.cpp.

7378  {
7379  if (_end == _eos)
7380  {
7381  size_t capacity = static_cast<size_t>(_eos - _begin);
7382 
7383  // get new capacity (1.5x rule)
7384  size_t new_capacity = capacity + capacity / 2 + 1;
7385 
7386  // reallocate the old array or allocate a new one
7387  xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), new_capacity * sizeof(xpath_node)));
7388  assert(data);
7389 
7390  // finalize
7391  _begin = data;
7392  _end = data + capacity;
7393  _eos = data + new_capacity;
7394  }
7395 
7396  *_end++ = node;
7397  }

References _begin, _end, _eos, and xpath_allocator::reallocate().

Referenced by xpath_ast_node::eval_node_set(), and xpath_ast_node::step_push().

◆ remove_duplicates()

void xpath_node_set_raw::remove_duplicates ( )
inline

Definition at line 7433 of file pugixml.cpp.

7434  {
7435  if (_type == xpath_node_set::type_unsorted)
7437 
7438  _end = unique(_begin, _end);
7439  }

References _begin, _end, _type, sort(), and unique().

Referenced by xpath_ast_node::eval_node_set(), and xpath_ast_node::step_do().

◆ set_type()

void xpath_node_set_raw::set_type ( xpath_node_set::type_t  value)
inline

Definition at line 7446 of file pugixml.cpp.

7447  {
7448  _type = value;
7449  }

References _type.

Referenced by xpath_ast_node::eval_node_set(), and xpath_ast_node::step_do().

◆ size()

size_t xpath_node_set_raw::size ( ) const
inline

Definition at line 7367 of file pugixml.cpp.

7368  {
7369  return static_cast<size_t>(_end - _begin);
7370  }

References _begin, and _end.

Referenced by xpath_ast_node::apply_predicate(), xpath_ast_node::apply_predicates(), xpath_ast_node::eval_number(), and xpath_ast_node::step_do().

◆ sort_do()

void xpath_node_set_raw::sort_do ( )
inline

Definition at line 7421 of file pugixml.cpp.

7422  {
7423  _type = xpath_sort(_begin, _end, _type, false);
7424  }

References _begin, _end, _type, and xpath_sort().

Referenced by xpath_ast_node::eval_node_set().

◆ truncate()

void xpath_node_set_raw::truncate ( xpath_node *  pos)
inline

Definition at line 7426 of file pugixml.cpp.

7427  {
7428  assert(_begin <= pos && pos <= _end);
7429 
7430  _end = pos;
7431  }

References _begin, and _end.

Referenced by xpath_ast_node::apply_predicate().

◆ type()

xpath_node_set::type_t xpath_node_set_raw::type ( ) const
inline

Definition at line 7441 of file pugixml.cpp.

7442  {
7443  return _type;
7444  }

References _type.

Referenced by xpath_ast_node::step_do().

Member Data Documentation

◆ _begin

xpath_node* xpath_node_set_raw::_begin
private

Definition at line 7343 of file pugixml.cpp.

Referenced by append(), begin(), empty(), first(), push_back(), remove_duplicates(), size(), sort_do(), and truncate().

◆ _end

xpath_node* xpath_node_set_raw::_end
private

Definition at line 7344 of file pugixml.cpp.

Referenced by append(), empty(), end(), first(), push_back(), remove_duplicates(), size(), sort_do(), and truncate().

◆ _eos

xpath_node* xpath_node_set_raw::_eos
private

Definition at line 7345 of file pugixml.cpp.

Referenced by append(), and push_back().

◆ _type

xpath_node_set::type_t xpath_node_set_raw::_type
private

Definition at line 7341 of file pugixml.cpp.

Referenced by first(), remove_duplicates(), set_type(), sort_do(), and type().


The documentation for this class was generated from the following file:
unique
I unique(I begin, I end)
Definition: pugixml.cpp:6014
xpath_node_set_raw::_type
xpath_node_set::type_t _type
Definition: pugixml.cpp:7341
xpath_node_set_raw::_end
xpath_node * _end
Definition: pugixml.cpp:7344
sort
void sort(I begin, I end, const Pred &pred)
Definition: pugixml.cpp:6153
xpath_node_set_raw::_begin
xpath_node * _begin
Definition: pugixml.cpp:7343
xpath_allocator::reallocate
void * reallocate(void *ptr, size_t old_size, size_t new_size)
Definition: pugixml.cpp:6267
xpath_first
PUGI__FN xpath_node xpath_first(const xpath_node *begin, const xpath_node *end, xpath_node_set::type_t type)
Definition: pugixml.cpp:7318
duplicate_comparator
Definition: pugixml.cpp:6745
xpath_sort
PUGI__NS_END PUGI__NS_BEGIN PUGI__FN xpath_node_set::type_t xpath_sort(xpath_node *begin, xpath_node *end, xpath_node_set::type_t type, bool rev)
Definition: pugixml.cpp:7302
xpath_node_set_raw::_eos
xpath_node * _eos
Definition: pugixml.cpp:7345

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001