diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-12-23 19:05:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-12-28 17:39:03 +0300 |
commit | 42ae47c3033a8c9ce70f1e6fb4c88ed70ac679fb (patch) | |
tree | bdd2cdbf35b4dfbfbc77763156182f03d497ad16 /bpkg/types-parsers.cxx | |
parent | dc5296af63000cddc4b46fc205137c20578cb81f (diff) |
Add repository type detection
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); + } + } } } |