NCBI C++ ToolKit
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
xml::attributes::attr Class Reference

Search Toolkit Book for xml::attributes::attr

The xml::attributes::attr class is used to hold information about one attribute. More...

#include <misc/xmlwrapp/attributes.hpp>

+ Collaboration diagram for xml::attributes::attr:

Public Member Functions

bool is_default (void) const
 Test if the attribute is default. More...
 
const char * get_name (void) const
 Get the name of this attribute. More...
 
const char * get_value (void) const
 Get the value of this attribute. More...
 
void set_value (const char *value)
 Set the value of this attribute. More...
 
ns get_namespace (ns::ns_safety_type type=ns::type_safe_ns) const
 Get the attribute's namespace. More...
 
void erase_namespace (void)
 Unset the attribute's namespace. More...
 
ns set_namespace (const char *prefix)
 Set the attribute's namespace. More...
 
ns set_namespace (const ns &name_space)
 Set the attribute's namespace. More...
 

Private Member Functions

 attr (void)
 
 attr (const attr &other)
 
attroperator= (const attr &other)
 
void swap (attr &other)
 
void set_data (void *node, void *prop, bool def_prop)
 
void * normalize (void) const
 
void * get_node (void) const
 
bool operator== (const attr &other) const
 
void convert (void)
 
void * resolve_default_attr_ns (void) const
 

Private Attributes

void * xmlnode_
 
void * prop_
 
void * phantom_prop_
 
std::string value_
 

Friends

class impl::ait_impl
 
class iterator
 
class const_iterator
 
class attributes
 
struct xml::impl::attr_instance
 
bool impl::operator== (const impl::ait_impl &lhs, const impl::ait_impl &rhs)
 
void * xml::impl::get_ptr_to_attr_instance (void *)
 

Detailed Description

The xml::attributes::attr class is used to hold information about one attribute.

Definition at line 151 of file attributes.hpp.

Constructor & Destructor Documentation

◆ attr() [1/2]

xml::attributes::attr::attr ( void  )
private

Definition at line 273 of file ait_impl.cpp.

◆ attr() [2/2]

xml::attributes::attr::attr ( const attr other)
private

Definition at line 276 of file ait_impl.cpp.

Member Function Documentation

◆ convert()

void xml::attributes::attr::convert ( void  )
private

Definition at line 422 of file ait_impl.cpp.

References kInvalidDefaultIterError, and NULL.

◆ erase_namespace()

void xml::attributes::attr::erase_namespace ( void  )

Unset the attribute's namespace.

Author
Sergey Satskiy, NCBI

Definition at line 453 of file ait_impl.cpp.

References convert(), and NULL.

◆ get_name()

const char * xml::attributes::attr::get_name ( void  ) const

Get the name of this attribute.

Returns
The name for this attribute.
Author
Peter Jones

Definition at line 335 of file ait_impl.cpp.

References kInvalidDefaultIterError.

Referenced by AddStructuredCommentToAttributes(), GetBioSampleStatusFromNode(), and ProcessBiosampleStatusNode().

◆ get_namespace()

xml::ns xml::attributes::attr::get_namespace ( ns::ns_safety_type  type = ns::type_safe_ns) const

Get the attribute's namespace.

Parameters
typeThe required type of namespace object (safe/unsafe).
Returns
The attribute's namespace ("void" namespace if the attribute has no namespace set).
Author
Sergey Satskiy, NCBI

Definition at line 380 of file ait_impl.cpp.

References xml::attributes::createUnsafeNamespace(), xml::ns::type_safe_ns, and xml::ns::type_void.

◆ get_node()

void * xml::attributes::attr::get_node ( void  ) const
private

Definition at line 320 of file ait_impl.cpp.

Referenced by xml::impl::get_ptr_to_attr_instance().

◆ get_value()

const char * xml::attributes::attr::get_value ( void  ) const

Get the value of this attribute.

Returns
The value for this attribute.
Author
Peter Jones

Definition at line 350 of file ait_impl.cpp.

References kInvalidDefaultIterError.

Referenced by AddStructuredCommentToAttributes(), GetBioSampleStatusFromNode(), CEntrezDB::GetUidAttr(), and ProcessBiosampleStatusNode().

◆ is_default()

bool xml::attributes::attr::is_default ( void  ) const

Test if the attribute is default.

Returns
true if the attribute is default
Author
Sergey Satskiy, NCBI

Definition at line 329 of file ait_impl.cpp.

Referenced by xml::attributes::erase().

◆ normalize()

void * xml::attributes::attr::normalize ( void  ) const
private

