diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-03-20 13:27:25 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-03-20 13:55:44 +0300 |
commit | 115e8dc4c5042d805ce929530bb10b05d6fbf250 (patch) | |
tree | d57e053a395857dff1da348cae7790914091878b /cli/cli/pregenerated/cli/options.cxx | |
parent | 6e32dd9c26d26bd98bdd074a6d68d1efed95f8df (diff) |
Add support for std::multimap
Diffstat (limited to 'cli/cli/pregenerated/cli/options.cxx')
-rw-r--r-- | cli/cli/pregenerated/cli/options.cxx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/cli/cli/pregenerated/cli/options.cxx b/cli/cli/pregenerated/cli/options.cxx index 99aa50d..9f0be5f 100644 --- a/cli/cli/pregenerated/cli/options.cxx +++ b/cli/cli/pregenerated/cli/options.cxx @@ -676,6 +676,56 @@ namespace cli } }; + template <typename K, typename V, typename C> + struct parser<std::multimap<K, V, C> > + { + static void + parse (std::multimap<K, V, C>& m, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (s.more ()) + { + std::size_t pos (s.position ()); + std::string ov (s.next ()); + std::string::size_type p = ov.find ('='); + + K k = K (); + V v = V (); + std::string kstr (ov, 0, p); + std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); + + int ac (2); + char* av[] = + { + const_cast<char*> (o), + 0 + }; + + bool dummy; + if (!kstr.empty ()) + { + av[1] = const_cast<char*> (kstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<K>::parse (k, dummy, s); + } + + if (!vstr.empty ()) + { + av[1] = const_cast<char*> (vstr.c_str ()); + argv_scanner s (0, ac, av, false, pos); + parser<V>::parse (v, dummy, s); + } + + m.insert (typename std::multimap<K, V, C>::value_type (k, v)); + } + else + throw missing_value (o); + + xs = true; + } + }; + template <typename X, typename T, T X::*M> void thunk (X& x, scanner& s) |