00001
00002
00003 #ifndef MIX_ELEMENT_H_
00004 #define MIX_ELEMENT_H_
00005
00006 #include "classes.h"
00007 #include "misc.h"
00008 #include "NodeContainer.h"
00009 #include "extern/noncopyable.hpp"
00010
00011 namespace MiX{
00017 template <class charT,class traitsT>
00018 class Element
00019 : boost::noncopyable,
00020 public NodeContainer<charT,traitsT>,
00021 public NamedNode<charT,traitsT>{
00022 public:
00023 MiX_Template_Typedef(charT,traitsT);
00024 typedef Element<charT,traitsT> this_type;
00025 typedef NodeContainer<charT,traitsT> nodecontainer_type;
00026 private:
00027 const static typename nodelist_type::iterator dmy_it;
00028 protected:
00035 Element(const string_type& name)
00036 : NodeContainer<charT,traitsT>(),
00037 NamedNode<charT,traitsT>(name){ };
00038 public:
00040 virtual ~Element()throw(){ };
00042 virtual NodeType getType()const{ return Node_Element; };
00048 static NodeType type(){ return Node_Element; };
00055 this_type& operator() (const string_type& name,int index=0){
00056 return getElement(name,index);
00057 };
00064 attribute_type& operator[] (const string_type& name){
00065 return getAttribute(name);
00066 };
00072 virtual string_type toString(bool is_indent=false,int indent_off=0)const;
00073
00075 string_type getText()const;
00076
00078 void setText(const XMLString<charT,traitsT>& s);
00085 this_type& clone(this_type& parent,const typename nodelist_type::iterator& it = dmy_it) const;
00093 static this_type& create(const string_type& name,this_type& parent,const typename nodelist_type::iterator& it = dmy_it);
00094
00095
00096 #ifdef MiX_BACKWARD_COMPATIBILITY //後方互換性維持
00097
00098 string_type getAllChildValue(){ return getText(); }
00099 #endif
00100
00101 friend class DOM_Parser<charT,traitsT>;
00102 friend class Document<charT,traitsT>;
00103 };
00104 }
00105
00106 #ifndef MIX_ELEMENT_CPP_
00107 #include "Element.cpp"
00108 #endif
00109
00110 #endif