Rhino C++ API  8.8
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
ON_XMLNode Class Reference

#include <opennurbs_xml.h>

Inheritance diagram for ON_XMLNode:
ON_XMLRootNode

Classes

class  CharacterCounts
 
class  ChildIterator
 < Iteration. More...
 
class  PropertyIterator
 

Public Member Functions

 ON_XMLNode (const ON_XMLNode &)
 
 ON_XMLNode (const wchar_t *name)
 Always creates empty default property. More...
 
 ON_XMLNode (ON_XMLNode &&) noexcept=delete
 
virtual ~ON_XMLNode ()
 
virtual ON_XMLNodeAttachChildNode (ON_XMLNode *node)
 
virtual ON_XMLPropertyAttachProperty (ON_XMLProperty *prop)
 
virtual int ChildCount (void) const
 
virtual void Clear (void)
 Removes and deletes all child nodes and properties, and clears the tag name. More...
 
virtual ON_XMLNodeCreateNodeAtPath (const wchar_t *path)
 
virtual ON__UINT32 DataCRC (ON__UINT32 current_remainder, bool recursive) const
 
virtual ON_XMLNodeDetachChild (ON_XMLNode &child)
 
virtual ON_XMLNodeFirstChild (void) const
 Get the first child of this node or null if none. More...
 
virtual ChildIterator GetChildIterator (void) const
 
virtual ON_XMLPropertyGetDefaultProperty (void) const
 
virtual ON_XMLNodeGetNamedChild (const wchar_t *name) const
 Use this when you are looking for a node that is only one child below - non-recursive, but fast. More...
 
virtual ON_XMLPropertyGetNamedProperty (const wchar_t *name) const
 
virtual int GetNestedDepth (void) const
 
virtual ON_XMLNodeGetNodeAtPath (const wchar_t *path) const
 
virtual ON_wString GetPathFromRoot (void) const
 Returns the full path to this node. More...
 
virtual PropertyIterator GetPropertyIterator (bool alphabetized=false) const
 
virtual void * LastReadBufferPointer (void) const
 
virtual bool MergeFrom (const ON_XMLNode &src)
 src node must have the same name More...
 
virtual void MoveAfter (ON_XMLNode &other)
 Moves this node after another node. More...
 
virtual void MoveBefore (ON_XMLNode &other)
 Moves this node before another node. More...
 
virtual ON_XMLNodeNextSibling (void) const
 Get the next sibling of this node or null if none. More...
 
virtual void OnNodeReadFromStream (const ON_XMLNode *node) const
 This function is called on the top-most node during the reading process. More...
 
 operator ON_wString () const
 
bool operator!= (const ON_XMLNode &) const
 
const ON_XMLNodeoperator= (const ON_XMLNode &)
 
bool operator== (const ON_XMLNode &) const
 
virtual ON_XMLNodeParent (void) const
 Get the parent of this node or null if none. More...
 
virtual ON_XMLNodePrevSibling (void) const
 Get the previous sibling of this node or null if none. More...
 
virtual int PropertyCount (void) const
 < Utilities. More...
 
virtual ON__UINT32 ReadFromStream (const wchar_t *buf, bool warnings_as_errors=false, bool validate_tags=true)
 
virtual bool RecurseChildren (ON_XMLRecurseChildrenCallback callback, void *data) const
 
virtual void Remove (void)
 Removes and deletes this node. More...
 
virtual void RemoveAllChildren (void)
 Removes and deletes all child nodes. More...
 
virtual void RemoveAllProperties (void)
 Removes and deletes all properties and adds an empty default property. More...
 
virtual bool RemoveChild (ON_XMLNode *child)
 
virtual bool RemoveProperty (const wchar_t *prop_name)
 
virtual void SetInternalDebuggingFlags (ON__UINT64)
 For internal use only. More...
 
virtual ON_XMLPropertySetProperty (const ON_XMLProperty &prop)
 
virtual void SetTagName (const wchar_t *name)
 
virtual ON_wString String (bool include_formatting=true, bool force_long_format=false, bool sorted_props=false) const
 
virtual const ON_wStringTagName (void) const
 
virtual const ON_XMLNodeTopLevel (void) const
 Get the top-level parent of this node. More...
 
virtual CharacterCounts WriteChildrenToStream (wchar_t *stream, ON__UINT32 max_chars, bool include_formatting=true, bool force_long_format=false, bool sorted_props=false) const
 
