Urho3D
Public Member Functions | Private Attributes | List of all members
Urho3D::XPathQuery Class Reference

XPath query. More...

#include </home/runner/work/urho3d-doxygen.github.io/urho3d-doxygen.github.io/urho3d_repo/Source/Urho3D/Resource/XMLElement.h>

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
 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().
 
String GetQuery () const
 Return query string.
 
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.
 
std::unique_ptr< pugi::xpath_query > query_
 Pugixml xpath_query.
 
std::unique_ptr< pugi::xpath_variable_set > variables_
 Pugixml xpath_variable_set.
 

Detailed Description

XPath query.


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