summaryrefslogtreecommitdiff
path: root/odb/semantics/relational/elements.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/semantics/relational/elements.hxx')
-rw-r--r--odb/semantics/relational/elements.hxx49
1 files changed, 43 insertions, 6 deletions
diff --git a/odb/semantics/relational/elements.hxx b/odb/semantics/relational/elements.hxx
index 851fbb3..76a92bc 100644
--- a/odb/semantics/relational/elements.hxx
+++ b/odb/semantics/relational/elements.hxx
@@ -15,6 +15,9 @@
#include <cutl/container/pointer-iterator.hxx>
#include <cutl/compiler/context.hxx>
+#include <cutl/xml/parser.hxx>
+#include <cutl/xml/serializer.hxx>
+
#include <odb/semantics/relational/name.hxx>
namespace semantics
@@ -25,16 +28,22 @@ namespace semantics
using std::string;
- using container::graph;
using container::pointer_iterator;
-
using compiler::context;
+ typedef unsigned int version;
+
+ //
+ //
+ extern string const xmlns;
+
//
//
class node;
class edge;
+ typedef container::graph<node, edge> graph;
+
//
//
class edge: public context
@@ -65,6 +74,12 @@ namespace semantics
virtual string
kind () const = 0;
+ // XML serialization.
+ //
+ public:
+ virtual void
+ serialize (xml::serializer&) const = 0;
+
public:
template <typename X>
bool
@@ -190,6 +205,21 @@ namespace semantics
using node::add_edge_right;
+ protected:
+ nameable (xml::parser&, graph& g);
+
+ void
+ serialize_attributes (xml::serializer&) const;
+
+ public:
+ typedef void (*parser_func) (xml::parser&, scope_type&, graph&);
+ typedef std::map<std::string, parser_func> parser_map;
+ static parser_map parser_map_;
+
+ template <typename T>
+ static void
+ parser_impl (xml::parser&, scope_type&, graph&);
+
private:
string id_;
names_type* named_;
@@ -264,6 +294,10 @@ namespace semantics
// Find.
//
+ template <typename T>
+ T*
+ find (name_type const&);
+
names_iterator
find (name_type const&);
@@ -277,14 +311,17 @@ namespace semantics
find (names_type const&) const;
public:
- scope ()
- : first_key_ (names_.end ())
- {
- }
+ scope (): first_key_ (names_.end ()) {}
void
add_edge_left (names_type&);
+ protected:
+ scope (xml::parser&, graph&);
+
+ void
+ serialize_content (xml::serializer&) const;
+
private:
names_list names_;
names_map names_map_;