gloox  1.0.28
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 Schröter js@ca.nosp@m.maya.nosp@m..net
Since
1.0

Definition at line 59 of file tag.h.

Constructor & Destructor Documentation

◆ Attribute() [1/3]

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 26 of file tag.cpp.

◆ Attribute() [2/3]

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 36 of file tag.cpp.

◆ Attribute() [3/3]

Attribute ( const Attribute attr)

Copy constructor.

Parameters
attrThe Attribute to copy.

Definition at line 43 of file tag.cpp.

◆ ~Attribute()

virtual ~Attribute ( )
inlinevirtual

Destructor.

Definition at line 98 of file tag.h.

Member Function Documentation

◆ name()

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()

operator bool ( ) const
inline

Returns true if the Attribute is valid, false otherwise.

Definition at line 171 of file tag.h.

◆ operator!=()

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.

◆ operator==()

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.

◆ prefix()

const std::string & prefix ( ) const

Returns the attribute's namespace prefix.

Returns
The namespace prefix.

Definition at line 106 of file tag.cpp.

◆ setPrefix()

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 86 of file tag.cpp.

◆ setValue()

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 68 of file tag.cpp.

◆ setXmlns()

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 77 of file tag.cpp.

◆ value()

const std::string& value ( ) const
inline

Returns the attribute's value.

Returns
The attribute's value.

Definition at line 110 of file tag.h.

◆ xml()

const std::string xml ( ) const

Returns a string representation of the attribute.

Returns
A string representation.

Definition at line 117 of file tag.cpp.

◆ xmlns()

const std::string xmlns ( ) const

Returns the attribute's namespace.

Returns
The attribute's namespace.

Definition at line 95 of file tag.cpp.


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