summaryrefslogtreecommitdiff
path: root/xsd/cxx/option-types.cxx
blob: 383e453e99edb550ed2bb5fdfa3facedf0e34806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// file      : xsd/cxx/option-types.cxx
// copyright : Copyright (c) 2005-2017 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#include <istream>
#include <ostream>

#include <cxx/option-types.hxx>

using namespace std;

namespace CXX
{
  //
  // cxx_version
  //

  static const char* cxx_version_[] =
  {
    "c++98",
    "c++11"
  };

  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
        is.setstate (istream::failbit);
    }

    return is;
  }
}