PCL
pcl::XMLAttributeList Class Reference

Dynamic list of XML element attributes. More...

#include <XML.h>

Public Types

using const_iterator = list_implementation::const_iterator
 
using iterator = list_implementation::iterator
 
using list_implementation = Array< XMLAttribute >
 

Public Member Functions

 XMLAttributeList ()=default
 
 XMLAttributeList (const String &text)
 
 XMLAttributeList (const XMLAttributeList &)=default
 
String AttributeValue (const String &name) const
 
const_iterator Begin () const
 
const_iterator begin () const
 
void Clear ()
 
const_iterator End () const
 
const_iterator end () const
 
bool HasAttribute (const String &name) const
 
bool IsEmpty () const
 
int Length () const
 
XMLAttributeListoperator<< (const XMLAttribute &attribute)
 
XMLAttributeListoperator<< (const XMLAttributeList &list)
 
const XMLAttributeoperator[] (int i) const
 
void Parse (const String &text)
 
void RemoveAttribute (const String &name)
 
void Serialize (IsoString &text) const
 
void SetAttribute (const String &name, const String &value)
 
void SetAttribute (const XMLAttribute &attribute)
 
void SetAttributes (const XMLAttributeList &list)
 
void Sort ()
 

Detailed Description

XMLAttributeList represents a sequence of XML element attributes in a start-tag, as defined in the W3C recommendation:

https://www.w3.org/TR/xml11/#sec-starttags

XMLAttributeList is internally implemented as a dynamic array of XMLAttribute objects.

Definition at line 861 of file XML.h.

Member Typedef Documentation

◆ const_iterator

Represents an immutable XML element attribute list iterator.

Definition at line 879 of file XML.h.

◆ iterator

Represents a mutable XML element attribute list iterator.

Definition at line 874 of file XML.h.

◆ list_implementation

Represents the dynamic container class used internally to implement an XML element attribute list.

Definition at line 869 of file XML.h.

Constructor & Destructor Documentation

◆ XMLAttributeList() [1/3]

pcl::XMLAttributeList::XMLAttributeList ( const String text)
inline

Constructs a new XMLAttributeList object by parsing the specified text string.

The specified text must be a sequence of zero or more Attribute XML definitions pertaining to a start-tag:

https://www.w3.org/TR/xml11/#NT-STag

See the Parse() member function for a more detailed description.

Definition at line 892 of file XML.h.

◆ XMLAttributeList() [2/3]

pcl::XMLAttributeList::XMLAttributeList ( )
default

Default constructor. Constructs an empty XML attribute list.

◆ XMLAttributeList() [3/3]

pcl::XMLAttributeList::XMLAttributeList ( const XMLAttributeList )
default

Copy constructor.

Member Function Documentation

◆ AttributeValue()

String pcl::XMLAttributeList::AttributeValue ( const String name) const
inline

Returns the value of the element attribute with the specified qualified name, or an empty string if this list does not contain such an element attribute.

Definition at line 983 of file XML.h.

◆ Begin()

const_iterator pcl::XMLAttributeList::Begin ( ) const
inline

Returns an immutable iterator located at the beginning of this element attribute list.

Definition at line 937 of file XML.h.

◆ begin()

const_iterator pcl::XMLAttributeList::begin ( ) const
inline

STL-compatible iteration. Equivalent to Begin() const.

Definition at line 955 of file XML.h.

◆ Clear()

void pcl::XMLAttributeList::Clear ( )
inline

Removes all element attributes in this list, yielding an empty element attribute list.

Definition at line 1092 of file XML.h.

◆ End()

const_iterator pcl::XMLAttributeList::End ( ) const
inline

Returns an immutable iterator located at the end of this element attribute list.

Definition at line 946 of file XML.h.

◆ end()

const_iterator pcl::XMLAttributeList::end ( ) const
inline

STL-compatible iteration. Equivalent to End() const.

Definition at line 963 of file XML.h.

◆ HasAttribute()

bool pcl::XMLAttributeList::HasAttribute ( const String name) const
inline

Returns true iff this list contains an element attribute with the specified qualified name.

Definition at line 973 of file XML.h.

◆ IsEmpty()

bool pcl::XMLAttributeList::IsEmpty ( ) const
inline

Returns true iff this attribute list is empty.

