HydraExpress™ C++ API Reference Guide

 
Loading...
Searching...
No Matches
rwsf::XmlAttributeSet Class Reference

Inserts, iterates, and searches rwsf::XmlAttribute objects in a set based on rwsf::XmlName values. More...

#include <rwsf/core/XmlAttributeSet.h>

Public Types

typedef std::list< rwsf::XmlAttribute >::const_iterator const_iterator
enum  EqualityType { Name , Value }
typedef std::list< rwsf::XmlAttribute >::iterator iterator

Public Member Functions

 XmlAttributeSet ()
 XmlAttributeSet (const XmlAttributeSet &a)
virtual ~XmlAttributeSet ()
void add (const rwsf::XmlAttribute &attr)
void add (const rwsf::XmlName &name, const std::string &value)
void addNamespaceAttribute (const rwsf::XmlNamespace &)
void clear ()
bool contains (const rwsf::XmlAttribute &attr) const
bool contains (const rwsf::XmlName &name) const
size_t entries () const
bool equalTo (const XmlAttributeSet &other, EqualityType type=Name) const
bool find (const rwsf::XmlAttribute &attr, rwsf::XmlAttribute &ret) const
bool find (const rwsf::XmlName &name, rwsf::XmlAttribute &ret) const
bool findNamespaceAttribute (const rwsf::XmlNamespace &s, rwsf::XmlAttribute &ret)
bool findNamespaceAttribute (const std::string &s, rwsf::XmlAttribute &ret)
std::string findValueByName (const std::string &attrName, bool mustExist=true) const
std::string getDefaultNamespaceAttribute () const
XmlAttributeSet::iterator getIteratorBegin () const
XmlAttributeSet::iterator getIteratorEnd () const
XmlAttributeSetoperator= (const XmlAttributeSet &a)
void remove (const rwsf::XmlAttribute &attr)
void remove (const rwsf::XmlName &name)
void removeDefaultNamespaceAttribute ()
void removeNamespaceAttribute (const rwsf::XmlNamespace &prefix)
void removeNamespaceAttribute (const std::string &s)
void setDefaultNamespaceAttribute (const rwsf::XmlAttribute &attr)
void setDefaultNamespaceAttribute (const rwsf::XmlNamespace &ns)
void setDefaultNamespaceAttribute (const std::string &s)
void unsetDefaultNamespaceAttribute ()

Detailed Description

rwsf::XmlAttributeSet is a specialized collection class for rwsf::XmlAttribute objects, providing methods for inserting, iterating, and searching based on rwsf::XmlName values. This collection is a set meaning only one rwsf::XmlAttribute per unique rwsf::XmlName is allowed.

Member Typedef Documentation

◆ const_iterator

typedef std::list<rwsf::XmlAttribute>::const_iterator rwsf::XmlAttributeSet::const_iterator

Const iterator for the collection of rwsf::XmlAttribute objects within the rwsf::XmlAttributeSet.

◆ iterator

Iterator for the collection of rwsf::XmlAttribute objects within the rwsf::XmlAttributeSet.

Member Enumeration Documentation

◆ EqualityType

Contains values for changing the comparison behavior of the equalTo() operation.

Enumerator
Name 

Requires only that the rwsf::XmlName to match for equality to be true.

Value 

Requires both the rwsf::XmlName and the value of the attribute to match equals for equality to be true.

Constructor & Destructor Documentation

◆ XmlAttributeSet() [1/2]

rwsf::XmlAttributeSet::XmlAttributeSet ( )

Default constructor. Constructs an attribute set that contains no attributes.

◆ XmlAttributeSet() [2/2]

rwsf::XmlAttributeSet::XmlAttributeSet ( const XmlAttributeSet & a)

Copy constructor. Constructs a new XmlAttributeSet from a as a deep copy.

◆ ~XmlAttributeSet()

virtual rwsf::XmlAttributeSet::~XmlAttributeSet ( )
virtual

Virtual destructor. This class is intended as a base class.

Member Function Documentation

◆ add() [1/2]

void rwsf::XmlAttributeSet::add ( const rwsf::XmlAttribute & attr)

Adds attr to self. Replaces any existing attribute with the same name as attr.

◆ add() [2/2]

void rwsf::XmlAttributeSet::add ( const rwsf::XmlName & name,
const std::string & value )

Constructs a new attribute name/value pair and adds that attribute to self. Replaces any existing attribute with a name that compares equal to name.

◆ addNamespaceAttribute()

void rwsf::XmlAttributeSet::addNamespaceAttribute ( const rwsf::XmlNamespace & )

Adds the attribute "xmlns:prefix", "URI" for the namespace consisting of the pair "prefix", "URI".

◆ clear()

void rwsf::XmlAttributeSet::clear ( )

Removes all attributes from self.

◆ contains() [1/2]

bool rwsf::XmlAttributeSet::contains ( const rwsf::XmlAttribute & attr) const

Returns true if self contains an attribute attr, otherwise false.

◆ contains() [2/2]

bool rwsf::XmlAttributeSet::contains ( const rwsf::XmlName & name) const

Returns true if self contains an attribute with an rwsf::XmlName that compares equal to name, otherwise false.

◆ entries()

size_t rwsf::XmlAttributeSet::entries ( ) const

Returns the set's size.

◆ equalTo()

bool rwsf::XmlAttributeSet::equalTo ( const XmlAttributeSet & other,
EqualityType type = Name ) const

