NCBI C++ ToolKit
|
Search Toolkit Book for xml::xpath_expression
The xml::xpath_expression class is used to store xpath query string and optional XML namespaces. More...
#include <misc/xmlwrapp/xpath_expression.hpp>
Public Types | |
enum | compile_type { type_no_compile , type_compile } |
xpath expression compilation flag More... | |
Public Member Functions | |
xpath_expression (const char *xpath, compile_type do_compile=type_no_compile) | |
Create a new xml::xpath_expression object with the given xpath expression. More... | |
xpath_expression (const char *xpath, const ns &nspace, compile_type do_compile=type_no_compile) | |
Create a new xml::xpath_expression object with the given xpath expression and a registered namespace. More... | |
xpath_expression (const char *xpath, const ns_list_type &nspace_list, compile_type do_compile=type_no_compile) | |
Create a new xml::xpath_expression object with the given xpath expression and a list of registered namespaces. More... | |
xpath_expression (const xpath_expression &other) | |
Create a new xml::xpath_expression object using another one as a template. More... | |
xpath_expression & | operator= (const xpath_expression &other) |
Create a copy of the xml::xpath_expression object. More... | |
virtual | ~xpath_expression () |
Destroy the object and clean up the memory. More... | |
void | compile () |
Precompile the expression. More... | |
const char * | get_xpath () const |
Provide the xpath expression as a string. More... | |
const ns_list_type & | get_namespaces () const |
Provide the list of the registered XML namespaces. More... | |
compile_type | get_compile_type () const |
Provide the expression pre-compilation flag. More... | |
xpath_expression (xpath_expression &&other) | |
Moving constructor. More... | |
xpath_expression & | operator= (xpath_expression &&other) |
Moving assignment. More... | |
Private Member Functions | |
void | compile_expression () |
void * | get_compiled_expression () const |
Private Attributes | |
compile_type | compile_ |
std::string | expression_ |
ns_list_type | nspace_list_ |
void * | compiled_expression_ |
Friends | |
class | node |
The xml::xpath_expression class is used to store xpath query string and optional XML namespaces.
Definition at line 57 of file xpath_expression.hpp.
xpath expression compilation flag
Enumerator | |
---|---|
type_no_compile | |
type_compile |
Definition at line 61 of file xpath_expression.hpp.
xml::xpath_expression::xpath_expression | ( | const char * | xpath, |
compile_type | do_compile = type_no_compile |
||
) |
Create a new xml::xpath_expression object with the given xpath expression.
xpath | The xpath expression. |
do_compile | Whether to compile or not the xpath expression. Default: do not. |
Throws | exceptions in case of problems |
Definition at line 57 of file xpath_expression.cpp.
References compile_expression(), expression_, and xml::kEmptyExpression.
xml::xpath_expression::xpath_expression | ( | const char * | xpath, |
const ns & | nspace, | ||
compile_type | do_compile = type_no_compile |
||
) |
Create a new xml::xpath_expression object with the given xpath expression and a registered namespace.
The namespace cannot be a default one.
xpath | The xpath expression. |
nspace | Registered namespace. |
do_compile | Whether to compile or not the xpath expression. Default: do not. |
Throws | exceptions in case of problems |
Definition at line 69 of file xpath_expression.cpp.
References compile_expression(), expression_, xml::ns::get_prefix(), xml::kDefaultNamespace, xml::kEmptyExpression, and nspace_list_.
xml::xpath_expression::xpath_expression | ( | const char * | xpath, |
const ns_list_type & | nspace_list, | ||
compile_type | do_compile = type_no_compile |
||
) |
Create a new xml::xpath_expression object with the given xpath expression and a list of registered namespaces.
The list of namespaces cannot have a default namespace.
xpath | The xpath expression. |
nspace_list | Registered namespaces. |
do_compile | Whether to compile or not the xpath expression. Default: do not. |
Throws | exceptions in case of problems |
Definition at line 88 of file xpath_expression.cpp.
References compile_expression(), expression_, xml::kDefaultNamespace, xml::kEmptyExpression, and nspace_list_.
xml::xpath_expression::xpath_expression | ( | const xpath_expression & | other | ) |
Create a new xml::xpath_expression object using another one as a template.
other | Another xml::xpath_expression object. |
Throws | exceptions in case of problems |
Definition at line 108 of file xpath_expression.cpp.
References compile_expression().
|
virtual |
Destroy the object and clean up the memory.
Definition at line 134 of file xpath_expression.cpp.
References compiled_expression_, and NULL.
xml::xpath_expression::xpath_expression | ( | xpath_expression && | other | ) |
Moving constructor.
other | The other xpath expression. |
Definition at line 143 of file xpath_expression.cpp.
References NULL.
void xml::xpath_expression::compile | ( | ) |
Precompile the expression.
Definition at line 170 of file xpath_expression.cpp.
References compile_, compile_expression(), and type_compile.
|
private |
Definition at line 203 of file xpath_expression.cpp.
References compile_, compiled_expression_, expression_, string, and type_compile.
Referenced by compile(), operator=(), and xpath_expression().
xpath_expression::compile_type xml::xpath_expression::get_compile_type | ( | ) | const |
Provide the expression pre-compilation flag.
Definition at line 191 of file xpath_expression.cpp.
References compile_.
Referenced by xml::node::evaluate_xpath_expression().
|
private |
Definition at line 197 of file xpath_expression.cpp.
References compiled_expression_.
Referenced by xml::node::evaluate_xpath_expression().
const ns_list_type & xml::xpath_expression::get_namespaces | ( | ) | const |
Provide the list of the registered XML namespaces.
Definition at line 185 of file xpath_expression.cpp.
References nspace_list_.
Referenced by xml::node::create_xpath_context().
const char * xml::xpath_expression::get_xpath | ( | ) | const |
Provide the xpath expression as a string.
Definition at line 179 of file xpath_expression.cpp.
References expression_.
Referenced by xml::node::evaluate_xpath_expression().
xpath_expression & xml::xpath_expression::operator= | ( | const xpath_expression & | other | ) |
Create a copy of the xml::xpath_expression object.
other | Another xml::xpath_expression object. |
Throws | exceptions in case of problems |
Definition at line 116 of file xpath_expression.cpp.
References compile_, compile_expression(), compiled_expression_, expression_, nspace_list_, and NULL.
xpath_expression & xml::xpath_expression::operator= | ( | xpath_expression && | other | ) |
Moving assignment.
other | The other xpath expression. |
Definition at line 153 of file xpath_expression.cpp.
References compile_, compiled_expression_, expression_, nspace_list_, and NULL.
|
friend |
Definition at line 203 of file xpath_expression.hpp.
|
private |
Definition at line 195 of file xpath_expression.hpp.
Referenced by compile(), compile_expression(), get_compile_type(), and operator=().
|
private |
Definition at line 198 of file xpath_expression.hpp.
Referenced by compile_expression(), get_compiled_expression(), operator=(), and ~xpath_expression().
|
private |
Definition at line 196 of file xpath_expression.hpp.
Referenced by compile_expression(), get_xpath(), operator=(), and xpath_expression().
|
private |
Definition at line 197 of file xpath_expression.hpp.
Referenced by get_namespaces(), operator=(), and xpath_expression().