From 2700ed6a3e1092a064f28b07f8e2c4e5b9b830e7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 16 Nov 2015 20:02:06 +0200 Subject: Implement new URL path schema for the web interface --- brep/types-parsers.cxx | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'brep/types-parsers.cxx') diff --git a/brep/types-parsers.cxx b/brep/types-parsers.cxx index 6236000..f7f1c1b 100644 --- a/brep/types-parsers.cxx +++ b/brep/types-parsers.cxx @@ -4,16 +4,17 @@ #include -#include - +#include #include -using namespace butl; +using namespace std; namespace brep { namespace cli { + // Parse path. + // template static void parse_path (T& x, scanner& s) @@ -40,5 +41,24 @@ namespace brep { parse_path (x, s); } + + // Parse page_form. + // + void parser:: + parse (page_form& x, scanner& s) + { + const char* o (s.next ()); + + if (!s.more ()) + throw missing_value (o); + + const string v (s.next ()); + if (v == "full") + x = page_form::full; + else if (v == "brief") + x = page_form::brief; + else + throw invalid_value (o, v); + } } } -- cgit v1.1