Returns true if self and other have the following properties: Each contains the same number of rwsf::XmlAttribute instances. Each rwsf::XmlName of an rwsf::XmlAttribute matches equality with one rwsf::XmlName of an rwsf::XmlAttribute in other. If type == Value, then the each matched value of rwsf::XmlAttribute must be equal as well.

◆ find() [1/2]

bool rwsf::XmlAttributeSet::find ( const rwsf::XmlAttribute & attr,
rwsf::XmlAttribute & ret ) const

Returns true if an rwsf::XmlAttribute with an rwsf::XmlName matching the rwsf::XmlName of attr exists in the set, otherwise false. If a match is found, ret is populated with the values of the internal attribute, otherwise ret is not modified.

◆ find() [2/2]

bool rwsf::XmlAttributeSet::find ( const rwsf::XmlName & name,
rwsf::XmlAttribute & ret ) const

Returns true if an rwsf::XmlAttribute with an rwsf::XmlName matching name exists in the set, otherwise false. If a match is found, ret is populated with the values of the internal attribute, otherwise ret is not modified.

◆ findNamespaceAttribute() [1/2]

bool rwsf::XmlAttributeSet::findNamespaceAttribute ( const rwsf::XmlNamespace & s,
rwsf::XmlAttribute & ret )

Returns true if an rwsf::XmlAttribute with an rwsf::XmlName matching "xmlns:" + s exists in the set, otherwise false. If a match is found, ret is populated with the values of the internal attribute, otherwise ret is not modified.

◆ findNamespaceAttribute() [2/2]

bool rwsf::XmlAttributeSet::findNamespaceAttribute ( const std::string & s,
rwsf::XmlAttribute & ret )

Returns true if an rwsf::XmlAttribute with an rwsf::XmlName matching "xmlns:" + s exists in the set, otherwise false. If a match is found, ret is populated with the values of the internal attribute, otherwise ret is not modified.

◆ findValueByName()

std::string rwsf::XmlAttributeSet::findValueByName ( const std::string & attrName,
bool mustExist = true ) const

Returns the name of the attribute attrName from this set. If mustExist is true and the attribute is not in the set, the function throws an rwsf::Exception.

◆ getDefaultNamespaceAttribute()

std::string rwsf::XmlAttributeSet::getDefaultNamespaceAttribute ( ) const

Returns the (uri) string associated with the attribute rwsf::XmlName "\a xmlns" if any, otherwise returns the empty string.

◆ getIteratorBegin()

XmlAttributeSet::iterator rwsf::XmlAttributeSet::getIteratorBegin ( ) const

Returns an iterator at set's beginning.

◆ getIteratorEnd()

XmlAttributeSet::iterator rwsf::XmlAttributeSet::getIteratorEnd ( ) const

Returns an iterator at set's end.

◆ operator=()

XmlAttributeSet & rwsf::XmlAttributeSet::operator= ( const XmlAttributeSet & a)

Assignment operator. Makes self a deep copy of a.

◆ remove() [1/2]

void rwsf::XmlAttributeSet::remove ( const rwsf::XmlAttribute & attr)

Removes the attribute with an rwsf::XmlName that compares equal to the rwsf::XmlName of attr. Has no effect if self does not contain such an attribute. Calling this function may invalidate iterators that refer to this object.

◆ remove() [2/2]

void rwsf::XmlAttributeSet::remove ( const rwsf::XmlName & name)

Removes the attribute with an rwsf::XmlName that compares equal to name. Has no effect if self does not contain such an attribute. Calling this function may invalidate iterators that refer to this object.

◆ removeDefaultNamespaceAttribute()

void rwsf::XmlAttributeSet::removeDefaultNamespaceAttribute ( )

Removes the attribute with rwsf::XmlName "xmlns" if it exists.

◆ removeNamespaceAttribute() [1/2]

void rwsf::XmlAttributeSet::removeNamespaceAttribute ( const rwsf::XmlNamespace & prefix)

Removes the attribute with the rwsf::XmlName "xmlns:prefix", if it exists.

◆ removeNamespaceAttribute() [2/2]

void rwsf::XmlAttributeSet::removeNamespaceAttribute ( const std::string & s)

Removes the attribute with rwsf::XmlName "xmlns:s".

◆ setDefaultNamespaceAttribute() [1/3]

void rwsf::XmlAttributeSet::setDefaultNamespaceAttribute ( const rwsf::XmlAttribute & attr)

Sets the default namespace attribute for rwsf::XmlAttribute to attr. If the namespace attribute for the rwsf::XmlAttribute exists, the value is replaced.

◆ setDefaultNamespaceAttribute() [2/3]

void rwsf::XmlAttributeSet::setDefaultNamespaceAttribute ( const rwsf::XmlNamespace & ns)

Sets the default namespace attribute to ns. If the namespace attribute for the rwsf::XmlName exists, the value is replaced.

◆ setDefaultNamespaceAttribute() [3/3]

void rwsf::XmlAttributeSet::setDefaultNamespaceAttribute ( const std::string & s)

Sets the default namespace attribute for rwsf::XmlName to s. If the namespace attribute for the rwsf::XmlName exists, the value is replaced.

◆ unsetDefaultNamespaceAttribute()

void rwsf::XmlAttributeSet::unsetDefaultNamespaceAttribute ( )

Unsets the default namespace xmlns for the enclosing context by giving it the value "".

Copyright © 2026 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.