virtual CharacterCounts WriteFooterToStream (wchar_t *stream, ON__UINT32 max_chars, bool include_formatting=true, bool force_long_format=false) const
 
virtual CharacterCounts WriteHeaderToStream (wchar_t *stream, ON__UINT32 max_chars, bool include_formatting=true, bool force_long_format=false, bool sorted_props=false) const
 
virtual bool WriteToSegmentedStream (ON_XMLSegmentedStream &stream, bool include_formatting=true, bool force_long_format=false, bool sorted_props=false) const
 
virtual ON__UINT32 WriteToStream (wchar_t *stream, ON__UINT32 max_chars, bool include_formatting=true, bool force_long_format=false, bool sorted_props=false) const
 
virtual CharacterCounts WriteToStreamEx (wchar_t *stream, ON__UINT32 max_chars, bool include_formatting=true, bool force_long_format=false, bool sorted_props=false) const
 

Static Public Member Functions

static bool AutoTypePropValue (void)
 
static ON_wString GetNameFromTag (const wchar_t *tag)
 
static bool IsValidXMLName (const wchar_t *name)
 
static bool IsValidXMLNameWithDebugging (const wchar_t *name)
 
static void SetAutoTypePropValue (bool b=true)
 

Static Public Attributes

static constexpr ON__UINT32 ReadError = 0xFFFFFFFF
 < Serialization. More...
 

Protected Member Functions

virtual void * EVF (const wchar_t *func, void *data)
 Emergency virtual function for future expansion. More...
 

Friends

class ON_XMLNodePrivate
 
class ON_XMLNodePropertyIteratorPrivate
 

Constructor & Destructor Documentation

◆ ON_XMLNode() [1/3]

ON_XMLNode::ON_XMLNode ( const wchar_t *  name)

Always creates empty default property.

◆ ON_XMLNode() [2/3]

ON_XMLNode::ON_XMLNode ( const ON_XMLNode )

◆ ON_XMLNode() [3/3]

ON_XMLNode::ON_XMLNode ( ON_XMLNode &&  )
deletenoexcept

◆ ~ON_XMLNode()

virtual ON_XMLNode::~ON_XMLNode ( )
virtual

Member Function Documentation

◆ AttachChildNode()

virtual ON_XMLNode* ON_XMLNode::AttachChildNode ( ON_XMLNode node)
virtual

< Change data. Adds a node as a child of this node. Takes ownership of node. Returns a pointer to node for convenience.

◆ AttachProperty()

virtual ON_XMLProperty* ON_XMLNode::AttachProperty ( ON_XMLProperty prop)
virtual

Attaches a property directly to the node. Takes ownership of the property. Any existing property with the same name is first deleted. For convenience, returns a pointer to the input property.

◆ AutoTypePropValue()

static bool ON_XMLNode::AutoTypePropValue ( void  )
static

◆ ChildCount()

virtual int ON_XMLNode::ChildCount ( void  ) const
virtual

◆ Clear()

virtual void ON_XMLNode::Clear ( void  )
virtual

Removes and deletes all child nodes and properties, and clears the tag name.

Reimplemented in ON_XMLRootNode.

◆ CreateNodeAtPath()

virtual ON_XMLNode* ON_XMLNode::CreateNodeAtPath ( const wchar_t *  path)
virtual

Gets a child node given the relative path from the current node. If the node does not exist, it is created. This method should therefore never return null. The returned pointer should not be deleted by the caller. The child node is owned by its immediate parent at that position in the node hierarchy.

◆ DataCRC()

virtual ON__UINT32 ON_XMLNode::DataCRC ( ON__UINT32  current_remainder,
bool  recursive 
) const
virtual

Get the CRC of this node. Param current_remainder is the current remainder value as used by ON_CRC32. Param recursive is true to process nodes recursively, false to process only this node.

◆ DetachChild()

virtual ON_XMLNode* ON_XMLNode::DetachChild ( ON_XMLNode child)
virtual

Removes the child node and passes ownership to the caller. Returns the detached node or null on failure.

◆ EVF()

virtual void* ON_XMLNode::EVF ( const wchar_t *  func,
void *  data 
)
protectedvirtual

Emergency virtual function for future expansion.

◆ FirstChild()

virtual ON_XMLNode* ON_XMLNode::FirstChild ( void  ) const
virtual

