XML text block
More...
#include <XML.h>
|
| XMLText (const String &text, bool preserveSpaces=true, bool verbatim=false) |
|
| 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 String & | Text () const |
|
| XMLNode (const XMLNode &x) |
|
| XMLNode (node_type type) |
|
| ~XMLNode () override |
|
bool | IsChildNode () const |
|
bool | IsComment () const |
|
bool | IsElement () const |
|
bool | IsText () const |
|
const XMLNodeLocation & | Location () const |
|
node_type | NodeType () const |
|
virtual void | SerializeAsHTML (IsoString &text, bool autoFormat, char indentChar, unsigned indentSize, unsigned level) const |
|
| XMLComponent ()=default |
|
| XMLComponent (const XMLComponent &)=default |
|
virtual | ~XMLComponent () |
|
bool | IsTopLevel () const |
|
XMLElement * | ParentElement () const |
|
This XMLText class represents a text entity in an XML document:
https://www.w3.org/TR/xml11/#dt-text
Definition at line 1951 of file XML.h.
◆ XMLText() [1/2]
pcl::XMLText::XMLText |
( |
const String & |
text, |
|
|
bool |
preserveSpaces = true , |
|
|
bool |
verbatim = false |
|
) |
| |
|
inline |
Constructs a new XMLText object.
- Parameters
-
text | The Unicode text block contents encoded as UTF-16. |
preserveSpaces | If 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. |
verbatim | If true, the text block will be serialized unencoded, that is, exactly as is being specified, in the XML document. No codification of illegal characers such as quotes and '<' or '>' will be performed. This is useful to generate special code blocks that must be included literally, such as <style> or <script> tags in HTML and SVG documents. |
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 1980 of file XML.h.
◆ XMLText() [2/2]
pcl::XMLText::XMLText |
( |
const XMLText & |
| ) |
|
|
default |
◆ EncodedText()
String pcl::XMLText::EncodedText |
( |
| ) |
const |
|
inline |
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 2016 of file XML.h.
References pcl::XML::EncodedText().
◆ IsPreserveSpaces()
bool pcl::XMLText::IsPreserveSpaces |
( |
| ) |
const |
|
inline |
Returns true iff this text block preserves space characters for serialization. See the class constructor for more information.
Definition at line 2006 of file XML.h.
◆ NLAfter()
bool pcl::XMLText::NLAfter |
( |
const XMLNode & |
previous | ) |
const |
|
inlineoverridevirtual |
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 2057 of file XML.h.
◆ Serialize()
void pcl::XMLText::Serialize |
( |
IsoString & |
text, |
|
|
bool |
autoFormat, |
|
|
char |
indentChar, |
|
|
unsigned |
indentSize, |
|
|
unsigned |
level |
|
) |
| const |
|
overridevirtual |
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 |
|
inline |
Returns a space-transformed version of this text block.
- Parameters
-
collapse | Replace all sequences of one or more space characters with single white space characters (#x20). |
trim | Remove all leading and trailing space characters. |
Definition at line 2029 of file XML.h.
References pcl::XML::CollapsedSpaces(), and pcl::XML::TrimmedSpaces().
◆ Text()
const String& pcl::XMLText::Text |
( |
| ) |
const |
|
inline |
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 1997 of file XML.h.
The documentation for this class was generated from the following file: