From bb811b27cffbeb4c24d9d3f2e739f99eab8299ec Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 23 Feb 2012 10:47:16 +0200 Subject: Add --std option that allows selecting between C++98 and C++11 --- odb/option-types.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'odb/option-types.cxx') diff --git a/odb/option-types.cxx b/odb/option-types.cxx index cfe1f06..3bbe72e 100644 --- a/odb/option-types.cxx +++ b/odb/option-types.cxx @@ -12,6 +12,41 @@ using namespace std; // +// cxx_version +// + +static const char* cxx_version_[] = +{ + "c++98", + "c++11" +}; + +const char* cxx_version:: +string () const +{ + return cxx_version_[v_]; +} + +istream& +operator>> (istream& is, cxx_version& v) +{ + string s; + is >> s; + + if (!is.fail ()) + { + if (s == "c++98") + v = cxx_version::cxx98; + else if (s == "c++11") + v = cxx_version::cxx11; + else + is.setstate (istream::failbit); + } + + return is; +} + +// // database // -- cgit v1.1