diff options
Diffstat (limited to 'brep/types-parsers.cxx')
-rw-r--r-- | brep/types-parsers.cxx | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/brep/types-parsers.cxx b/brep/types-parsers.cxx deleted file mode 100644 index 67f4812..0000000 --- a/brep/types-parsers.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// file : brep/types-parsers.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include <brep/types-parsers> - -#include <brep/options> - -using namespace std; -using namespace web::xhtml; - -namespace brep -{ - namespace cli - { - // Parse path. - // - 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); - } - catch (const invalid_path&) - { - throw invalid_value (o, v); - } - } - - void parser<dir_path>:: - parse (dir_path& x, scanner& s) - { - parse_path (x, s); - } - - // Parse page_form. - // - void parser<page_form>:: - 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); - } - - // Parse page_menu. - // - void parser<page_menu>:: - parse (page_menu& x, scanner& s) - { - const char* o (s.next ()); - - if (!s.more ()) - throw missing_value (o); - - const string v (s.next ()); - - auto p (v.find ('=')); - if (p != string::npos) - { - string label (v, 0, p); - string link (v, p + 1); - - if (!label.empty ()) - { - x = page_menu (move (label), move (link)); - return; - } - } - - throw invalid_value (o, v); - } - - // Parse web::xhtml::fragment. - // - void parser<fragment>:: - parse (fragment& x, scanner& s) - { - const char* o (s.next ()); - - if (!s.more ()) - throw missing_value (o); - - const char* v (s.next ()); - - try - { - x = fragment (v, o); - } - catch (const xml::parsing&) - { - throw invalid_value (o, v); - } - } - } -} |