aboutsummaryrefslogtreecommitdiff
path: root/mod/types-parsers.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-23 15:27:06 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-24 12:04:28 +0300
commitc96ccf5e3cd131e9f3edbd3516b0251dd4461071 (patch)
tree3cb58d2207efce5d91af118d6126d166bfab5975 /mod/types-parsers.cxx
parent69ceb5c44c1a2d1799279d49b066a75c5fe53089 (diff)
Add repository_url type parser
Backup
Diffstat (limited to 'mod/types-parsers.cxx')
-rw-r--r--mod/types-parsers.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/mod/types-parsers.cxx b/mod/types-parsers.cxx
index 6b0e721..e40a777 100644
--- a/mod/types-parsers.cxx
+++ b/mod/types-parsers.cxx
@@ -7,6 +7,7 @@
#include <mod/options.hxx>
using namespace std;
+using namespace bpkg;
using namespace web::xhtml;
namespace brep
@@ -50,6 +51,30 @@ namespace brep
parse_path (x, s);
}
+ // Parse repository_url.
+ //
+ void parser<repository_url>::
+ parse (repository_url& x, bool& xs, scanner& s)
+ {
+ xs = true;
+
+ const char* o (s.next ());
+
+ if (!s.more ())
+ throw missing_value (o);
+
+ const char* v (s.next ());
+
+ try
+ {
+ x = repository_url (v);
+ }
+ catch (const invalid_argument&)
+ {
+ throw invalid_value (o, v);
+ }
+ }
+
// Parse page_form.
//
void parser<page_form>::