Rebel Fork Framework
Urho3D::XPathQuery Class Reference

XPath query. More...

#include <Urho3D/Resource/XMLElement.h>

Public Member Functions

 XPathQuery ()
 Construct empty.
 
 XPathQuery (const ea::string &queryString, const ea::string &variableString=EMPTY_STRING)
 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 ea::string &name, bool value)
 Add/Set a bool variable. Return true if successful.
 
bool SetVariable (const ea::string &name, float value)
 Add/Set a float variable. Return true if successful.
 
bool SetVariable (const ea::string &name, const ea::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 ea::string &name, const XPathResultSet &value)
 Add/Set an XPath query result set variable. Return true if successful.
 
bool SetQuery (const ea::string &queryString, const ea::string &variableString=EMPTY_STRING, 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.
 
ea::string EvaluateToString (const XMLElement &element) const
 Evaluate XPath query and expecting a string return value.
 
XPathResultSet Evaluate (const XMLElement &element) const
 
ea::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

ea::string queryString_
 XPath query string.
 
ea::unique_ptr< pugi::xpath_query > query_
 Pugixml xpath_query.
 
ea::unique_ptr< 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().

◆ GetQuery()

ea::string Urho3D::XPathQuery::GetQuery ( ) const
inline

Return query string.


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