summaryrefslogtreecommitdiff
path: root/odb/semantics/relational/column.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-03-16 07:44:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-04-10 18:46:43 +0200
commit08b159e18527c2d6844e569b1309b5033b4d47c9 (patch)
tree224a1d6e7c989740e9be806c0f3cc7fc20266eb2 /odb/semantics/relational/column.cxx
parent9fe60de16cf9411a548c020cae5ac7b9e7938e82 (diff)
Add initial support for database model serialization to XML
Diffstat (limited to 'odb/semantics/relational/column.cxx')
-rw-r--r--odb/semantics/relational/column.cxx36
1 files changed, 32 insertions, 4 deletions
diff --git a/odb/semantics/relational/column.cxx b/odb/semantics/relational/column.cxx
index 52385cc..a4c39c3 100644
--- a/odb/semantics/relational/column.cxx
+++ b/odb/semantics/relational/column.cxx
@@ -3,13 +3,41 @@
// license : GNU GPL v3; see accompanying LICENSE file
#include <cutl/compiler/type-info.hxx>
-
-#include <odb/semantics/relational/column.hxx>
+#include <odb/semantics/relational.hxx>
namespace semantics
{
namespace relational
{
+ column::
+ column (xml::parser& p, uscope&, graph& g)
+ : unameable (p, g),
+ type_ (p.attribute ("type", string ())),
+ null_ (p.attribute<bool> ("null")),
+ default__ (p.attribute ("default", string ())),
+ options_ (p.attribute ("options", string ()))
+ {
+ p.content (xml::parser::empty);
+ }
+
+ void column::
+ serialize (xml::serializer& s) const
+ {
+ s.start_element (xmlns, "column");
+ unameable::serialize_attributes (s);
+
+ s.attribute ("type", type ());
+ s.attribute ("null", null ()); // Output even if false.
+
+ if (!default_ ().empty ())
+ s.attribute ("default", default_ ());
+
+ if (!options ().empty ())
+ s.attribute ("options", options ());
+
+ s.end_element ();
+ }
+
// type info
//
namespace
@@ -18,10 +46,10 @@ namespace semantics
{
init ()
{
+ unameable::parser_map_["column"] = &unameable::parser_impl<column>;
+
using compiler::type_info;
- // column
- //
{
type_info ti (typeid (column));
ti.add_base (typeid (unameable));