Dry
|
XPath query. More...
#include <Dry/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 |
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. | |
UniquePtr< pugi::xpath_query > | query_ |
Pugixml xpath_query. | |
UniquePtr< pugi::xpath_variable_set > | variables_ |
Pugixml xpath_variable_set. | |
XPath query.
XPathResultSet Dry::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().