diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-16 07:44:43 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-04-10 18:46:43 +0200 |
commit | 08b159e18527c2d6844e569b1309b5033b4d47c9 (patch) | |
tree | 224a1d6e7c989740e9be806c0f3cc7fc20266eb2 /odb/semantics/relational/foreign-key.hxx | |
parent | 9fe60de16cf9411a548c020cae5ac7b9e7938e82 (diff) |
Add initial support for database model serialization to XML
Diffstat (limited to 'odb/semantics/relational/foreign-key.hxx')
-rw-r--r-- | odb/semantics/relational/foreign-key.hxx | 53 |
1 files changed, 32 insertions, 21 deletions
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 <iosfwd> + #include <odb/semantics/relational/elements.hxx> #include <odb/semantics/relational/key.hxx> @@ -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&); } } |