MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
Mezzanine::XML::XPathNodeSet Class Reference

A fixed sized collection of nodes that an XPathQuery can work on. More...

#include <xpathnodeset.h>

Public Types

enum  CollectionType { TypeUnsorted, TypeSorted, TypeSortedReverse }
 The different ways a collection may or may not be ordered. More...
 
typedef const XPathNodeconst_iterator
 An iterator trait. Const iterator for XPathNodes.
 

Public Member Functions

 XPathNodeSet ()
 Default constructor. Constructs empty set.
 
 XPathNodeSet (const_iterator begin, const_iterator end, CollectionType Type=TypeUnsorted)
 Constructs a set from iterator range. More...
 
 XPathNodeSet (const XPathNodeSet &ns)
 Copy constructor/assignment operator. More...
 
 ~XPathNodeSet ()
 Destructor.
 
const_iterator begin () const
 Get Beginning iterator. More...
 
bool Empty () const
 Check if collection is empty. More...
 
const_iterator end () const
 Get Ending iterator. More...
 
XPathNode first () const
 Get first node in the collection by document order. More...
 
XPathNodeSetoperator= (const XPathNodeSet &ns)
 Assignment Operator. More...
 
const XPathNodeoperator[] (size_t index) const
 Indexing operator. More...
 
size_t size () const
 Get collection size. More...
 
void sort (bool reverse=false)
 Sort the collection in ascending/descending order by document order. More...
 
CollectionType Type () const
 Get collection Type. More...
 

Detailed Description

A fixed sized collection of nodes that an XPathQuery can work on.

Definition at line 72 of file xpathnodeset.h.

Member Enumeration Documentation

The different ways a collection may or may not be ordered.

Enumerator
TypeUnsorted 

Not ordered.

TypeSorted 

Sorted by document order (ascending)

TypeSortedReverse 

Sorted by document order (descending)

Definition at line 76 of file xpathnodeset.h.

Constructor & Destructor Documentation

Mezzanine::XML::XPathNodeSet::XPathNodeSet ( const_iterator  begin,
const_iterator  end,
CollectionType  Type = TypeUnsorted 
)

Constructs a set from iterator range.

Parameters
beginA const XPathNode iterator at the beginning of the set of nodes.
endA const XPathNode iterator at the end of the set of nodes.
TypeWhat XPathNodeSet::CollectionType is being used, this defaults to XPathNodeSet::TypeUnsorted

Data is not checked for duplicates and is not sorted according to provided Type, so be careful.

Mezzanine::XML::XPathNodeSet::XPathNodeSet ( const XPathNodeSet ns)

Copy constructor/assignment operator.

Parameters
nsThe Target to copy.

Member Function Documentation

const_iterator Mezzanine::XML::XPathNodeSet::begin ( ) const

Get Beginning iterator.

Returns
A XPathNodeSet::const_iterator to the beginning of the collection.
bool Mezzanine::XML::XPathNodeSet::Empty ( ) const

Check if collection is empty.

Returns
True if the document is empty, false otherwise.
const_iterator Mezzanine::XML::XPathNodeSet::end ( ) const

Get Ending iterator.

Returns
A XPathNodeSet::const_iterator to the end of the collection.
XPathNode Mezzanine::XML::XPathNodeSet::first ( ) const

Get first node in the collection by document order.

Returns
The first node of the, in document order as an XPathNode.
XPathNodeSet& Mezzanine::XML::XPathNodeSet::operator= ( const XPathNodeSet ns)

Assignment Operator.

Returns
A reference to the freshly assigned XPathNodeSet.
Parameters
nsThe XPathNodeSet to copy.
const XPathNode& Mezzanine::XML::XPathNodeSet::operator[] ( size_t  index) const

Indexing operator.

Parameters
indexA size_t indicating which XPathNode you would like to retrieve
Returns
A const reference to the XPathNode you requested.
Warning
Out of bounds errors are checked using assert. Exceptions will not be thrown, during debugging out of bounds access will abort the termination and in production code out of bounds accesses will cause undefined behavior.
size_t Mezzanine::XML::XPathNodeSet::size ( ) const

Get collection size.

Returns
The number of XPathNode instances as a size_t in the set
void Mezzanine::XML::XPathNodeSet::sort ( bool  reverse = false)

Sort the collection in ascending/descending order by document order.

Parameters
reverseIf true this sorts the collection in the opposite of document order.
CollectionType Mezzanine::XML::XPathNodeSet::Type ( ) const

Get collection Type.

Returns
CollectionType

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