aboutsummaryrefslogtreecommitdiff
path: root/brep/types-parsers.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-21 16:05:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-21 16:05:13 +0200
commit2a0f39b29c1bea6a4497c0f1826052ffa453af9e (patch)
tree283f6bf1569c1b9f00b6e25fe986ccfff8a8629f /brep/types-parsers.cxx
parentc6b4d6c6489731eedba606d3c85c4319c4478b50 (diff)
Move module implementation from brep/ to mod/
Diffstat (limited to 'brep/types-parsers.cxx')
-rw-r--r--brep/types-parsers.cxx114
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);
- }
- }
- }
-}