--- /dev/null
+
+#ifndef __Diff_hh__
+#define __Diff_hh__
+
+#include <GdomeSmartDOM.hh>
+
+#define XMLNS_NS_URI "http://www.w3.org/2000/xmlns/"
+#define DDIFF_NS_URI "http://helm.cs.unibo.it/2002/DDIFF"
+
+namespace GdomeSmartDOMExt
+{
+
+ using namespace GdomeSmartDOM;
+
+ class Diff
+ {
+ public:
+ typedef bool (*flatNodeEq)(const Node&, const Node&);
+ static bool defaultFlatNodeEq(const Node&, const Node&);
+
+ private:
+ Diff(const Node& n, const Document& d, flatNodeEq e) : dest(n), doc(d), eq(e) { };
+
+ public:
+ static Diff diff(const Document&, const Document&, flatNodeEq = defaultFlatNodeEq);
+ static Diff diff(const Element&, const Element&, flatNodeEq = defaultFlatNodeEq);
+
+ Document document(void) const { return doc; };
+ Node node(void) const { return dest; };
+
+ void patch(void) const;
+
+ struct BADDiff
+ {
+ BADDiff(const std::string& s) : msg(s) { };
+ const std::string msg;
+ };
+
+ private:
+ Node diffNodes(const Node&, const Node&) const;
+ bool diffChildren(const Node&, const Node&, const Node&) const;
+ void sameChunk(const Node&, unsigned long) const;
+ void patchRootNode(const Node&, const Element&) const;
+ void patchChildren(const Node&, const Element&) const;
+
+ Document doc;
+ Node dest;
+ flatNodeEq eq;
+ };
+
+}
+
+#endif // __ddiff_hh__