pcl::XMLText Class Reference

XML text block More...

#include <XML.h>

+ Inheritance diagram for pcl::XMLText:

Public Member Functions

 XMLText (const String &text, bool preserveSpaces=true)
 XMLText (const XMLText &)=default
String EncodedText () const
bool IsPreserveSpaces () const
bool NLAfter (const XMLNode &previous) const override
void Serialize (IsoString &text, bool autoFormat, char indentChar, unsigned indentSize, unsigned level) const override
String SpaceTransformedText (bool collapse, bool trim) const
const StringText () const
- Public Member Functions inherited from pcl::XMLNode
 XMLNode (node_type type)
 XMLNode (const XMLNode &x)
virtual ~XMLNode ()
bool IsChildNode () const
bool IsComment () const
bool IsElement () const
bool IsText () const
const XMLNodeLocationLocation () const
node_type NodeType () const
- Public Member Functions inherited from pcl::XMLComponent
 XMLComponent ()=default
 XMLComponent (const XMLComponent &)=default
bool IsTopLevel () const
XMLElementParentElement () const

Additional Inherited Members

- Public Types inherited from pcl::XMLNode
typedef XMLNodeType::mask_type node_type

Detailed Description

This XMLText class represents a text entity in an XML document:


Definition at line 1812 of file XML.h.

Constructor & Destructor Documentation

◆ XMLText() [1/2]

pcl::XMLText::XMLText ( const String text,
bool  preserveSpaces = true 

Constructs a new XMLText object.

textThe Unicode text block contents encoded as UTF-16.
preserveSpacesIf false, the text block will be transformed by trimming and collapsing spaces: All leading and trailing space characters will be removed, and all sequences of one or more space characters will be replaced by single white space characters (#x20). If true, the specified text string will be stored intact.

Besides text contents transformation, space preservation also has an impact in the way text blocks are serialized as XML: New line characters (#x0A) are never used to separate text blocks from their parent or sibling nodes when space preservation is enabled.

Definition at line 1833 of file XML.h.

◆ XMLText() [2/2]

pcl::XMLText::XMLText ( const XMLText )

Copy constructor.

Member Function Documentation

◆ EncodedText()

String pcl::XMLText::EncodedText ( ) const

Returns an encoded version of this text block. All characters that cannot legally occur in an XML text block are replaced by their corresponding entity references.

Definition at line 1868 of file XML.h.

References pcl::XML::EncodedText().

◆ IsPreserveSpaces()

bool pcl::XMLText::IsPreserveSpaces ( ) const

Returns true iff this text block preserves space characters for serialization. See the class constructor for more information.

Definition at line 1858 of file XML.h.

◆ NLAfter()

bool pcl::XMLText::NLAfter ( const XMLNode previous) const

Returns true iff a new line character (#x0A) can be inserted before serializing this node after the specified previous node.

In the case of a text block, a new line character can only be inserted if the block does not preserve space characters. If space preservation is enabled, new line characters are forbidden at the beginning and end of the text block serialization.

Reimplemented from pcl::XMLNode.

Definition at line 1909 of file XML.h.

◆ Serialize()

void pcl::XMLText::Serialize ( IsoString text,
bool  autoFormat,
char  indentChar,
unsigned  indentSize,
unsigned  level 
) const

Serializes this XML text block with UTF-8 encoding.

See XMLNode::Serialize() for information on function parameters. See also the class constructor for information on space preservation options in XML text blocks.

Implements pcl::XMLNode.

◆ SpaceTransformedText()

String pcl::XMLText::SpaceTransformedText ( bool  collapse,
bool  trim 
) const

Returns a space-transformed version of this text block.

collapseReplace all sequences of one or more space characters with single white space characters (#x20).
trimRemove all leading and trailing space characters.

Definition at line 1881 of file XML.h.

References pcl::XML::CollapsedSpaces(), and pcl::XML::TrimmedSpaces().

◆ Text()

const String& pcl::XMLText::Text ( ) const

Returns a reference to the (immutable) text string contained by this XML text block. The returned string is encoded in UTF-16.

Definition at line 1849 of file XML.h.

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