From 03905bcf1bcfd9e7932fcac4283c5817058a25ce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 14 Nov 2015 16:29:22 +0200 Subject: Invent root path web interface configuration option --- brep/types-parsers.cxx | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 brep/types-parsers.cxx (limited to 'brep/types-parsers.cxx') diff --git a/brep/types-parsers.cxx b/brep/types-parsers.cxx new file mode 100644 index 0000000..f7c2f11 --- /dev/null +++ b/brep/types-parsers.cxx @@ -0,0 +1,47 @@ +// file : brep/types-parsers.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +#include + +#include + +using namespace butl; + +namespace brep +{ + namespace cli + { + template + 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:: + parse (dir_path& x, scanner& s) + { + parse_path (x, s); + } + } +} -- cgit v1.1