aboutsummaryrefslogtreecommitdiff
path: root/openssl/types-parsers.cxx
blob: 57f789a6b6b2826e244882ac10d04f2a4ace9159 (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
// file      : openssl/types-parsers.cxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#include <openssl/types-parsers.hxx>

#include <openssl/options.hxx> // openssl::cli namespace

namespace openssl
{
  namespace cli
  {
    void parser<simulate_outcome>::
    parse (simulate_outcome& x, bool& xs, scanner& s)
    {
      xs = true;
      const char* o (s.next ());

      if (!s.more ())
        throw missing_value (o);

      const string v (s.next ());

      try
      {
        x = to_simulate_outcome (v);
      }
      catch (const invalid_argument&)
      {
        throw invalid_value (o, v);
      }
    }
  }
}