Get the first child of this node or null if none.

< Hierarchy.

◆ GetChildIterator()

virtual ChildIterator ON_XMLNode::GetChildIterator ( void  ) const
virtual

◆ GetDefaultProperty()

virtual ON_XMLProperty& ON_XMLNode::GetDefaultProperty ( void  ) const
virtual

◆ GetNamedChild()

virtual ON_XMLNode* ON_XMLNode::GetNamedChild ( const wchar_t *  name) const
virtual

Use this when you are looking for a node that is only one child below - non-recursive, but fast.

◆ GetNamedProperty()

virtual ON_XMLProperty* ON_XMLNode::GetNamedProperty ( const wchar_t *  name) const
virtual

◆ GetNameFromTag()

static ON_wString ON_XMLNode::GetNameFromTag ( const wchar_t *  tag)
static

◆ GetNestedDepth()

virtual int ON_XMLNode::GetNestedDepth ( void  ) const
virtual

◆ GetNodeAtPath()

virtual ON_XMLNode* ON_XMLNode::GetNodeAtPath ( const wchar_t *  path) const
virtual

Gets at nodes deep into the tree using a slash-delimited path, i.e., "child/grandchild/great-grandchild". There's no checking for multiple nodes with the same name at each level of the tree, so if you use these methods, you have to make sure you have unique node names at each level. Gets a child node given the relative path from the current node. If the node does not exist, the method returns null. The returned pointer should not be deleted by the caller. The child node is owned by its immediate parent at that position in the node hierarchy.

◆ GetPathFromRoot()

virtual ON_wString ON_XMLNode::GetPathFromRoot ( void  ) const
virtual

Returns the full path to this node.

◆ GetPropertyIterator()

virtual PropertyIterator ON_XMLNode::GetPropertyIterator ( bool  alphabetized = false) const
virtual

◆ IsValidXMLName()

static bool ON_XMLNode::IsValidXMLName ( const wchar_t *  name)
static

◆ IsValidXMLNameWithDebugging()

static bool ON_XMLNode::IsValidXMLNameWithDebugging ( const wchar_t *  name)
static

◆ LastReadBufferPointer()

virtual void* ON_XMLNode::LastReadBufferPointer ( void  ) const
virtual

◆ MergeFrom()

virtual bool ON_XMLNode::MergeFrom ( const ON_XMLNode src)
virtual

src node must have the same name

◆ MoveAfter()

virtual void ON_XMLNode::MoveAfter ( ON_XMLNode other)
virtual

Moves this node after another node.

◆ MoveBefore()

virtual void ON_XMLNode::MoveBefore ( ON_XMLNode other)
virtual

Moves this node before another node.

◆ NextSibling()

virtual ON_XMLNode* ON_XMLNode::NextSibling ( void  ) const
virtual

Get the next sibling of this node or null if none.

◆ OnNodeReadFromStream()

virtual void ON_XMLNode::OnNodeReadFromStream ( const ON_XMLNode node) const
virtual

This function is called on the top-most node during the reading process.

◆ operator ON_wString()

ON_XMLNode::operator ON_wString ( ) const

◆ operator!=()

bool ON_XMLNode::operator!= ( const ON_XMLNode ) const

◆ operator=()

const ON_XMLNode& ON_XMLNode::operator= ( const ON_XMLNode )

◆ operator==()

bool ON_XMLNode::operator== ( const ON_XMLNode ) const

◆ Parent()

virtual ON_XMLNode* ON_XMLNode::Parent ( void  ) const
virtual

Get the parent of this node or null if none.

◆ PrevSibling()

virtual ON_XMLNode* ON_XMLNode::PrevSibling ( void  ) const
virtual

Get the previous sibling of this node or null if none.

◆ PropertyCount()

virtual int ON_XMLNode::PropertyCount ( void  ) const
virtual

< Utilities.

◆ ReadFromStream()

virtual ON__UINT32 ON_XMLNode::ReadFromStream ( const wchar_t *  buf,
bool  warnings_as_errors = false,
bool  validate_tags = true 
)
virtual

◆ RecurseChildren()

virtual bool ON_XMLNode::RecurseChildren ( ON_XMLRecurseChildrenCallback  callback,
void *  data 
) const
virtual

Recursively iterate over the children of this node, calling the supplied callback function for each child. If the callback function returns false, this function will fail. Returns true if successful, false on failure.

