00001
00002 #ifndef MIX_ATTRIBUTE_H_
00003 #define MIX_ATTRIBUTE_H_
00004
00005 #include "classes.h"
00006 #include "misc.h"
00007 #include "XMLString.h"
00008 #include "NamedNode.h"
00009 #include "Value.h"
00010 #include "extern/noncopyable.hpp"
00011 namespace MiX{
00017 template <class charT,class traitsT>
00018 class Attribute : boost::noncopyable,
00019 public Value<charT,traitsT> ,
00020 public NamedNode<charT,traitsT>{
00021 public:
00022 MiX_Template_Typedef(charT,traitsT);
00023 typedef Attribute<charT,traitsT> this_type;
00024 typedef NodeContainer<charT,traitsT> nodecontainer_type;
00025 protected:
00032 Attribute(const string_type& name,const string_type& val)
00033 : Value<charT,traitsT>(val),
00034 NamedNode<charT,traitsT>(name){ };
00035 public:
00037 virtual ~Attribute()throw() { };
00039 virtual NodeType getType()const { return Node_Attribute; };
00045 static NodeType type(){ return Node_Attribute; };
00051 virtual string_type toString(bool dmy=false,int dmy2=0)const;
00052
00058 this_type& clone(nodecontainer_type& parent) const
00059 { return attribute_type::create(getName(),getValue(),parent); };
00060
00068 static this_type& create(const string_type& key,const string_type& val,nodecontainer_type& parent);
00069
00070 friend class DOM_Parser<charT,traitsT>;
00071 };
00072 }
00073
00074 #ifndef MIX_ATTRIBUTE_CPP_
00075 #include "Attribute.cpp"
00076 #endif//MIX_ATTRIBUTE_CPP_
00077
00078 #endif