aboutsummaryrefslogtreecommitdiff
path: root/openssl/types-parsers.cxx
blob: 4b96c657d5fa2cdf7d20a832b4e1749ba29ca509 (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
// file      : openssl/types-parsers.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
// 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);
      }
    }
  }
}