◆ operator=()

xml::attributes::attr & xml::attributes::attr::operator= ( const attr other)
private

Definition at line 281 of file ait_impl.cpp.

References xml::attributes::swap(), and tmp.

◆ operator==()

bool xml::attributes::attr::operator== ( const attr other) const
private

Definition at line 324 of file ait_impl.cpp.

◆ resolve_default_attr_ns()

void * xml::attributes::attr::resolve_default_attr_ns ( void  ) const
private

Definition at line 405 of file ait_impl.cpp.

References kInvalidDefaultIterError, and NULL.

◆ set_data()

void xml::attributes::attr::set_data ( void *  node,
void *  prop,
bool  def_prop 
)
private

Definition at line 294 of file ait_impl.cpp.

References xml::attributes::node.

Referenced by xml::impl::ait_impl::ait_impl().

◆ set_namespace() [1/2]

xml::ns xml::attributes::attr::set_namespace ( const char *  prefix)

Set the attribute's namespace.

The namespace definition is searched up in the hierarchy of nodes. If a namespace with the given prefix is not found then throw an exception.

Parameters
prefixNamespace prefix. You can use empty string or NULL to remove the namespace – it works exactly the same as erase_namespace() call.
Returns
Unsafe namespace
Author
Sergey Satskiy, NCBI

Definition at line 459 of file ait_impl.cpp.

References convert(), xml::attributes::createUnsafeNamespace(), and NULL.

◆ set_namespace() [2/2]

xml::ns xml::attributes::attr::set_namespace ( const ns name_space)

Set the attribute's namespace.

The namespace definition is searched up in the hierarchy of nodes. If a namespace with the given prefix and URI is not found then throw an exception.

Parameters
name_spaceNamespace object. You can use "void" or default namespace to remove the namespace – it works exactly the same as erase_namespace() call.
Note
There are no checks at all if an unsafe ns object is provided.
Returns
unsafe namespace
Author
Sergey Satskiy, NCBI

Definition at line 475 of file ait_impl.cpp.

References convert(), xml::attributes::createUnsafeNamespace(), xml::ns::get_prefix(), xml::ns::get_uri(), xml::attributes::getUnsafeNamespacePointer(), xml::ns::is_safe(), xml::ns::is_void(), and NULL.

◆ set_value()

void xml::attributes::attr::set_value ( const char *  value)

Set the value of this attribute.

Parameters
valueThe value for this attribute.
Note
If the value is set for the default attribute then it will be implicilty converted to a regular one and then the value will be changed.
Author
Sergey Satskiy, NCBI

Definition at line 443 of file ait_impl.cpp.

References convert(), and rapidjson::value.

◆ swap()

void xml::attributes::attr::swap ( attr other)
private

Definition at line 287 of file ait_impl.cpp.

References phantom_prop_, prop_, swap(), value_, and xmlnode_.

Referenced by xml::impl::ait_impl::operator=().

Friends And Related Function Documentation

◆ attributes

friend class attributes
friend

Definition at line 277 of file attributes.hpp.

◆ const_iterator

friend class const_iterator
friend

Definition at line 276 of file attributes.hpp.

◆ impl::ait_impl

friend class impl::ait_impl
friend

Definition at line 274 of file attributes.hpp.

◆ impl::operator==

bool impl::operator== ( const impl::ait_impl lhs,
const impl::ait_impl rhs 
)
friend

◆ iterator

friend class iterator
friend

Definition at line 275 of file attributes.hpp.

◆ xml::impl::attr_instance

friend struct xml::impl::attr_instance
friend

Definition at line 278 of file attributes.hpp.

◆ xml::impl::get_ptr_to_attr_instance

void* xml::impl::get_ptr_to_attr_instance ( void *  )
friend

Member Data Documentation

◆ phantom_prop_

void* xml::attributes::attr::phantom_prop_
private

Definition at line 258 of file attributes.hpp.

Referenced by swap().

◆ prop_

void* xml::attributes::attr::prop_
private

Definition at line 257 of file attributes.hpp.

Referenced by xml::attributes::erase(), xml::impl::ait_impl::operator++(), and swap().

◆ value_

std::string xml::attributes::attr::value_
mutableprivate

Definition at line 259 of file attributes.hpp.

Referenced by swap().

◆ xmlnode_

void* xml::attributes::attr::xmlnode_
private

Definition at line 256 of file attributes.hpp.

Referenced by xml::attributes::erase(), xml::impl::operator==(), and swap().


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:58:26 2024 by modify_doxy.py rev. 669887