Definition at line 918 of file XML.h.

◆ Length()

int pcl::XMLAttributeList::Length ( ) const
inline

Returns the number of element attributes in this list.

Definition at line 910 of file XML.h.

◆ operator<<() [1/2]

XMLAttributeList& pcl::XMLAttributeList::operator<< ( const XMLAttribute attribute)
inline

Insertion operator. Returns a reference to this object.

This operator is equivalent to SetAttribute( const XMLAttribute& ).

Definition at line 1038 of file XML.h.

◆ operator<<() [2/2]

XMLAttributeList& pcl::XMLAttributeList::operator<< ( const XMLAttributeList list)
inline

Insertion operator. Returns a reference to this object.

This operator is equivalent to SetAttributes( const XMLAttributeList& ).

Definition at line 1070 of file XML.h.

◆ operator[]()

const XMLAttribute& pcl::XMLAttributeList::operator[] ( int  i) const
inline

Returns a reference to the immutable element attribute at the specified zero-based index i. No bounds checking is performed: if the specified index is invalid this function invokes undefined behavior.

Definition at line 928 of file XML.h.

◆ Parse()

void pcl::XMLAttributeList::Parse ( const String text)

Parses the specified text, encoded as UTF-16, to generate a new list of XML element attributes.

The specified text must be a sequence of zero or more Attribute XML definitions pertaining to a start-tag, as described in the W3C recommendation:

https://www.w3.org/TR/xml11/#NT-STag

Attribute value normalization is applied to each parsed attribute:

https://www.w3.org/TR/xml11/#AVNormalize

In attribute values, all entity and character references are decoded. See the XML::DecodedText() static function for more information on reference decoding. Normalization also implies space trimming and compression: all leading and trailing space characters are removed, and all sequences of one or more space characters are replaced by single white space characters (#x20).

◆ RemoveAttribute()

void pcl::XMLAttributeList::RemoveAttribute ( const String name)
inline

Removes the element attribute with the specified qualified name, if it exists in this list. If no attribute with the specified name exists, this member function has no effect.

Definition at line 1081 of file XML.h.

◆ Serialize()

void pcl::XMLAttributeList::Serialize ( IsoString text) const

Performs the XML serialization of this element attribute list and appends it to the specified text string, encoded in UTF-8.

The generated serialization is a sequence of zero or more Attribute XML definitions pertaining to a start-tag, as described in the W3C recommendation:

https://www.w3.org/TR/xml11/#NT-STag

◆ SetAttribute() [1/2]

void pcl::XMLAttributeList::SetAttribute ( const String name,
const String value 
)
inline

Causes this list to contain an XML element attribute with the specified qualified name and value.

If an attribute with the same qualified name already exists in this list, then its value will be changed. Otherwise, a new attribute will be appended to this list.

This member function ensures that no XML element can have two or more attributes with the same qualified name. This constraint is part of the XML specification:

https://www.w3.org/TR/xml11/#sec-starttags https://www.w3.org/TR/xml-names/#scoping-defaulting

Definition at line 1004 of file XML.h.

References pcl::GenericString< T, R, A >::IsEmpty().

◆ SetAttribute() [2/2]

void pcl::XMLAttributeList::SetAttribute ( const XMLAttribute attribute)
inline

Causes this list to contain the specified XML element attribute.

See SetAttribute( const String&, const String& ) for more information.

Definition at line 1021 of file XML.h.

References pcl::GenericString< T, R, A >::IsEmpty(), and pcl::XMLAttribute::Name().

◆ SetAttributes()

void pcl::XMLAttributeList::SetAttributes ( const XMLAttributeList list)
inline

Causes this list to contain the specified list of XML element attributes.

For each attribute in the specified list, if an attribute with the same qualified name already exists in this list, then its value will be changed. Otherwise, a new attribute will be appended to this list.

This member function ensures that no XML element can have two or more attributes with the same qualified name. This constraint is part of the XML specification:

https://www.w3.org/TR/xml11/#sec-starttags https://www.w3.org/TR/xml-names/#scoping-defaulting

Definition at line 1059 of file XML.h.

◆ Sort()

void pcl::XMLAttributeList::Sort ( )
inline

Sorts the element attributes in this list in ascending order by comparing their qualified names.

Definition at line 1101 of file XML.h.


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