NCBI C++ ToolKit
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
xslt::xpath_object Class Reference

Search Toolkit Book for xslt::xpath_object

The xslt::xpath_object class is used to store extension function arguments and return values. More...

#include <misc/xmlwrapp/xpath_object.hpp>

+ Collaboration diagram for xslt::xpath_object:

Public Types

typedef std::vector< xml::nodetype_node_source
 Source of nodes to construct xpath_object of the nodeset type. More...
 

Public Member Functions

 xpath_object ()
 Create a new xslt::xpath_object object. More...
 
 ~xpath_object ()
 Destroy the object and clean up the memory. More...
 
 xpath_object (const xpath_object &other)
 Create a new xslt::xpath_object object using another as a template. More...
 
xpath_objectoperator= (const xpath_object &other)
 Create a copy of the xslt::xpath_object object. More...
 
 xpath_object (xpath_object &&other)
 Moving constructor. More...
 
xpath_objectoperator= (xpath_object &&other)
 Moving assignment. More...
 
 xpath_object (const char *value)
 Create a new xslt::xpath_object object of the string type. More...
 
 xpath_object (bool value)
 Create a new xslt::xpath_object object of the bool type. More...
 
 xpath_object (int value)
 Create a new xslt::xpath_object object of the integer type. More...
 
 xpath_object (double value)
 Create a new xslt::xpath_object object of the float type. More...
 
 xpath_object (const xml::node &value)
 Create a new xslt::xpath_object object of the node type. More...
 
 xpath_object (const xml::node_set &value)
 Create a new xslt::xpath_object of the nodeset type. More...
 
 xpath_object (const type_node_source &value)
 Create a new xslt::xpath_object of the nodeset type. More...
 
std::string get_as_string (void) const
 Provide the object value as a string. More...
 
bool get_as_bool (void) const
 Provide the object value as a boolean. More...
 
int get_as_int (void) const
 Provide the object value as an integer. More...
 
double get_as_float (void) const
 Provide the object value as a float. More...
 
xml::nodeget_as_node (void) const
 Provide the object value as a node. More...
 
xml::node_set get_as_node_set (void) const
 Provide the object value as a node set. More...
 
xpath_object_type get_type (void) const
 Provides the object type. More...
 

Private Member Functions

void * get_object (void) const
 
void revoke_ownership (void) const
 
void set_from_xslt (void) const
 
bool get_from_xslt (void) const
 
void test_int_convertability (double val) const
 
 xpath_object (void *)
 
friend void ::xslt_ext_func_cb (void *, int)
 

Private Attributes

impl::xpath_obj_implpimpl_
 

Friends

class extension_function
 
class extension_element
 

Detailed Description

The xslt::xpath_object class is used to store extension function arguments and return values.

Definition at line 73 of file xpath_object.hpp.

Member Typedef Documentation

◆ type_node_source

Source of nodes to construct xpath_object of the nodeset type.

Definition at line 77 of file xpath_object.hpp.

Constructor & Destructor Documentation

◆ xpath_object() [1/11]

xslt::xpath_object::xpath_object ( )

Create a new xslt::xpath_object object.

Definition at line 112 of file xpath_object.cpp.

References pimpl_.

◆ ~xpath_object()

xslt::xpath_object::~xpath_object ( )

Destroy the object and clean up the memory.

Definition at line 119 of file xpath_object.cpp.

References xslt::impl::xpath_obj_impl::dec_ref(), NULL, and pimpl_.

◆ xpath_object() [2/11]

xslt::xpath_object::xpath_object ( const xpath_object other)

Create a new xslt::xpath_object object using another as a template.

The new object refers to the same xpath_object as the template one.

Parameters
otherAnother xslt::xpath_object object.

Definition at line 125 of file xpath_object.cpp.

References xslt::impl::xpath_obj_impl::inc_ref(), and pimpl_.

◆ xpath_object() [3/11]

xslt::xpath_object::xpath_object ( xpath_object &&  other)

Moving constructor.

Parameters
otherThe other xpath object.

Definition at line 141 of file xpath_object.cpp.

References NULL.

◆ xpath_object() [4/11]

