diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-10-15 21:08:04 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-10-17 15:02:42 +0300 |
commit | de91921561092689369b56c54950474e0a86e66f (patch) | |
tree | a9949058021d911db1106b1a2e4d9e0e9281de16 /openssl/types.cxx | |
parent | fb65c93daaf369157bd712f2c4c20161c4840b94 (diff) |
Add implementation
Diffstat (limited to 'openssl/types.cxx')
-rw-r--r-- | openssl/types.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/openssl/types.cxx b/openssl/types.cxx new file mode 100644 index 0000000..6acde44 --- /dev/null +++ b/openssl/types.cxx @@ -0,0 +1,29 @@ +// file : openssl/types.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <openssl/types.hxx> + +namespace openssl +{ + string + to_string (simulate_outcome s) + { + switch (s) + { + case simulate_outcome::success: return "success"; + case simulate_outcome::failure: return "failure"; + } + + assert (false); + return string (); + } + + simulate_outcome + to_simulate_outcome (const string& s) + { + if (s == "success") return simulate_outcome::success; + else if (s == "failure") return simulate_outcome::failure; + else throw invalid_argument ("invalid simulate outcome '" + s + "'"); + } +} |