00001 // -*- mode: c++ -*- 00002 00003 #ifndef MIX_NODE_H_ 00004 #define MIX_NODE_H_ 00005 00006 #include "classes.h" 00007 #include "misc.h" 00008 #include "DefaultXMLTraits.h" 00009 00010 namespace MiX{ 00017 template <class charT,class traitsT> 00018 class Node{ 00019 public: 00020 MiX_Template_Typedef(charT,traitsT); 00021 typedef NamedNode<charT,traitsT> this_type; 00022 typedef NodeContainer<charT,traitsT> nodecontainer_type; 00023 private: 00024 NodeContainer<charT,traitsT>* parent_; 00025 protected: 00031 Node(const this_type& src){ }; 00033 Node(){ parent_ = 0; }; 00035 void setParent(nodecontainer_type& parent){ parent_ = &parent; }; 00036 public: 00038 virtual ~Node()throw(); 00040 virtual void destroy()throw() { delete this; } ; 00042 const nodecontainer_type& getParent() const; 00044 nodecontainer_type& getParent(); 00046 virtual NodeType getType() const = 0; 00048 virtual string_type toString(bool indent=false,int indent_off=0)const = 0; 00049 00050 friend class DOM_Parser<charT,traitsT>; 00051 friend class NodeContainer<charT,traitsT>; 00052 }; 00053 } 00054 00055 #ifndef MIX_NODE_CPP_ 00056 #include "Node.cpp" 00057 #endif 00058 00059 #endif