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/foreign-key.hxx | 53 +++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'odb/semantics/relational/foreign-key.hxx') diff --git a/odb/semantics/relational/foreign-key.hxx b/odb/semantics/relational/foreign-key.hxx index d4419dd..1c00873 100644 --- a/odb/semantics/relational/foreign-key.hxx +++ b/odb/semantics/relational/foreign-key.hxx @@ -5,6 +5,8 @@ #ifndef ODB_SEMANTICS_RELATIONAL_FOREIGN_KEY_HXX #define ODB_SEMANTICS_RELATIONAL_FOREIGN_KEY_HXX +#include + #include #include @@ -15,24 +17,6 @@ namespace semantics class foreign_key: public key { public: - enum action - { - no_action, - cascade - }; - - foreign_key (string const& id, - qname const& referenced_table, - bool deferred, - action on_delete = no_action) - : key (id), - referenced_table_ (referenced_table), - deferred_ (deferred), - on_delete_ (on_delete) - { - } - - public: qname const& referenced_table () const { @@ -60,26 +44,53 @@ namespace semantics return deferred_; } - public: - action + enum action_type + { + no_action, + cascade + }; + + action_type on_delete () const { return on_delete_; } public: + foreign_key (string const& id, + qname const& referenced_table, + bool deferred, + action_type on_delete = no_action) + : key (id), + referenced_table_ (referenced_table), + deferred_ (deferred), + on_delete_ (on_delete) + { + } + + foreign_key (xml::parser&, uscope&, graph&); + virtual string kind () const { return "foreign key"; } + virtual void + serialize (xml::serializer&) const; + private: qname referenced_table_; columns referenced_columns_; bool deferred_; - action on_delete_; + action_type on_delete_; }; + + std::ostream& + operator<< (std::ostream&, foreign_key::action_type); + + std::istream& + operator>> (std::istream&, foreign_key::action_type&); } } -- cgit v1.1