Urho3D::XPathQuery Class Reference

XPath query. More...

#include <Urho3D/Resource/XMLElement.h>

Collaboration diagram for Urho3D::XPathQuery:
[legend]

Public Member Functions

 XPathQuery ()
 Construct empty.
 
 XPathQuery (const String &queryString, const String &variableString=String::EMPTY)
 Construct XPath query object with query string and variable string. The variable string format is "name1:type1,name2:type2,..." where type is one of "Bool", "Float", "String", "ResultSet".
 
 ~XPathQuery ()
 Destruct.
 
void Bind ()
 Bind query object with variable set.
 
bool SetVariable (const String &name, bool value)
 Add/Set a bool variable. Return true if successful.
 
bool SetVariable (const String &name, float value)
 Add/Set a float variable. Return true if successful.
 
bool SetVariable (const String &name, const String &value)
 Add/Set a string variable. Return true if successful.
 
bool SetVariable (const char *name, const char *value)
 Add/Set a string variable. Return true if successful.
 
bool SetVariable (const String &name, const XPathResultSet &value)
 Add/Set an XPath query result set variable. Return true if successful.
 
bool SetQuery (const String &queryString, const String &variableString=String::EMPTY, bool bind=true)
 Set XPath query string and variable string. The variable string format is "name1:type1,name2:type2,..." where type is one of "Bool", "Float", "String", "ResultSet".
 
void Clear ()
 Clear by removing all variables and XPath query object.
 
bool EvaluateToBool (const XMLElement &element) const
 Evaluate XPath query and expecting a boolean return value.
 
float EvaluateToFloat (const XMLElement &element) const
 Evaluate XPath query and expecting a float return value.
 
String EvaluateToString (const XMLElement &element) const
 Evaluate XPath query and expecting a string return value.
 
XPathResultSet Evaluate (const XMLElement &element) const
 
String GetQuery () const
 
pugi::xpath_query * GetXPathQuery () const
 Return pugixml xpath_query.
 
pugi::xpath_variable_set * GetXPathVariableSet () const
 Return pugixml xpath_variable_set.
 

Private Attributes

String queryString_
 XPath query string.
 
UniquePtr< pugi::xpath_query > query_
 Pugixml xpath_query.
 
UniquePtr< pugi::xpath_variable_set > variables_
 Pugixml xpath_variable_set.
 

Detailed Description

XPath query.

Member Function Documentation

◆ Evaluate()

XPathResultSet Urho3D::XPathQuery::Evaluate ( const XMLElement element) const

Evaluate XPath query and expecting an XPath query result set as return value. Note: The XPathResultSet return value must be stored in a lhs variable to ensure the underlying xpath_node_set* is still valid while performing XPathResultSet::FirstResult(), XPathResultSet::operator [], and XMLElement::NextResult().

Here is the call graph for this function:

◆ GetQuery()

String Urho3D::XPathQuery::GetQuery ( ) const
inline

Return query string.


The documentation for this class was generated from the following files:
  • Source/Urho3D/Resource/XMLElement.h
  • Source/Urho3D/Resource/XMLElement.cpp