HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Types | Public Member Functions
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::XmlName &name) const
 
bool contains (const rwsf::XmlAttribute &attr) const
 
size_t entries () const
 
bool equalTo (const XmlAttributeSet &other, EqualityType type=Name) const
 
bool find (const rwsf::XmlName &name, rwsf::XmlAttribute &ret) const
 
bool find (const rwsf::XmlAttribute &attr, rwsf::XmlAttribute &ret) const
 
bool findNamespaceAttribute (const std::string &s, rwsf::XmlAttribute &ret)
 
bool findNamespaceAttribute (const rwsf::XmlNamespace &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::XmlName &name)
 
void remove (const rwsf::XmlAttribute &attr)
 
void removeDefaultNamespaceAttribute ()
 
void removeNamespaceAttribute (const rwsf::XmlNamespace &prefix)
 
void removeNamespaceAttribute (const std::string &s)
 
void setDefaultNamespaceAttribute (const std::string &s)
 
void setDefaultNamespaceAttribute (const rwsf::XmlNamespace &ns)
 
void setDefaultNamespaceAttribute (const rwsf::XmlAttribute &attr)
 
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 for the collection of rwsf::XmlAttribute objects within the rwsf::XmlAttributeSet.

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

Member Enumeration Documentation

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

rwsf::XmlAttributeSet::XmlAttributeSet ( )

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

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

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

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

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

Member Function Documentation

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

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

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.

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

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

void rwsf::XmlAttributeSet::clear ( )

Removes all attributes from self.

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.

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

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

size_t rwsf::XmlAttributeSet::entries ( ) const

Returns the set's size.

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.

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.

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.

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.

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.

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.

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.

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

Returns an iterator at set's beginning.

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

Returns an iterator at set's end.

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

Assignment operator. Makes self a deep copy of a.

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.

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.

void rwsf::XmlAttributeSet::removeDefaultNamespaceAttribute ( )

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

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

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

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

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

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.

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.

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.

void rwsf::XmlAttributeSet::unsetDefaultNamespaceAttribute ( )

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

Copyright © 2020 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is registered trademark of Rogue Wave Software, Inc. in the United States and other countries, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.