diff options
Diffstat (limited to 'odb/option-types.cxx')
-rw-r--r-- | odb/option-types.cxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/odb/option-types.cxx b/odb/option-types.cxx index ceb71db..c52935e 100644 --- a/odb/option-types.cxx +++ b/odb/option-types.cxx @@ -52,6 +52,7 @@ operator>> (istream& is, cxx_version& v) static const char* database_[] = { + "common", "mssql", "mysql", "oracle", @@ -92,6 +93,50 @@ operator<< (ostream& os, database db) } // +// multi_database +// + +static const char* multi_database_[] = +{ + "dynamic", + "static", + "disabled" +}; + +const char* multi_database:: +string () const +{ + return multi_database_[v_]; +} + +istream& +operator>> (istream& is, multi_database& db) +{ + string s; + is >> s; + + if (!is.fail ()) + { + const char** e ( + multi_database_ + sizeof (multi_database_) / sizeof (char*) - 1); + const char** i (lower_bound (multi_database_, e, s)); + + if (i != e && *i == s) + db = multi_database::value (i - multi_database_); + else + is.setstate (istream::failbit); + } + + return is; +} + +ostream& +operator<< (ostream& os, multi_database db) +{ + return os << db.string (); +} + +// // schema_format // |