Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | List of all members
Mezzanine::XML::XPathQuery Class Reference

A compiled XPath query object. More...

#include <xpathquery.h>

Public Member Functions

 XPathQuery (const Char8 *query, XPathVariableSet *variables=0)
 Construct a compiled object from XPath expression. More...
 
 ~XPathQuery ()
 Destructor.
 
bool EvaluateBoole (const XPathNode &n) const
 Evaluate expression as boolean value in the specified context; performs Type conversion if necessary. More...
 
XPathNodeSet EvaluateNodeSet (const XPathNode &n) const
 Evaluate expression as node set in the specified context. More...
 
double EvaluateNumber (const XPathNode &n) const
 Evaluate expression as double value in the specified context; performs Type conversion if necessary. More...
 
String EvaluateString (const XPathNode &n) const
 Evaluate expression as string value in the specified context; performs Type conversion if necessary. More...
 
size_t EvaluateString (Char8 *buffer, size_t capacity, const XPathNode &n) const
 Evaluate expression as string value in the specified context; performs Type conversion if necessary. More...
 
 operator unspecified_bool_type () const
 Used to convert this to a boolean value in a safe way. More...
 
bool operator! () const
 Logical not operator, used a workaround for borland compiler. More...
 
const XPathParseResultResult () const
 Get parsing Result (used to get compilation errors when XML_NO_EXCEPTIONS is enabled) More...
 
XPathValueType ReturnType () const
 Get query expression return Type. More...
 

Detailed Description

A compiled XPath query object.

When you call XML::Node::FindNodes with an expression string as an argument, a query object is created behind the scenes. A query object represents a compiled XPath expression. Query objects can be needed in the following circumstances:

Definition at line 91 of file xpathquery.h.

Constructor & Destructor Documentation

Mezzanine::XML::XPathQuery::XPathQuery ( const Char8 query,
XPathVariableSet variables = 0 
)
explicit

Construct a compiled object from XPath expression.

Parameters
queryThe query in the form of a c-string style char_t array.
variablesAny extra data the query might need, passing a null pointer simply omits passing any arguments.
Exceptions
ThrowsXPathException on compilation errors.

Member Function Documentation

bool Mezzanine::XML::XPathQuery::EvaluateBoole ( const XPathNode n) const

Evaluate expression as boolean value in the specified context; performs Type conversion if necessary.

Returns
A bool result of evaluating the expression.
Exceptions
IfXML_NO_EXCEPTIONS is not defined (by default it is not defined), throws std::bad_alloc on out of memory errors.
Parameters
nThe XPathNode that will serve as the context for the query.
XPathNodeSet Mezzanine::XML::XPathQuery::EvaluateNodeSet ( const XPathNode n) const

Evaluate expression as node set in the specified context.

Parameters
nThe XPathNode that with serve as the context for the query.
Returns
An XPathNodeSet.
double Mezzanine::XML::XPathQuery::EvaluateNumber ( const XPathNode n) const

Evaluate expression as double value in the specified context; performs Type conversion if necessary.

Parameters
nThe XPathNode that will serve as the context for the query.
Exceptions
Throwsstd::bad_alloc on out of memory errors.
Returns
A result as a double from evaluating the expression.
String Mezzanine::XML::XPathQuery::EvaluateString ( const XPathNode n) const

Evaluate expression as string value in the specified context; performs Type conversion if necessary.

Parameters
nThe XPathNode that will serve as the context for the query.
Exceptions
Throwsstd::bad_alloc on out of memory errors.
Returns
A result as a String from evaluating the expression.
size_t Mezzanine::XML::XPathQuery::EvaluateString ( Char8 buffer,
size_t  capacity,
const XPathNode n 
) const

Evaluate expression as string value in the specified context; performs Type conversion if necessary.

Parameters
bufferThe place to store the c-style Character array
capacityAt most capacity characters are written to the destination buffer.
nThe XPathNode that with serve as the context for the query.
Exceptions
std::bad_allocon out of memory errors.
Returns
Full result size is returned (includes terminating zero).
Mezzanine::XML::XPathQuery::operator unspecified_bool_type ( ) const

Used to convert this to a boolean value in a safe way.

Returns
Returns true if the internal data is set and false otherwise.
bool Mezzanine::XML::XPathQuery::operator! ( ) const

Logical not operator, used a workaround for borland compiler.

Returns
A bool that is the opposite of evaluatig this as a bool normally.
const XPathParseResult& Mezzanine::XML::XPathQuery::Result ( ) const

Get parsing Result (used to get compilation errors when XML_NO_EXCEPTIONS is enabled)

Returns
A const reference to an XPathParseResult.
XPathValueType Mezzanine::XML::XPathQuery::ReturnType ( ) const

Get query expression return Type.

Returns
A XPathValueType.

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