2 #ifndef __TDocument_hh__
3 #define __TDocument_hh__
8 class TDocument : private DOM::EventListener
15 TNode create(const std::string&, unsigned = 0) const;
16 TNode createG(unsigned id = 0) const { return create("g", id); };
17 TNode createC(const std::string&, unsigned = 0) const;
18 TNode createT(const std::string&, const std::string&, unsigned = 0) const;
19 TNode createI(const std::string& text, unsigned id = 0) const { return createT("i", text, id); };
20 TNode createN(const std::string& text, unsigned id = 0) const { return createT("n", text, id); };
21 TNode createO(const std::string& text, unsigned id = 0) const { return createT("o", text, id); };
23 DOM::Document document(void) const { return doc; };
25 TNode getNodeById(unsigned) const;
26 TNode root(void) { return doc.get_documentElement(); };
27 TNode dirtyNode(void) const { return dirty; };
28 void clearDirty(void) { dirty = DOM::Element(0); };
30 void serialize(const char*) const;
36 virtual void handleEvent(const DOM::Event&);
37 static std::string makeId(unsigned);
38 static TNode getNodeByIdAux(const TNode&, const std::string&);
39 static unsigned nodeDepth(const DOM::Node&);
40 static DOM::Node findCommonAncestor(const DOM::Node&, const DOM::Node&);
41 static DOM::Node findIdNode(const DOM::Node&);
44 #endif // __TDocument_hh__