gloox  1.0
Public Member Functions | List of all members
Tag::Attribute Class Reference

#include <tag.h>

Public Member Functions

 Attribute (Tag *parent, const std::string &name, const std::string &value, const std::string &xmlns=EmptyString)
 Attribute (const std::string &name, const std::string &value, const std::string &xmlns=EmptyString)
 Attribute (const Attribute &attr)
virtual ~Attribute ()
const std::string & name () const
const std::string & value () const
bool setValue (const std::string &value)
const std::string & xmlns () const
bool setXmlns (const std::string &xmlns)
bool setPrefix (const std::string &prefix)
const std::string & prefix () const
const std::string xml () const
bool operator== (const Attribute &right) const
bool operator!= (const Attribute &right) const
 operator bool () const

Detailed Description

An XML element's attribute.

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
1.0

Definition at line 59 of file tag.h.

Constructor & Destructor Documentation

Attribute ( Tag parent,
const std::string &  name,
const std::string &  value,
const std::string &  xmlns = EmptyString 
)

Creates a new Attribute from name, value and optional xmlns and attaches it to the given Tag.

In the future: If xmlns is not empty, and if it is different from the Tag's default namespace, an appropriate and unique namespace declaration (prefix) will be added to the Tag and the attribute will be prefixed accordingly.

Parameters
parentThe Tag to attach the Attribute to.
nameThe attribute's name. Invalid (non-UTF-8) input will be ignored.
valueThe attribute's value. Invalid (non-UTF-8) input will be ignored.
xmlnsThe attribute's namespace. Invalid (non-UTF-8) input will be ignored.

Definition at line 25 of file tag.cpp.

Attribute ( const std::string &  name,
const std::string &  value,
const std::string &  xmlns = EmptyString 
)

Creates a new Attribute from name, value and optional xmlns.

Parameters
nameThe attribute's name. Invalid (non-UTF-8) input will be ignored.
valueThe attribute's value. Invalid (non-UTF-8) input will be ignored.
xmlnsThe attribute's namespace. Invalid (non-UTF-8) input will be ignored.

Definition at line 35 of file tag.cpp.

Attribute ( const Attribute attr)

Copy constructor.

Parameters
attrThe Attribute to copy.

Definition at line 42 of file tag.cpp.

virtual ~Attribute ( )
inlinevirtual

Destructor.

Definition at line 98 of file tag.h.

Member Function Documentation

const std::string& name ( ) const
inline

Returns the attribute's name.

Returns
The attribute's name.

Definition at line 104 of file tag.h.

operator bool ( ) const
inline

Returns true if the Attribute is valid, false otherwise.

Definition at line 171 of file tag.h.

bool operator!= ( const Attribute right) const
inline

Checks two Attributes for inequality.

Parameters
rightThe Attribute to check against the current Attribute.

Definition at line 165 of file tag.h.

bool operator== ( const Attribute right) const
inline

Checks two Attributes for equality.

Parameters
rightThe Attribute to check against the current Attribute.

Definition at line 158 of file tag.h.

const std::string & prefix ( ) const

Returns the attribute's namespace prefix.

Returns
The namespace prefix.

Definition at line 105 of file tag.cpp.

bool setPrefix ( const std::string &  prefix)

Sets the attribute's namespace prefix.

Parameters
prefixThe new namespace prefix.
Returns
True if the input is valid UTF-8, false otherwise. Invalid input will be ignored.

Definition at line 85 of file tag.cpp.

bool setValue ( const std::string &  value)

Sets the attribute's value.

Parameters
valueThe new value.
Returns
True if the input is valid UTF-8, false otherwise. Invalid input will be ignored.

Definition at line 67 of file tag.cpp.

bool setXmlns ( const std::string &  xmlns)

Sets the attribute's namespace.

Parameters
xmlnsThe new namespace.
Returns
True if the input is valid UTF-8, false otherwise. Invalid input will be ignored.

Definition at line 76 of file tag.cpp.

const std::string& value ( ) const
inline

Returns the attribute's value.

Returns
The attribute's value.

Definition at line 110 of file tag.h.

const std::string xml ( ) const

Returns a string representation of the attribute.

Returns
A string representation.

Definition at line 116 of file tag.cpp.

const std::string & xmlns ( ) const

Returns the attribute's namespace.

Returns
The attribute's namespace.

Definition at line 94 of file tag.cpp.


The documentation for this class was generated from the following files: