00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __embite_Element_h
00019 #define __embite_Element_h
00020
00021 #include "VariantValue.h"
00022 #include "ElementOwner.h"
00023 #include <memory>
00024
00025 namespace xmlpp
00026 {
00027 class Document;
00028 class Element;
00029 class Attribute;
00030 }
00031
00034 namespace embite
00035 {
00036
00039 class Element : public ElementOwner
00040 {
00041 public:
00042 Element(ElementOwner* owner,
00043 const Glib::ustring& name,
00044 const Glib::ustring& prefix = Glib::ustring(), const Glib::ustring& nsUri = Glib::ustring());
00045
00046 Element(xmlpp::Element* xElem, ElementOwner* owner = NULL);
00047
00048 ~Element();
00049
00052 Element* getSibling(const Glib::ustring& name, const Glib::ustring& nsUri = Glib::ustring(),
00053 Element* excludeList = NULL, ElementOwner* owner = NULL) const;
00054
00057 Element* getElement(const Glib::ustring& name, const Glib::ustring& nsUri = Glib::ustring(),
00058 Element* excludeList = NULL, ElementOwner* owner = NULL) const;
00059
00061 bool checkAttribute(const VariantValueIn& val, const Glib::ustring& name, const Glib::ustring& nsUri = Glib::ustring()) const;
00062
00064 bool getAttributeValue(VariantValueOut val, const Glib::ustring& name, const Glib::ustring& nsUri = Glib::ustring()) const;
00065
00067 bool checkValue(const VariantValueIn& val) const;
00068
00071 bool getValue(VariantValueOut val, Element* excludeList = NULL, ElementOwner* owner = NULL) const;
00072
00074 bool getValue(Element*& children, Element* excludeList = NULL, ElementOwner* owner = NULL) const;
00075
00077 Element* pNext;
00078
00081 static Element* createSibling(ElementOwner* owner,
00082 Element*& base,
00083 const Glib::ustring& name,
00084 const Glib::ustring& prefix = Glib::ustring(), const Glib::ustring& nsUri = Glib::ustring());
00085
00087 Element* createElement(const Glib::ustring& name,
00088 const Glib::ustring& prefix = Glib::ustring(), const Glib::ustring& nsUri = Glib::ustring());
00089
00091 void createAttribute(const Glib::ustring& name,
00092 const VariantValueIn& val,
00093 const Glib::ustring& prefix = Glib::ustring(), const Glib::ustring& nsUri = Glib::ustring());
00094
00096 void setValue(VariantValueIn val);
00097
00099 void setValue(Element* children);
00100
00102 xmlpp::Document* getDocument();
00103
00104 private:
00105 class Impl;
00106 std::auto_ptr<Impl> m_pImpl;
00107
00108 std::auto_ptr<xmlpp::Document> m_xDoc;
00109 xmlpp::Element* m_xElem;
00110
00111 bool equals(const xmlpp::Element* xElem) const
00112 {
00113 return (m_xElem == xElem);
00114 }
00115
00116 bool equalsFromList(const xmlpp::Element* xElem) const;
00117
00118 xmlpp::Attribute* getAttribute(const Glib::ustring& name, const Glib::ustring& nsUri) const;
00119
00120
00121 Element(const Element&);
00122 Element& operator = (const Element&);
00123 };
00124
00125 }
00126
00127 #endif // __embite_Element_h