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.

: _type(xpath_node_set::type_unsorted), _begin(0), _end(0), _eos(0)
{
}
xpath_node_set_raw::_type
xpath_node_set::type_t _type
Definition pugixml.cpp:7341
xpath_node_set_raw::_eos
xpath_node * _eos
Definition pugixml.cpp:7345
xpath_node_set_raw::_begin
xpath_node * _begin
Definition pugixml.cpp:7343
xpath_node_set_raw::_end
xpath_node * _end
Definition pugixml.cpp:7344

## 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.

{
size_t size_ = static_cast<size_t>(_end - _begin);
size_t capacity = static_cast<size_t>(_eos - _begin);
size_t count = static_cast<size_t>(end_ - begin_);
if (size_ + count > capacity)
{
// reallocate the old array or allocate a new one
xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), (size_ + count) * sizeof(xpath_node)));
assert(data);
// finalize
_begin = data;
_end = data + size_;
_eos = data + size_ + count;
}
memcpy(_end, begin_, count * sizeof(xpath_node));
_end += count;
}
xpath_allocator::reallocate
void * reallocate(void *ptr, size_t old_size, size_t new_size)
Definition pugixml.cpp:6267

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

Definition at line 7352 of file pugixml.cpp.

{
return _begin;
}

References _begin.

Referenced by xpath_ast_node::apply_predicate(), xpath_ast_node::compare_eq(), xpath_ast_node::compare_rel(), xpath_ast_node::eval_node_set(), xpath_ast_node::eval_number(), and xpath_ast_node::step_do().

## empty()

bool xpath_node_set_raw::empty | ( |  | ) | const

inline

Definition at line 7362 of file pugixml.cpp.

{
return _begin == _end;
}

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

Definition at line 7357 of file pugixml.cpp.

{
return _end;
}

References _end.

Referenced by xpath_ast_node::apply_predicate(), xpath_ast_node::compare_eq(), xpath_ast_node::compare_rel(), xpath_ast_node::eval_node_set(), xpath_ast_node::eval_number(), and xpath_ast_node::step_do().

## first()

xpath_node xpath_node_set_raw::first | ( |  | ) | const

inline

Definition at line 7372 of file pugixml.cpp.

{
return xpath_first(_begin, _end, _type);
}
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

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.

{
if (_end == _eos)
{
size_t capacity = static_cast<size_t>(_eos - _begin);
// get new capacity (1.5x rule)
size_t new_capacity = capacity + capacity / 2 + 1;
// reallocate the old array or allocate a new one
xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), new_capacity * sizeof(xpath_node)));
assert(data);
// finalize
_begin = data;
_end = data + capacity;
_eos = data + new_capacity;
}
*_end++ = node;
}

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

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

## remove_duplicates()

void xpath_node_set_raw::remove_duplicates | ( |  | ) |

inline

Definition at line 7433 of file pugixml.cpp.

{
if (_type == xpath_node_set::type_unsorted)
sort(_begin, _end, duplicate_comparator());
_end = unique(_begin, _end);
}
sort
void sort(I begin, I end, const Pred &pred)
Definition pugixml.cpp:6153
unique
I unique(I begin, I end)
Definition pugixml.cpp:6014
duplicate_comparator
Definition pugixml.cpp:6746

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.

{
_type = value;
}

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.

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

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.

{
_type = xpath_sort(_begin, _end, _type, false);
}
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

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.

{
assert(_begin <= pos && pos <= _end);
_end = pos;
}

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.

{
return _type;
}

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:

- pugixml.cpp