diff options
Diffstat (limited to 'bpkg/types-parsers.cxx')
-rw-r--r-- | bpkg/types-parsers.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bpkg/types-parsers.cxx b/bpkg/types-parsers.cxx index 6da395c..41b231f 100644 --- a/bpkg/types-parsers.cxx +++ b/bpkg/types-parsers.cxx @@ -67,5 +67,26 @@ namespace bpkg else throw invalid_value (o, v); } + + void parser<repository_type>:: + parse (repository_type& x, bool& xs, scanner& s) + { + xs = true; + const char* o (s.next ()); + + if (!s.more ()) + throw missing_value (o); + + const string v (s.next ()); + + try + { + x = to_repository_type(v); + } + catch (const invalid_argument&) + { + throw invalid_value (o, v); + } + } } } |