From 08b159e18527c2d6844e569b1309b5033b4d47c9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 16 Mar 2013 07:44:43 +0200 Subject: Add initial support for database model serialization to XML --- odb/semantics/relational/primary-key.cxx | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'odb/semantics/relational/primary-key.cxx') diff --git a/odb/semantics/relational/primary-key.cxx b/odb/semantics/relational/primary-key.cxx index f5e776d..480923d 100644 --- a/odb/semantics/relational/primary-key.cxx +++ b/odb/semantics/relational/primary-key.cxx @@ -3,13 +3,30 @@ // license : GNU GPL v3; see accompanying LICENSE file #include - -#include +#include namespace semantics { namespace relational { + primary_key:: + primary_key (xml::parser& p, uscope& s, graph& g) + : key (p, s, g), + auto__ (p.attribute ("auto", false)) + { + } + + void primary_key:: + serialize (xml::serializer& s) const + { + s.start_element (xmlns, "primary-key"); + key::serialize_attributes (s); + if (auto_ ()) + s.attribute ("auto", true); + key::serialize_content (s); + s.end_element (); + } + // type info // namespace @@ -18,10 +35,11 @@ namespace semantics { init () { + unameable::parser_map_["primary-key"] = + &unameable::parser_impl; + using compiler::type_info; - // primary_key - // { type_info ti (typeid (primary_key)); ti.add_base (typeid (unameable)); -- cgit v1.1