Simbody  3.7
SimTK::Xml::Unknown Class Reference

This is something we don't understand but can carry around. More...

+ Inheritance diagram for SimTK::Xml::Unknown:

Public Member Functions

 Unknown ()
 Create an empty Unknown node handle, suitable only for holding references to other Unknown nodes. More...
 
 Unknown (const String &contents)
 Create a new Unknown node with the given contents; the node is not yet owned by any XML document. More...
 
 Unknown (Element &element, const String &contents)
 Create a new Unknown node and append it to the list of nodes that are children of the given Element. More...
 
Unknown clone () const
 The clone() method makes a deep copy of this Unknown node and returns a new orphan Unknown node with the same contents; ordinary assignment and copy construction are shallow. More...
 
const StringgetContents () const
 Obtain the contents of this Unknown node. More...
 
void setContents (const String &contents)
 Change the contents of this Unknown node. More...
 
- Public Member Functions inherited from SimTK::Xml::Node
bool operator== (const Node &other) const
 Comparing Nodes for equality means asking if the two Node handles are referring to exactly the same object; two different nodes that happen to have the same properties will not test equal by this criteria. More...
 
bool operator!= (const Node &other) const
 Inequality test using same criteria as operator==(). More...
 
 Node ()
 Create an empty Node handle that can be used to hold a reference to any kind of Node. More...
 
 Node (const Node &src)
 Copy constructor is shallow; that is, this handle will refer to the same node as the source. More...
 
Nodeoperator= (const Node &src)
 Copy assignment is shallow; the handle is first cleared and then will refer to the same node as the source. More...
 
Node clone () const
 The clone() method makes a deep copy of this Node and its children and returns a new orphan Node with the same contents; ordinary assignment and copy construction is shallow. More...
 
 ~Node ()
 The Node handle destructor does not recover heap space so if you create orphan nodes and then don't put them in a document there will be a memory leak unless you explicitly destruct them first with clearOrphan(). More...
 
void clear ()
 This method restores the Node handle to its default-constructed state but does not recover any heap space; use clearOrphan() if you know this node was never put into a document. More...
 
void clearOrphan ()
 This method explicitly frees the heap space for an orphan node that was created but never inserted into a document. More...
 
NodeType getNodeType () const
 Get the Xml::NodeType of this node. More...
 
String getNodeTypeAsString () const
 Get the Node type as a string; an empty handle returns "NoNode". More...
 
bool isValid () const
 Return true if this Node handle is referencing some node, false if the Node handle is empty. More...
 
bool isTopLevelNode () const
 Return true if this Node is owned by the top-level Xml document, false if the Node is owned by an Element or is an orphan, or if the Node handle is empty. More...
 
bool isOrphan () const
 Return true if this Node is an orphan, meaning that it is not empty, but is not owned by any element or top-level document. More...
 
bool hasParentElement () const
 Return true if this node has a parent, i.e. More...
 
Element getParentElement ()
 Return a handle referencing this node's parent if it has one, otherwise throws an error; check first with hasParentElement() if you aren't sure. More...
 
const StringgetNodeText () const
 Return a text value associated with this Node (not including its child nodes if any); the behavior depends on the NodeType. More...
 
void writeToString (String &out, bool compact=false) const
 Serialize this node (and everything it contains) to the given String. More...
 

Static Public Member Functions

Conversion to Unknown from Node

If you have a handle to a Node, such as would be returned by a node_iterator, you can check whether that Node is an Unknown node and if so cast it to one.

static bool isA (const Node &)
 Test whether a given Node is an Unknown node. More...
 
static const UnknowngetAs (const Node &node)
 Recast a Node to a const Unknown, throwing an error if the Node is not actually an Unknown node. More...
 
static UnknowngetAs (Node &node)
 Recast a writable Node to a writable Unknown, throwing an error if the Node is not actually an Unknown node. More...
 

Additional Inherited Members

Detailed Description

This is something we don't understand but can carry around.

Constructor & Destructor Documentation

◆ Unknown() [1/3]

SimTK::Xml::Unknown::Unknown ( )
inline

Create an empty Unknown node handle, suitable only for holding references to other Unknown nodes.

◆ Unknown() [2/3]

SimTK::Xml::Unknown::Unknown ( const String contents)
explicit

Create a new Unknown node with the given contents; the node is not yet owned by any XML document.

Don't include the tag delimiters "<" and ">" in the contents; those will be added automatically if the document is serialized to a file or string. That is, if you want "<!SOMETHING blah blah>", the contents you provide should be "!SOMETHING blah blah".

◆ Unknown() [3/3]

SimTK::Xml::Unknown::Unknown ( Element element,
const String contents 
)
inline

Create a new Unknown node and append it to the list of nodes that are children of the given Element.

The Element becomes the owner of the new Unknown node although the handle retains a reference to it.

Member Function Documentation

◆ clone()

Unknown SimTK::Xml::Unknown::clone ( ) const

The clone() method makes a deep copy of this Unknown node and returns a new orphan Unknown node with the same contents; ordinary assignment and copy construction are shallow.

◆ getContents()

const String& SimTK::Xml::Unknown::getContents ( ) const

Obtain the contents of this Unknown node.

This is everything that would be between the "<" and ">" in the XML document.

◆ setContents()

void SimTK::Xml::Unknown::setContents ( const String contents)

Change the contents of this Unknown node.

This is everything that would be between the "<" and ">" in the XML document.

◆ isA()

static bool SimTK::Xml::Unknown::isA ( const Node )
static

Test whether a given Node is an Unknown node.

◆ getAs() [1/2]

static const Unknown& SimTK::Xml::Unknown::getAs ( const Node node)
static

Recast a Node to a const Unknown, throwing an error if the Node is not actually an Unknown node.

See also
isA()

◆ getAs() [2/2]

static Unknown& SimTK::Xml::Unknown::getAs ( Node node)
static

Recast a writable Node to a writable Unknown, throwing an error if the Node is not actually an Unknown node.

See also
isA()

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