xslt::xpath_object::xpath_object ( const char *  value)

Create a new xslt::xpath_object object of the string type.

Parameters
valueString to be used as the xpath_object value.

Definition at line 158 of file xpath_object.cpp.

References NULL, pimpl_, and rapidjson::value.

◆ xpath_object() [5/11]

xslt::xpath_object::xpath_object ( bool  value)

Create a new xslt::xpath_object object of the bool type.

Parameters
valueBoolean to be used as the xpath_object value.

Definition at line 180 of file xpath_object.cpp.

References NULL, pimpl_, and rapidjson::value.

◆ xpath_object() [6/11]

xslt::xpath_object::xpath_object ( int  value)

Create a new xslt::xpath_object object of the integer type.

Parameters
valueInteger to be used as the xpath_object value.

Definition at line 195 of file xpath_object.cpp.

References NULL, pimpl_, and rapidjson::value.

◆ xpath_object() [7/11]

xslt::xpath_object::xpath_object ( double  value)

Create a new xslt::xpath_object object of the float type.

Parameters
valueDouble to be used as the xpath_object value.

Definition at line 210 of file xpath_object.cpp.

References NULL, pimpl_, and rapidjson::value.

◆ xpath_object() [8/11]

xslt::xpath_object::xpath_object ( const xml::node value)

Create a new xslt::xpath_object object of the node type.

Parameters
valuexml::node to be used as the xpath_object value.

Definition at line 225 of file xpath_object.cpp.

References xslt::init::get_allow_extension_functions_leak(), xml::node::get_node_data(), xslt::kCouldNotCopyNode, NULL, and pimpl_.

◆ xpath_object() [9/11]

xslt::xpath_object::xpath_object ( const xml::node_set value)

◆ xpath_object() [10/11]

xslt::xpath_object::xpath_object ( const type_node_source value)

Create a new xslt::xpath_object of the nodeset type.

Parameters
valuecontainer of nodes as a source of nodes.

Definition at line 319 of file xpath_object.cpp.

References xslt::init::get_allow_extension_functions_leak(), xslt::kCouldNotCopyNode, xslt::kCouldNotCreateNodeSet, xslt::kCouldNotCreateXpathNodeSet, NULL, pimpl_, and rapidjson::value.

◆ xpath_object() [11/11]

xslt::xpath_object::xpath_object ( void *  raw_object)
private

Definition at line 560 of file xpath_object.cpp.

Member Function Documentation

◆ get_as_bool()

bool xslt::xpath_object::get_as_bool ( void  ) const

Provide the object value as a boolean.

It tries to make a conversion if needed.

Returns
The stored or converted value.
Exceptions
Throwsxslt::exception in case of problems.

Definition at line 398 of file xpath_object.cpp.

References copy(), xslt::kCannotCopyXpathObject, xslt::kUninitialisedObject, NULL, xslt::impl::xpath_obj_impl::obj_, and pimpl_.

◆ get_as_float()

double xslt::xpath_object::get_as_float ( void  ) const

Provide the object value as a float.

It tries to make a conversion if needed.

Returns
The stored or converted value.
Exceptions
Throwsxslt::exception in case of problems.

Definition at line 449 of file xpath_object.cpp.

References copy(), xslt::kCannotCopyXpathObject, xslt::kConverToNumberFailed, xslt::kUninitialisedObject, NULL, xslt::impl::xpath_obj_impl::obj_, and pimpl_.

◆ get_as_int()

int xslt::xpath_object::get_as_int ( void  ) const

Provide the object value as an integer.

It tries to make a conversion if needed.

Returns
The stored or converted value.
Exceptions
Throwsxslt::exception in case of problems.

Definition at line 419 of file xpath_object.cpp.

References copy(), xslt::kCannotCopyXpathObject, xslt::kConverToNumberFailed, xslt::kUninitialisedObject, NULL, xslt::impl::xpath_obj_impl::obj_, pimpl_, and test_int_convertability().

◆ get_as_node()

xml::node & xslt::xpath_object::get_as_node ( void  ) const

Provide the object value as a node.

Returns
A reference to a node. If there were many nodes in the result set then a reference to the first one is provided.
Exceptions
Throwsxslt::exception in case of problems.

Definition at line 470 of file xpath_object.cpp.

References xml::node_set::begin(), xslt::kUnexpectedXpathObjectType, xslt::kUninitialisedObject, NULL, xslt::impl::xpath_obj_impl::obj_, xml::node_set::pimpl_, pimpl_, and xml::impl::nset_impl::set_ownership().

◆ get_as_node_set()

xml::node_set xslt::xpath_object::get_as_node_set ( void  ) const

Provide the object value as a node set.

Returns
A set of nodes.
Exceptions
Throwsxslt::exception in case of problems.

Definition at line 489 of file xpath_object.cpp.

References xslt::kUnexpectedXpathObjectType, xslt::kUninitialisedObject, NULL, xslt::impl::xpath_obj_impl::obj_, xml::node_set::pimpl_, pimpl_, and xml::impl::nset_impl::set_ownership().

◆ get_as_string()

std::string xslt::xpath_object::get_as_string ( void  ) const

Provide the object value as a string.

It tries to make a conversion if needed.

Returns
The stored or converted value.
Exceptions
Throwsxslt::exception in case of problems.

Definition at line 377 of file xpath_object.cpp.

References copy(), xslt::kCannotCopyXpathObject, xslt::kUninitialisedObject, NULL, xslt::impl::xpath_obj_impl::obj_, pimpl_, and string.

◆ get_from_xslt()

bool xslt::xpath_object::get_from_xslt ( void  ) const
private

◆ get_object()

void * xslt::xpath_object::get_object ( void  ) const
private

◆ get_type()

xpath_object_type xslt::xpath_object::get_type ( void  ) const

Provides the object type.

Returns
The type of the stored value.
Exceptions
Throwsxslt::exception in case of problems.

Definition at line 504 of file xpath_object.cpp.

References xslt::kUninitialisedObject, NULL, xslt::impl::xpath_obj_impl::obj_, pimpl_, xslt::type_boolean, xslt::type_nodeset, xslt::type_not_implemented, xslt::type_number, xslt::type_string, and xslt::type_undefined.

◆ operator=() [1/2]

xpath_object & xslt::xpath_object::operator= ( const xpath_object other)

Create a copy of the xslt::xpath_object object.

The copy refers to the same xpath_object as the given object.

Parameters
otherAnother xslt::xpath_object object.

Definition at line 131 of file xpath_object.cpp.

References xslt::impl::xpath_obj_impl::dec_ref(), xslt::impl::xpath_obj_impl::inc_ref(), and pimpl_.

◆ operator=() [2/2]

xpath_object & xslt::xpath_object::operator= ( xpath_object &&  other)

Moving assignment.

Parameters
otherThe other xpath object.

Definition at line 147 of file xpath_object.cpp.

References xslt::impl::xpath_obj_impl::dec_ref(), NULL, and pimpl_.

◆ revoke_ownership()

void xslt::xpath_object::revoke_ownership ( void  ) const
private

◆ set_from_xslt()

void xslt::xpath_object::set_from_xslt ( void  ) const
private

Definition at line 540 of file xpath_object.cpp.

References xslt::impl::xpath_obj_impl::from_xslt_, and pimpl_.

◆ test_int_convertability()

void xslt::xpath_object::test_int_convertability ( double  val) const
private

Definition at line 550 of file xpath_object.cpp.

References isnan, and val.

Referenced by get_as_int().

◆ void ::xslt_ext_func_cb()

xslt::xpath_object::void ::xslt_ext_func_cb ( void *  ,
int   
)
private

Friends And Related Function Documentation

◆ extension_element

friend class extension_element
friend

Definition at line 240 of file xpath_object.hpp.

◆ extension_function

friend class extension_function
friend

Definition at line 239 of file xpath_object.hpp.

Member Data Documentation

◆ pimpl_

impl::xpath_obj_impl* xslt::xpath_object::pimpl_
private

The documentation for this class was generated from the following files:
Modified on Fri Jun 07 13:30:29 2024 by modify_doxy.py rev. 669887