From 720c5a33b6a49cf328fdd7611f49153cf8f60247 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 8 Apr 2020 14:51:57 +0300 Subject: Separate tests and examples into individual packages Also make cli module to be explicitly enabled via the config.cli configuration variable. --- cli/cli/option-types.cxx | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 cli/cli/option-types.cxx (limited to 'cli/cli/option-types.cxx') diff --git a/cli/cli/option-types.cxx b/cli/cli/option-types.cxx new file mode 100644 index 0000000..da1f434 --- /dev/null +++ b/cli/cli/option-types.cxx @@ -0,0 +1,43 @@ +// file : cli/option-types.cxx +// author : Boris Kolpackov +// license : MIT; see accompanying LICENSE file + +#include + +#include + +using namespace std; + +static const char* cxx_version_[] = +{ + "c++98", + "c++11" + "c++14" +}; + +string 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 if (s == "c++14") + v = cxx_version::cxx14; + else + is.setstate (istream::failbit); + } + + return is; +} -- cgit v1.1