wxXml2
Public Member Functions | Protected Member Functions | List of all members
wxXml2BaseNode Class Reference

A generic XML node. More...

#include <xml2.h>

Inheritance diagram for wxXml2BaseNode:
Inheritance graph
[legend]
Collaboration diagram for wxXml2BaseNode:
Collaboration graph
[legend]

Public Member Functions

 wxXml2BaseNode ()
 
 wxXml2BaseNode (wxXml2BaseNodeObj *p)
 
virtual ~wxXml2BaseNode ()
 
bool IsUnlinked () const
 Is this node linked to a wider XML tree ?
 
bool IsNonEmpty () const
 Returns TRUE if this object is wrapping a non-NULL object.
 
bool operator== (const wxXml2BaseNode &decl) const
 
bool operator!= (const wxXml2BaseNode &decl) const
 
wxXml2BaseNodeoperator= (const wxXml2BaseNode &decl)
 
Getters

These functions wrap on the fly the internal pointers of the libxml2 structure and then return them (this is why they return objects and not references to objects).

wxXml2NodeType GetType () const
 
wxXml2BaseNode GetParent () const
 
wxXml2BaseNode GetChildren () const
 
wxXml2BaseNode GetFirstChild () const
 
wxXml2BaseNode GetNext () const
 
wxXml2BaseNode GetPrevious () const
 
wxXml2BaseNodeObjGetObj () const
 
Setters: still not tested all & unstable.

These functions are dangereous since they can break the libxml2 internal tree if they are not used carefully.

Try to avoid them.

void SetType (wxXml2NodeType type)
 
void SetChildren (const wxXml2BaseNode &child)
 
void SetNext (const wxXml2BaseNode &next)
 
void SetPrevious (const wxXml2BaseNode &prev)
 
- Public Member Functions inherited from wxXml2Wrapper
 wxXml2Wrapper ()
 Constructs this wrapper but not its wrapped data.
 
virtual ~wxXml2Wrapper ()
 The wxXml2Wrapper destructor will free the memory of the underlying libxml2 structure only if it is not linked to any XML tree.
 
virtual void DestroyIfUnlinked ()
 Destroys the wrapped data if it is unlinked.
 

Protected Member Functions

void Destroy ()
 Destroys the data wrapped by this class freeing its memory.
 
void SetAsEmpty ()
 Sets this element as empty: that is wrapping a NULL pointer.
 
void Copy (const wxXml2BaseNode &n)
 
int & GetPrivate () const
 Copies the given object.
 
- Protected Member Functions inherited from wxXml2Wrapper
void ResetRefCount ()
 
void IncRefCount ()
 
void DecRefCount ()
 
int GetRefCount () const
 
void UnwrappingOld ()
 This function should be called each time the internal pointer of the class is going to be replaced by another one.
 
void JustWrappedNew ()
 This function should be called each time the internal pointer of the class has been replaced by another one.
 

Detailed Description

A generic XML node.

This is the base class for more specific nodes like wxXml2Node, wxXml2ElemDecl, wxXml2AttrDecl, wxXml2EntityDecl. This class provides the basic functions used to modify an XML tree. Libxml2 in fact, uses different structures for the different types of nodes but all of them have some parts in common: wxXml2BaseNodeObj is the common part of all XML nodes handled by libxml2. So, when you have an XML node, you can always cast it, regardless of its specific type, to a wxXml2BaseNodeObj and then change its NEXT, PREVIOUS, CHILDREN, PARENT pointers...

Constructor & Destructor Documentation

wxXml2BaseNode::wxXml2BaseNode ( )
inline
wxXml2BaseNode::wxXml2BaseNode ( wxXml2BaseNodeObj p)
inline
virtual wxXml2BaseNode::~wxXml2BaseNode ( )
inlinevirtual

Member Function Documentation

void wxXml2BaseNode::Copy ( const wxXml2BaseNode n)
inlineprotected
void wxXml2BaseNode::Destroy ( )
inlineprotectedvirtual

Destroys the data wrapped by this class freeing its memory.

This function should not try to update the reference count since it should have been already updated by the caller.

Implements wxXml2Wrapper.

Reimplemented in wxXml2Node.

References wxXml2Wrapper::SetAsEmpty().

wxXml2BaseNode wxXml2BaseNode::GetChildren ( ) const
inline
wxXml2BaseNode wxXml2BaseNode::GetFirstChild ( ) const
inline
wxXml2BaseNode wxXml2BaseNode::GetNext ( ) const
inline

References wxXml2BaseNode, and wxXml2EmptyBaseNode.

Referenced by wxXml2Node::GetNext().

wxXml2BaseNodeObj* wxXml2BaseNode::GetObj ( ) const
inline
wxXml2BaseNode wxXml2BaseNode::GetParent ( ) const
inline
wxXml2BaseNode wxXml2BaseNode::GetPrevious ( ) const
inline
int& wxXml2BaseNode::GetPrivate ( ) const
inlineprotectedvirtual

Copies the given object.

This function should be used to implement copy constructor and assignment operators. Returns the private member of the wrapped structure.

Implements wxXml2Wrapper.

wxXml2NodeType wxXml2BaseNode::GetType ( ) const
inline
bool wxXml2BaseNode::IsNonEmpty ( ) const
inlinevirtual

Returns TRUE if this object is wrapping a non-NULL object.

Implements wxXml2Wrapper.

bool wxXml2BaseNode::IsUnlinked ( ) const
virtual

Is this node linked to a wider XML tree ?

Implements wxXml2Wrapper.

References tagXml2BaseNode::next, tagXml2BaseNode::parent, and tagXml2BaseNode::prev.

bool wxXml2BaseNode::operator!= ( const wxXml2BaseNode decl) const
inline
wxXml2BaseNode& wxXml2BaseNode::operator= ( const wxXml2BaseNode decl)
inline
bool wxXml2BaseNode::operator== ( const wxXml2BaseNode decl) const

References GetObj(), and wxCHECK_NULL_POINTERS.

void wxXml2BaseNode::SetAsEmpty ( )
inlineprotectedvirtual

Sets this element as empty: that is wrapping a NULL pointer.

This function must not free the memory of the currently wrapped pointer: it must just reset that pointer to NULL. This function is used by DestroyIfUnlinked().

Implements wxXml2Wrapper.

Referenced by wxXml2ElemContent::Destroy(), wxXml2Enumeration::Destroy(), and wxXml2Node::Destroy().

void wxXml2BaseNode::SetChildren ( const wxXml2BaseNode child)
void wxXml2BaseNode::SetNext ( const wxXml2BaseNode next)
void wxXml2BaseNode::SetPrevious ( const wxXml2BaseNode prev)
void wxXml2BaseNode::SetType ( wxXml2NodeType  type)
inline

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