aboutsummaryrefslogtreecommitdiff
path: root/load/types-parsers.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-12 17:26:45 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-14 18:07:18 +0300
commite60108713590ccee83da7e2581a43fd5fda5c8ce (patch)
tree59650cce83b69e527040560482bba7c8513ab17e /load/types-parsers.cxx
parent8701276b3d98b5c6f927e2865ee6a915296033c1 (diff)
Add repository certificate info to the About page
Diffstat (limited to 'load/types-parsers.cxx')
-rw-r--r--load/types-parsers.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/load/types-parsers.cxx b/load/types-parsers.cxx
new file mode 100644
index 0000000..6c61daf
--- /dev/null
+++ b/load/types-parsers.cxx
@@ -0,0 +1,43 @@
+// file : load/types-parsers.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <load/types-parsers>
+
+#include <load/load-options> // cli namespace
+
+using namespace brep;
+
+namespace cli
+{
+ template <typename T>
+ static void
+ parse_path (T& x, scanner& s)
+ {
+ const char* o (s.next ());
+
+ if (!s.more ())
+ throw missing_value (o);
+
+ const char* v (s.next ());
+
+ try
+ {
+ x = T (v);
+
+ if (x.empty ())
+ throw invalid_value (o, v);
+ }
+ catch (const invalid_path&)
+ {
+ throw invalid_value (o, v);
+ }
+ }
+
+ void parser<path>::
+ parse (path& x, bool& xs, scanner& s)
+ {
+ xs = true;
+ parse_path (x, s);
+ }
+}