From d868626d911092b18ef59ed794bfeca4e917a498 Mon Sep 17 00:00:00 2001 From: kohait Date: Sun, 4 Sep 2011 09:28:07 +0000 Subject: [PATCH] bazaar: Tree fixes git-svn-id: svn://ultimatepp.org/upp/trunk@3813 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/Tree/Tree.h | 63 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/bazaar/Tree/Tree.h b/bazaar/Tree/Tree.h index b0914ef16..186440cd4 100644 --- a/bazaar/Tree/Tree.h +++ b/bazaar/Tree/Tree.h @@ -129,7 +129,7 @@ class Node : public Tree > { public: - typedef Node CLASSNAME; + typedef Node CLASSNAME; typedef Tree > R; Node() {} @@ -317,13 +317,26 @@ public: friend void Swap(TreeMap& a, TreeMap& b) { a.B::Swap(b); for(int i = 0; i < a.GetCount(); i++) DoLink(a[i]); for(int i = 0; i < b.GetCount(); i++) b.DoLink(b[i]); } }; -template +NAMESPACE_UPP +template +inline void Xmlize(XmlIO xml, TreeMap& data) +{ + ::Xmlize(xml, (ArrayMap&)data); +} + +template +inline void DumpContainer(Stream& s, const TreeMap& c) { + DumpContainer(s, c.Begin(), c.End()); +} +END_UPP_NAMESPACE + +template > class MapNode - : public TreeMap > + : public TreeMap, H> { public: - typedef MapNode CLASSNAME; - typedef TreeMap > R; + typedef MapNode CLASSNAME; + typedef TreeMap, H> R; MapNode() {} MapNode(const T& leaf) : leaf(leaf) {} @@ -331,4 +344,44 @@ public: T leaf; }; +NAMESPACE_UPP +template +inline Stream& operator%(Stream& s, MapNode& x) +{ + s % x.leaf % (TreeMap, H>&)x; + return s; +} + +template +inline void Xmlize(XmlIO xml, MapNode& a) +{ + xml("leaf", a.leaf); ::Xmlize(xml, (TreeMap, H>&)a); +} +END_UPP_NAMESPACE + +template > //B conflicts with Tree::B +class MapNodeB + : public TreeMap, H> + , public BB //leaf +{ +public: + typedef MapNodeB CLASSNAME; + typedef TreeMap, H> R; +}; + +NAMESPACE_UPP +template +inline Stream& operator%(Stream& s, MapNodeB& x) +{ + s % (BB&)x % (TreeMap, H>&)x; + return s; +} + +template +inline void Xmlize(XmlIO xml, MapNodeB& a) +{ + xml("leaf", (BB&)a); ::Xmlize(xml, (TreeMap, H>&)a); +} +END_UPP_NAMESPACE + #endif