◆ Remove()

virtual void ON_XMLNode::Remove ( void  )
virtual

Removes and deletes this node.

◆ RemoveAllChildren()

virtual void ON_XMLNode::RemoveAllChildren ( void  )
virtual

Removes and deletes all child nodes.

◆ RemoveAllProperties()

virtual void ON_XMLNode::RemoveAllProperties ( void  )
virtual

Removes and deletes all properties and adds an empty default property.

◆ RemoveChild()

virtual bool ON_XMLNode::RemoveChild ( ON_XMLNode child)
virtual

Removes and deletes the child node, if possible. Returns true if successful, else false.

◆ RemoveProperty()

virtual bool ON_XMLNode::RemoveProperty ( const wchar_t *  prop_name)
virtual

Removes and deletes the named property, if possible. Returns true if successful, else false.

◆ SetAutoTypePropValue()

static void ON_XMLNode::SetAutoTypePropValue ( bool  b = true)
static

◆ SetInternalDebuggingFlags()

virtual void ON_XMLNode::SetInternalDebuggingFlags ( ON__UINT64  )
virtual

For internal use only.

◆ SetProperty()

virtual ON_XMLProperty* ON_XMLNode::SetProperty ( const ON_XMLProperty prop)
virtual

Sets a property on the node. The property is copied and ownership of it remains with the caller. Any existing property with the same name is first deleted. Returns a pointer to the copy of the property.

◆ SetTagName()

virtual void ON_XMLNode::SetTagName ( const wchar_t *  name)
virtual

◆ String()

virtual ON_wString ON_XMLNode::String ( bool  include_formatting = true,
bool  force_long_format = false,
bool  sorted_props = false 
) const
virtual

◆ TagName()

virtual const ON_wString& ON_XMLNode::TagName ( void  ) const
virtual

◆ TopLevel()

virtual const ON_XMLNode& ON_XMLNode::TopLevel ( void  ) const
virtual

Get the top-level parent of this node.

◆ WriteChildrenToStream()

virtual CharacterCounts ON_XMLNode::WriteChildrenToStream ( wchar_t *  stream,
ON__UINT32  max_chars,
bool  include_formatting = true,
bool  force_long_format = false,
bool  sorted_props = false 
) const
virtual

◆ WriteFooterToStream()

virtual CharacterCounts ON_XMLNode::WriteFooterToStream ( wchar_t *  stream,
ON__UINT32  max_chars,
bool  include_formatting = true,
bool  force_long_format = false 
) const
virtual

◆ WriteHeaderToStream()

virtual CharacterCounts ON_XMLNode::WriteHeaderToStream ( wchar_t *  stream,
ON__UINT32  max_chars,
bool  include_formatting = true,
bool  force_long_format = false,
bool  sorted_props = false 
) const
virtual

◆ WriteToSegmentedStream()

virtual bool ON_XMLNode::WriteToSegmentedStream ( ON_XMLSegmentedStream stream,
bool  include_formatting = true,
bool  force_long_format = false,
bool  sorted_props = false 
) const
virtual

◆ WriteToStream()

virtual ON__UINT32 ON_XMLNode::WriteToStream ( wchar_t *  stream,
ON__UINT32  max_chars,
bool  include_formatting = true,
bool  force_long_format = false,
bool  sorted_props = false 
) const
virtual

Writes the node to a wide buffer (AKA 'stream') as XML text. max_chars is the maximum number of wide characters that the buffer can accommodate. To find out how much space is needed without actually writing anything, pass zero. When writing to the buffer, a terminator is written if there is room for it, but the terminator is not included in the returned number of characters.

◆ WriteToStreamEx()

virtual CharacterCounts ON_XMLNode::WriteToStreamEx ( wchar_t *  stream,
ON__UINT32  max_chars,
bool  include_formatting = true,
bool  force_long_format = false,
bool  sorted_props = false 
) const
virtual

Friends And Related Function Documentation

◆ ON_XMLNodePrivate

friend class ON_XMLNodePrivate
friend

◆ ON_XMLNodePropertyIteratorPrivate

friend class ON_XMLNodePropertyIteratorPrivate
friend

Member Data Documentation

◆ ReadError

constexpr ON__UINT32 ON_XMLNode::ReadError = 0xFFFFFFFF
staticconstexpr

< Serialization.

Indicates ReadFromStream() failure.