diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:21:29 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:21:29 +0200 |
commit | bada6666c70977a058755ccf232e7d67b24adeed (patch) | |
tree | 1e92d50cebce96abaf9bce19e36026c47f77b9ba /libcult/cult/cli | |
parent | eaf34adcbd8095bc6d1f3371b1227f654c7b19fc (diff) |
New upstream release
Diffstat (limited to 'libcult/cult/cli')
-rw-r--r-- | libcult/cult/cli/arguments.cxx | 22 | ||||
-rw-r--r-- | libcult/cult/cli/arguments.hxx | 85 | ||||
-rw-r--r-- | libcult/cult/cli/arguments.ixx | 21 | ||||
-rw-r--r-- | libcult/cult/cli/exceptions.hxx | 136 | ||||
-rw-r--r-- | libcult/cult/cli/file-arguments.cxx | 118 | ||||
-rw-r--r-- | libcult/cult/cli/file-arguments.hxx | 59 | ||||
-rw-r--r-- | libcult/cult/cli/mapper.hxx.m4 | 65 | ||||
-rw-r--r-- | libcult/cult/cli/options-parser.cxx | 40 | ||||
-rw-r--r-- | libcult/cult/cli/options-parser.hxx | 570 | ||||
-rw-r--r-- | libcult/cult/cli/options-parser.ixx | 12 | ||||
-rw-r--r-- | libcult/cult/cli/options-parser.txx | 34 | ||||
-rw-r--r-- | libcult/cult/cli/options-spec.cxx | 14 | ||||
-rw-r--r-- | libcult/cult/cli/options-spec.hxx | 723 | ||||
-rw-r--r-- | libcult/cult/cli/options-spec.ixx | 12 | ||||
-rw-r--r-- | libcult/cult/cli/options-spec.txx | 320 | ||||
-rw-r--r-- | libcult/cult/cli/options.cxx | 17 | ||||
-rw-r--r-- | libcult/cult/cli/options.hxx | 502 | ||||
-rw-r--r-- | libcult/cult/cli/options.ixx | 12 | ||||
-rw-r--r-- | libcult/cult/cli/options.txx | 320 | ||||
-rw-r--r-- | libcult/cult/cli/scanner.cxx | 17 | ||||
-rw-r--r-- | libcult/cult/cli/scanner.hxx | 132 | ||||
-rw-r--r-- | libcult/cult/cli/scanner.ixx | 12 |
22 files changed, 0 insertions, 3243 deletions
diff --git a/libcult/cult/cli/arguments.cxx b/libcult/cult/cli/arguments.cxx deleted file mode 100644 index 28805d0..0000000 --- a/libcult/cult/cli/arguments.cxx +++ /dev/null @@ -1,22 +0,0 @@ -// file : cult/cli/arguments.cxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cult/cli/arguments.hxx> - -namespace Cult -{ - namespace CLI - { - Arguments:: - ~Arguments () - { - } - - BasicArguments:: - ~BasicArguments () - { - } - } -} diff --git a/libcult/cult/cli/arguments.hxx b/libcult/cult/cli/arguments.hxx deleted file mode 100644 index 5381172..0000000 --- a/libcult/cult/cli/arguments.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// file : cult/cli/arguments.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_CLI_ARGUMENTS_HXX -#define CULT_CLI_ARGUMENTS_HXX - -#include <cult/types.hxx> - -#include <cult/cli/exceptions.hxx> - -namespace Cult -{ - namespace CLI - { - class Arguments: public NonCopyable - { - public: - virtual - ~Arguments (); - - public: - class Bounds: public virtual Exception {}; - - virtual Size - size () const = 0; - - virtual Char const* - operator[] (Index) const = 0; - - virtual Void - erase (Index) = 0; - }; - - class BasicArguments: public Arguments - { - public: - virtual - ~BasicArguments (); - - BasicArguments (Int& argc, Char** argv); - - public: - virtual Size - size () const - { - return static_cast<Size> (argc_); - } - - virtual Char const* - operator[] (Index i) const - { - if (i >= size ()) - throw Bounds (); - - return argv_[i]; - } - - virtual Void - erase (Index i) - { - if (i >= size ()) - throw Bounds (); - - for (++i; i < size (); ++i) - { - argv_[i - 1] = argv_[i]; - } - - --argc_; - - argv_[argc_] = 0; - } - - private: - Int& argc_; - Char** argv_; - }; - } -} - -#include <cult/cli/arguments.ixx> - -#endif // CULT_CLI_ARGUMENTS_HXX diff --git a/libcult/cult/cli/arguments.ixx b/libcult/cult/cli/arguments.ixx deleted file mode 100644 index b05295d..0000000 --- a/libcult/cult/cli/arguments.ixx +++ /dev/null @@ -1,21 +0,0 @@ -// file : cult/cli/arguments.ixx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cassert> - -namespace Cult -{ - namespace CLI - { - inline - BasicArguments:: - BasicArguments (Int& argc, Char** argv) - : argc_ (argc), argv_ (argv) - { - assert (argc > 0); - } - } -} - diff --git a/libcult/cult/cli/exceptions.hxx b/libcult/cult/cli/exceptions.hxx deleted file mode 100644 index 886e008..0000000 --- a/libcult/cult/cli/exceptions.hxx +++ /dev/null @@ -1,136 +0,0 @@ -// file : cult/cli/exceptions.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_CLI_EXCEPTIONS_HXX -#define CULT_CLI_EXCEPTIONS_HXX - -#include <cult/types.hxx> - -#include <cult/eh/exception.hxx> - -namespace Cult -{ - namespace CLI - { - // - // - class Exception: public virtual EH::Exception - { - }; - - // Exception for FileArguments class. - // - class OptionFile: public virtual Exception - { - public: - ~OptionFile () throw () - { - } - - OptionFile (String const& description) - : description_ (description) - { - } - - OptionFile (String const& value, - String const& description) - : value_ (value), description_ (description) - { - } - - String const& - value () const - { - return value_; - } - - String const& - description () const - { - return description_; - } - - private: - String value_; - String description_; - }; - - // - // - class UnexpectedOption: public virtual Exception - { - public: - ~UnexpectedOption () throw () - { - } - - UnexpectedOption (String const& option) - : option_ (option) - { - } - - String const& - option () const - { - return option_; - } - - private: - String option_; - }; - - - // - // - class UnexpectedArgument: public virtual Exception - { - public: - ~UnexpectedArgument () throw () - { - } - - UnexpectedArgument (String const& argument) - : argument_ (argument) - { - } - - String const& - argument () const - { - return argument_; - } - - private: - String argument_; - }; - - - // - // - class OptionFormat: public virtual Exception - { - public: - ~OptionFormat () throw () - { - } - - OptionFormat (String const& option) - : option_ (option) - { - } - - String const& - option () const - { - return option_; - } - - private: - String option_; - }; - } -} - -#endif // CULT_CLI_EXCEPTIONS_HXX diff --git a/libcult/cult/cli/file-arguments.cxx b/libcult/cult/cli/file-arguments.cxx deleted file mode 100644 index 4f082dc..0000000 --- a/libcult/cult/cli/file-arguments.cxx +++ /dev/null @@ -1,118 +0,0 @@ -// file : cult/cli/file-arguments.cxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cstring> // strcmp -#include <fstream> - -#include <cult/cli/file-arguments.hxx> - -namespace Cult -{ - namespace CLI - { - FileArguments:: - ~FileArguments () - { - } - - FileArguments:: - FileArguments (Int argc, Char const* const* argv, Char const* op) - { - using namespace std; - - if (argc == 0) - return; - - args_.push_back (argv[0]); - - Boolean skip (false); - - for (Int i (1); i < argc; ++i) - { - if (!skip) - { - if (strcmp (argv[i], "--") == 0) - { - skip = true; - } - else if (strcmp (argv[i], op) == 0) - { - ++i; - - if (i >= argc) - throw OptionFile ("missing file name"); - - ifstream is (argv[i]); - - if (!is.is_open ()) - throw OptionFile (argv[i], "unable to open in read mode"); - - while (!is.eof ()) - { - String line; - getline (is, line); - - if (is.fail () && !is.eof ()) - throw OptionFile (argv[i], "read failure"); - - Size size (line.size ()); - - // Trim the line from leading and trailing whitespaces. - // - if (size != 0) - { - const Char* f (line.data ()); - const Char* l (f + size); - - const Char* of (f); - while (f < l && (*f == ' ' || *f == '\t' || *f == '\r')) - ++f; - - --l; - - const Char* ol (l); - while (l > f && (*l == ' ' || *l == '\t' || *l == '\r')) - --l; - - if (f != of || l != ol) - line = f <= l ? String (f, l - f + 1) : String (); - } - - if (line.empty () || line[0] == '#') - continue; // Ignore empty lines, those that start with # - - Size pos (line.find (' ')); - - if (pos == String::npos) - args_.push_back (line); - else - { - Size size (line.size ()); - - args_.push_back (String (line, 0, pos)); - - // Skip leading whitespaces in the argument. - // - for (pos++; pos < size; pos++) - { - Char c (line[pos]); - - if (c != ' ' && c != '\t' && c != '\r') - break; - } - - args_.push_back (String (line, pos)); - } - } - - continue; - } - } - - args_.push_back (argv[i]); - } - } - } -} diff --git a/libcult/cult/cli/file-arguments.hxx b/libcult/cult/cli/file-arguments.hxx deleted file mode 100644 index e14f53c..0000000 --- a/libcult/cult/cli/file-arguments.hxx +++ /dev/null @@ -1,59 +0,0 @@ -// file : cult/cli/file-arguments.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_CLI_FILE_ARGUMENTS_HXX -#define CULT_CLI_FILE_ARGUMENTS_HXX - -#include <cult/types.hxx> -#include <cult/containers/vector.hxx> - -#include <cult/cli/exceptions.hxx> -#include <cult/cli/arguments.hxx> - -namespace Cult -{ - namespace CLI - { - class FileArguments: public Arguments - { - public: - virtual - ~FileArguments (); - - FileArguments (Int argc, - Char const* const* argv, - Char const* file_option); - public: - virtual Size - size () const - { - return args_.size (); - } - - virtual Char const* - operator[] (Index i) const - { - if (i >= size ()) - throw Bounds (); - - return args_[i].c_str (); - } - - virtual Void - erase (Index i) - { - if (i >= size ()) - throw Bounds (); - - args_.erase (args_.begin () + i); - } - - private: - Containers::Vector<String> args_; - }; - } -} - -#endif // CULT_CLI_FILE_ARGUMENTS_HXX diff --git a/libcult/cult/cli/mapper.hxx.m4 b/libcult/cult/cli/mapper.hxx.m4 deleted file mode 100644 index 7ac6760..0000000 --- a/libcult/cult/cli/mapper.hxx.m4 +++ /dev/null @@ -1,65 +0,0 @@ -divert(-1) - -# file : cult/cli/mapper.hxx.m4 -# author : Boris Kolpackov <boris@kolpackov.net> -# copyright : Copyright (c) 2005-2010 Boris Kolpackov -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -define(`N', 100) - -define(`forloop', - `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')') - -define(`_forloop', - `$4`'ifelse($1, `$3', , - `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')') - -define(`specialization',` -template -< -forloop(`i', 1, $1, ` char const* x`'i, typename Y`'i`'ifelse(i, $1, ,`,') -')dnl -> -struct Mapper -< -forloop(`i', 1, $1, ` x`'i, Y`'i, -')dnl -forloop(`i', $1, N, ` null, Null`'ifelse(i, N, ,`,') -')dnl -> -{ -`#ifdef __GNUC__' -forloop(`i', 1, $1, ` static Y`'i f (Tag<x`'i>*); -')dnl - - template <char const* x> - struct Selector - { - typedef typeof (Mapper::f ((Tag<x>*) (0))) Type; - }; -`#else' - template <char const* x> - struct Selector - { - typedef typename if_<same<x, x1>::r, Y1,ifelse($1, 1, ` Void', ` - typename Mapper - < -forloop(`i', 2, $1, ` x`'i, Y`'i`'ifelse(i, $1, ,`,') -') >::template Selector<x>::Type')>::Type Type; - }; -`#endif' -}; -') - -divert(0)dnl - -template -< -forloop(`i', 1, incr(N), - ` char const* x`'i`'ifelse(i, 1, ,`= null'), dnl -typename Y`'i`'ifelse(i, 1, ,`= Null')`'ifelse(i, incr(N), ,`,') -')dnl -> -struct Mapper; - -forloop(`n', 1, N, `specialization(n)') diff --git a/libcult/cult/cli/options-parser.cxx b/libcult/cult/cli/options-parser.cxx deleted file mode 100644 index 4a2b6b3..0000000 --- a/libcult/cult/cli/options-parser.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// file : cult/cli/options-parser.cxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cult/cli/options-parser.hxx> - -namespace Cult -{ - namespace CLI - { - Trace::Stream OptionsParserBase::tout ("Cult::CLI::OptionsParser", 7); - - - // OptionParserBooleanBase - // - Boolean OptionParserBooleanBase:: - parse (Char const*, Scanner&) - { - return true; - } - - // OptionParserStringBase - // - String OptionParserStringBase:: - parse (Char const* o, Scanner& s) - { - Char const* v (s.next ()); - - if (v == Scanner::eos) - { - //@@ "expected string literal after --option"? - // - throw OptionFormat (o); - } - - return v; - } - } -} diff --git a/libcult/cult/cli/options-parser.hxx b/libcult/cult/cli/options-parser.hxx deleted file mode 100644 index 4068fa6..0000000 --- a/libcult/cult/cli/options-parser.hxx +++ /dev/null @@ -1,570 +0,0 @@ -// file : cult/cli/options-parser.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_CLI_OPTIONS_PARSER_HXX -#define CULT_CLI_OPTIONS_PARSER_HXX - -#include <cult/types.hxx> - -#include <cult/containers/map.hxx> -#include <cult/containers/vector.hxx> - -#include <cult/trace/stream.hxx> - -#include <cult/cli/exceptions.hxx> -#include <cult/cli/scanner.hxx> -#include <cult/cli/options-spec.hxx> - -#include <sstream> - -//@! which types should be NonCopyable - -namespace Cult -{ - namespace CLI - { - struct UnknownMode - { - enum Value - { - skip, - stop, - fail - }; - }; - - template <typename T> - struct OptionParserBase - { - T - parse (Char const* o, Scanner& s); - }; - - template <typename Spec> - struct OptionParser: OptionParserBase<typename Spec::Type> - { - OptionParser (Spec const&) - { - } - }; - - template<Char const* o, typename T> - class OptionParser<OptionSpec<o, Containers::Vector<T> > > - { - public: - OptionParser (OptionSpec<o, Containers::Vector<T> > const&) - : impl_ (OptionSpec<o, T> ()) - { - } - - T - parse (Char const* k, Scanner& s) - { - return impl_.parse (k, s); - } - - private: - OptionParser<OptionSpec<o, T> > impl_; - }; - - struct OptionParserBooleanBase - { - Boolean - parse (Char const*, Scanner& s); - }; - - template<Char const* o> - struct OptionParser<OptionSpec<o, Boolean> >: OptionParserBooleanBase - { - OptionParser (OptionSpec<o, Boolean> const&) - { - } - }; - - struct OptionParserStringBase - { - String - parse (Char const*, Scanner& s); - }; - - template<Char const* o> - struct OptionParser<OptionSpec<o, String> >: OptionParserStringBase - { - OptionParser (OptionSpec<o, String> const&) - { - } - }; - - // - // - // - - class OptionsParserBase - { - protected: - struct GlueBase - { - // I am using Void* here to (significantly) reduce the length - // on the object file symbols. - // - virtual Void - operator() (Char const*, Scanner&, Void* options) = 0; - }; - - static Trace::Stream tout; - }; - - template <typename Spec> - class OptionsParser : OptionsParserBase - { - typedef - Containers::Map<String, Evptr<GlueBase> > - Map; - - template <typename> - struct Glue; - - template <Char const* k, typename T> - struct Glue<OptionSpec<k, T> > : GlueBase - { - Glue (OptionSpec<k, T> const& spec) - : parser_ (spec) - { - } - - virtual Void - operator() (Char const* o, Scanner& scan, Void* options) - { - typedef typename Spec::Options Options; - - Options& ops (*reinterpret_cast<Options*> (options)); - - ops.template value<k> () = parser_.parse (o, scan); - } - - private: - OptionParser<OptionSpec<k, T> > parser_; - }; - - //@@ It's bad that I also have to specialize Glue. Need to redesign - // this. - // - template <Char const* k, typename T> - struct Glue<OptionSpec<k, Containers::Vector<T> > > : GlueBase - { - Glue (OptionSpec<k, Containers::Vector<T> > const& spec) - : parser_ (spec) - { - } - - virtual Void - operator() (Char const* o, Scanner& scan, Void* options) - { - typedef typename Spec::Options Options; - - Options& ops (*reinterpret_cast<Options*> (options)); - - ops.template value<k> ().push_back (parser_.parse (o, scan)); - } - - private: - OptionParser<OptionSpec<k, Containers::Vector<T> > > parser_; - }; - - - // Option-specific specializations of some functions. - // - template <typename> - struct S_ - { - // This is a "specialization" for when type is Bits::Null. - // - static Void - add_parser (Spec const&, Map&) - { - } - - static Void - set_default (typename Spec::Options&, Spec const&) - { - } - }; - - template <Char const* k, typename T> - struct S_<OptionSpec<k, T> > - { - static Void - add_parser (Spec const& spec, Map& map) - { - if (k[0] != '\0') - { - OptionSpec<k, T> const& os (spec.template option<k> ()); - map[os.name ()] = new Glue<OptionSpec<k, T> > (os); - } - } - - static Void - set_default (typename Spec::Options& o, Spec const& s) - { - o.template value<k> () = s.template option<k> ().default_value (); - } - }; - - public: - - OptionsParser (Spec const& spec) - : spec_ (spec) - { - S_<typename Spec::o01>::add_parser (spec_, map_); - S_<typename Spec::o02>::add_parser (spec_, map_); - S_<typename Spec::o03>::add_parser (spec_, map_); - S_<typename Spec::o04>::add_parser (spec_, map_); - S_<typename Spec::o05>::add_parser (spec_, map_); - S_<typename Spec::o06>::add_parser (spec_, map_); - S_<typename Spec::o07>::add_parser (spec_, map_); - S_<typename Spec::o08>::add_parser (spec_, map_); - S_<typename Spec::o09>::add_parser (spec_, map_); - S_<typename Spec::o10>::add_parser (spec_, map_); - S_<typename Spec::o11>::add_parser (spec_, map_); - S_<typename Spec::o12>::add_parser (spec_, map_); - S_<typename Spec::o13>::add_parser (spec_, map_); - S_<typename Spec::o14>::add_parser (spec_, map_); - S_<typename Spec::o15>::add_parser (spec_, map_); - S_<typename Spec::o16>::add_parser (spec_, map_); - S_<typename Spec::o17>::add_parser (spec_, map_); - S_<typename Spec::o18>::add_parser (spec_, map_); - S_<typename Spec::o19>::add_parser (spec_, map_); - S_<typename Spec::o20>::add_parser (spec_, map_); - S_<typename Spec::o21>::add_parser (spec_, map_); - S_<typename Spec::o22>::add_parser (spec_, map_); - S_<typename Spec::o23>::add_parser (spec_, map_); - S_<typename Spec::o24>::add_parser (spec_, map_); - S_<typename Spec::o25>::add_parser (spec_, map_); - S_<typename Spec::o26>::add_parser (spec_, map_); - S_<typename Spec::o27>::add_parser (spec_, map_); - S_<typename Spec::o28>::add_parser (spec_, map_); - S_<typename Spec::o29>::add_parser (spec_, map_); - S_<typename Spec::o30>::add_parser (spec_, map_); - S_<typename Spec::o31>::add_parser (spec_, map_); - S_<typename Spec::o32>::add_parser (spec_, map_); - S_<typename Spec::o33>::add_parser (spec_, map_); - S_<typename Spec::o34>::add_parser (spec_, map_); - S_<typename Spec::o35>::add_parser (spec_, map_); - S_<typename Spec::o36>::add_parser (spec_, map_); - S_<typename Spec::o37>::add_parser (spec_, map_); - S_<typename Spec::o38>::add_parser (spec_, map_); - S_<typename Spec::o39>::add_parser (spec_, map_); - S_<typename Spec::o40>::add_parser (spec_, map_); - S_<typename Spec::o41>::add_parser (spec_, map_); - S_<typename Spec::o42>::add_parser (spec_, map_); - S_<typename Spec::o43>::add_parser (spec_, map_); - S_<typename Spec::o44>::add_parser (spec_, map_); - S_<typename Spec::o45>::add_parser (spec_, map_); - S_<typename Spec::o46>::add_parser (spec_, map_); - S_<typename Spec::o47>::add_parser (spec_, map_); - S_<typename Spec::o48>::add_parser (spec_, map_); - S_<typename Spec::o49>::add_parser (spec_, map_); - S_<typename Spec::o50>::add_parser (spec_, map_); - S_<typename Spec::o51>::add_parser (spec_, map_); - S_<typename Spec::o52>::add_parser (spec_, map_); - S_<typename Spec::o53>::add_parser (spec_, map_); - S_<typename Spec::o54>::add_parser (spec_, map_); - S_<typename Spec::o55>::add_parser (spec_, map_); - S_<typename Spec::o56>::add_parser (spec_, map_); - S_<typename Spec::o57>::add_parser (spec_, map_); - S_<typename Spec::o58>::add_parser (spec_, map_); - S_<typename Spec::o59>::add_parser (spec_, map_); - S_<typename Spec::o60>::add_parser (spec_, map_); - S_<typename Spec::o61>::add_parser (spec_, map_); - S_<typename Spec::o62>::add_parser (spec_, map_); - S_<typename Spec::o63>::add_parser (spec_, map_); - S_<typename Spec::o64>::add_parser (spec_, map_); - S_<typename Spec::o65>::add_parser (spec_, map_); - S_<typename Spec::o66>::add_parser (spec_, map_); - S_<typename Spec::o67>::add_parser (spec_, map_); - S_<typename Spec::o68>::add_parser (spec_, map_); - S_<typename Spec::o69>::add_parser (spec_, map_); - S_<typename Spec::o70>::add_parser (spec_, map_); - S_<typename Spec::o71>::add_parser (spec_, map_); - S_<typename Spec::o72>::add_parser (spec_, map_); - S_<typename Spec::o73>::add_parser (spec_, map_); - S_<typename Spec::o74>::add_parser (spec_, map_); - S_<typename Spec::o75>::add_parser (spec_, map_); - S_<typename Spec::o76>::add_parser (spec_, map_); - S_<typename Spec::o77>::add_parser (spec_, map_); - S_<typename Spec::o78>::add_parser (spec_, map_); - S_<typename Spec::o79>::add_parser (spec_, map_); - S_<typename Spec::o80>::add_parser (spec_, map_); - S_<typename Spec::o81>::add_parser (spec_, map_); - S_<typename Spec::o82>::add_parser (spec_, map_); - S_<typename Spec::o83>::add_parser (spec_, map_); - S_<typename Spec::o84>::add_parser (spec_, map_); - S_<typename Spec::o85>::add_parser (spec_, map_); - S_<typename Spec::o86>::add_parser (spec_, map_); - S_<typename Spec::o87>::add_parser (spec_, map_); - S_<typename Spec::o88>::add_parser (spec_, map_); - S_<typename Spec::o89>::add_parser (spec_, map_); - S_<typename Spec::o90>::add_parser (spec_, map_); - S_<typename Spec::o91>::add_parser (spec_, map_); - S_<typename Spec::o92>::add_parser (spec_, map_); - S_<typename Spec::o93>::add_parser (spec_, map_); - S_<typename Spec::o94>::add_parser (spec_, map_); - S_<typename Spec::o95>::add_parser (spec_, map_); - S_<typename Spec::o96>::add_parser (spec_, map_); - S_<typename Spec::o97>::add_parser (spec_, map_); - S_<typename Spec::o98>::add_parser (spec_, map_); - S_<typename Spec::o99>::add_parser (spec_, map_); - S_<typename Spec::o100>::add_parser (spec_, map_); - } - - - typename Spec::Options - parse (Scanner& scan, - UnknownMode::Value option_mode = UnknownMode::fail, - UnknownMode::Value argument_mode = UnknownMode::stop) - { - typename Spec::Options ops; - - S_<typename Spec::o01>::set_default (ops, spec_); - S_<typename Spec::o02>::set_default (ops, spec_); - S_<typename Spec::o03>::set_default (ops, spec_); - S_<typename Spec::o04>::set_default (ops, spec_); - S_<typename Spec::o05>::set_default (ops, spec_); - S_<typename Spec::o06>::set_default (ops, spec_); - S_<typename Spec::o07>::set_default (ops, spec_); - S_<typename Spec::o08>::set_default (ops, spec_); - S_<typename Spec::o09>::set_default (ops, spec_); - S_<typename Spec::o10>::set_default (ops, spec_); - S_<typename Spec::o11>::set_default (ops, spec_); - S_<typename Spec::o12>::set_default (ops, spec_); - S_<typename Spec::o13>::set_default (ops, spec_); - S_<typename Spec::o14>::set_default (ops, spec_); - S_<typename Spec::o15>::set_default (ops, spec_); - S_<typename Spec::o16>::set_default (ops, spec_); - S_<typename Spec::o17>::set_default (ops, spec_); - S_<typename Spec::o18>::set_default (ops, spec_); - S_<typename Spec::o19>::set_default (ops, spec_); - S_<typename Spec::o20>::set_default (ops, spec_); - S_<typename Spec::o21>::set_default (ops, spec_); - S_<typename Spec::o22>::set_default (ops, spec_); - S_<typename Spec::o23>::set_default (ops, spec_); - S_<typename Spec::o24>::set_default (ops, spec_); - S_<typename Spec::o25>::set_default (ops, spec_); - S_<typename Spec::o26>::set_default (ops, spec_); - S_<typename Spec::o27>::set_default (ops, spec_); - S_<typename Spec::o28>::set_default (ops, spec_); - S_<typename Spec::o29>::set_default (ops, spec_); - S_<typename Spec::o30>::set_default (ops, spec_); - S_<typename Spec::o31>::set_default (ops, spec_); - S_<typename Spec::o32>::set_default (ops, spec_); - S_<typename Spec::o33>::set_default (ops, spec_); - S_<typename Spec::o34>::set_default (ops, spec_); - S_<typename Spec::o35>::set_default (ops, spec_); - S_<typename Spec::o36>::set_default (ops, spec_); - S_<typename Spec::o37>::set_default (ops, spec_); - S_<typename Spec::o38>::set_default (ops, spec_); - S_<typename Spec::o39>::set_default (ops, spec_); - S_<typename Spec::o40>::set_default (ops, spec_); - S_<typename Spec::o41>::set_default (ops, spec_); - S_<typename Spec::o42>::set_default (ops, spec_); - S_<typename Spec::o43>::set_default (ops, spec_); - S_<typename Spec::o44>::set_default (ops, spec_); - S_<typename Spec::o45>::set_default (ops, spec_); - S_<typename Spec::o46>::set_default (ops, spec_); - S_<typename Spec::o47>::set_default (ops, spec_); - S_<typename Spec::o48>::set_default (ops, spec_); - S_<typename Spec::o49>::set_default (ops, spec_); - S_<typename Spec::o50>::set_default (ops, spec_); - S_<typename Spec::o51>::set_default (ops, spec_); - S_<typename Spec::o52>::set_default (ops, spec_); - S_<typename Spec::o53>::set_default (ops, spec_); - S_<typename Spec::o54>::set_default (ops, spec_); - S_<typename Spec::o55>::set_default (ops, spec_); - S_<typename Spec::o56>::set_default (ops, spec_); - S_<typename Spec::o57>::set_default (ops, spec_); - S_<typename Spec::o58>::set_default (ops, spec_); - S_<typename Spec::o59>::set_default (ops, spec_); - S_<typename Spec::o60>::set_default (ops, spec_); - S_<typename Spec::o61>::set_default (ops, spec_); - S_<typename Spec::o62>::set_default (ops, spec_); - S_<typename Spec::o63>::set_default (ops, spec_); - S_<typename Spec::o64>::set_default (ops, spec_); - S_<typename Spec::o65>::set_default (ops, spec_); - S_<typename Spec::o66>::set_default (ops, spec_); - S_<typename Spec::o67>::set_default (ops, spec_); - S_<typename Spec::o68>::set_default (ops, spec_); - S_<typename Spec::o69>::set_default (ops, spec_); - S_<typename Spec::o70>::set_default (ops, spec_); - S_<typename Spec::o71>::set_default (ops, spec_); - S_<typename Spec::o72>::set_default (ops, spec_); - S_<typename Spec::o73>::set_default (ops, spec_); - S_<typename Spec::o74>::set_default (ops, spec_); - S_<typename Spec::o75>::set_default (ops, spec_); - S_<typename Spec::o76>::set_default (ops, spec_); - S_<typename Spec::o77>::set_default (ops, spec_); - S_<typename Spec::o78>::set_default (ops, spec_); - S_<typename Spec::o79>::set_default (ops, spec_); - S_<typename Spec::o80>::set_default (ops, spec_); - S_<typename Spec::o81>::set_default (ops, spec_); - S_<typename Spec::o82>::set_default (ops, spec_); - S_<typename Spec::o83>::set_default (ops, spec_); - S_<typename Spec::o84>::set_default (ops, spec_); - S_<typename Spec::o85>::set_default (ops, spec_); - S_<typename Spec::o86>::set_default (ops, spec_); - S_<typename Spec::o87>::set_default (ops, spec_); - S_<typename Spec::o88>::set_default (ops, spec_); - S_<typename Spec::o89>::set_default (ops, spec_); - S_<typename Spec::o90>::set_default (ops, spec_); - S_<typename Spec::o91>::set_default (ops, spec_); - S_<typename Spec::o92>::set_default (ops, spec_); - S_<typename Spec::o93>::set_default (ops, spec_); - S_<typename Spec::o94>::set_default (ops, spec_); - S_<typename Spec::o95>::set_default (ops, spec_); - S_<typename Spec::o96>::set_default (ops, spec_); - S_<typename Spec::o97>::set_default (ops, spec_); - S_<typename Spec::o98>::set_default (ops, spec_); - S_<typename Spec::o99>::set_default (ops, spec_); - S_<typename Spec::o100>::set_default (ops, spec_); - - for (Char const* s (scan.peek ()); s != Scanner::eos; s = scan.peek ()) - { - tout << "looking at \"" << s << "\""; - - //@@ Std:: - // - if (strcmp (s, "--") == 0) - { - // We don't want to remove '--' if our option mode is skip. - // - if (option_mode == UnknownMode::skip) - scan.skip (); - else - scan.next (); - - break; - } - - typename Map::ConstIterator it (map_.find (s)); - - if (it != map_.end ()) - { - tout << "found parser for \"" << s << "\""; - - s = scan.next (); - (*(it->second)) (s, scan, &ops); - } - else if (s[0] == '-') - { - // Unknown option. - // - switch (option_mode) - { - case UnknownMode::skip: - { - scan.skip (); - continue; - } - case UnknownMode::stop: - { - break; - } - case UnknownMode::fail: - { - throw UnexpectedOption (s); - } - } - - break; // stop case - } - else - { - // Something else. - // - switch (argument_mode) - { - case UnknownMode::skip: - { - scan.skip (); - continue; - } - case UnknownMode::stop: - { - break; - } - case UnknownMode::fail: - { - throw UnexpectedArgument (s); - } - } - - break; // stop case - } - } - - return ops; - } - - private: - Map map_; - Spec spec_; - }; - - // - // - // - - template <typename Spec> - typename Spec::Options - parse (Spec const& s, - Arguments& args, - UnknownMode::Value option_mode = UnknownMode::fail, - UnknownMode::Value argument_mode = UnknownMode::stop) - { - Scanner scan (args, Scanner::Action::erase); - OptionsParser<Spec> parser (s); - - return parser.parse (scan, option_mode, argument_mode); - } - - template <typename Options> - Options - parse (Arguments& args, - UnknownMode::Value option_mode = UnknownMode::fail, - UnknownMode::Value argument_mode = UnknownMode::stop) - { - OptionsSpec<Options> spec; - return parse (spec, args, option_mode, argument_mode); - } - - template <typename Spec> - typename Spec::Options - parse (Spec const& s, - Int& argc, - Char** argv, - UnknownMode::Value option_mode = UnknownMode::fail, - UnknownMode::Value argument_mode = UnknownMode::stop) - { - BasicArguments args (argc, argv); - return parse (s, args, option_mode, argument_mode); - } - - template <typename Options> - Options - parse (Int& argc, - Char** argv, - UnknownMode::Value option_mode = UnknownMode::fail, - UnknownMode::Value argument_mode = UnknownMode::stop) - { - OptionsSpec<Options> spec; - - return parse (spec, argc, argv, option_mode, argument_mode); - } - } -} - -#include <cult/cli/options-parser.ixx> -#include <cult/cli/options-parser.txx> - -#endif // CULT_CLI_OPTIONS_PARSER_HXX diff --git a/libcult/cult/cli/options-parser.ixx b/libcult/cult/cli/options-parser.ixx deleted file mode 100644 index 80427f2..0000000 --- a/libcult/cult/cli/options-parser.ixx +++ /dev/null @@ -1,12 +0,0 @@ -// file : cult/cli/options-parser.ixx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -namespace Cult -{ - namespace CLI - { - } -} - diff --git a/libcult/cult/cli/options-parser.txx b/libcult/cult/cli/options-parser.txx deleted file mode 100644 index bd8172a..0000000 --- a/libcult/cult/cli/options-parser.txx +++ /dev/null @@ -1,34 +0,0 @@ -// file : cult/cli/options-parser.txx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -namespace Cult -{ - namespace CLI - { - // OptionParserBase - // - template <typename T> - T OptionParserBase<T>:: - parse (Char const* o, Scanner& s) - { - Char const* v (s.next ()); - - //@@ "expected something after --option"? - // - if (v == Scanner::eos) - throw OptionFormat (o); - - T r; - std::istringstream is (v); - is >> r; - - if (is.fail () || !is.eof ()) - throw OptionFormat (o); - - return r; - } - } -} - diff --git a/libcult/cult/cli/options-spec.cxx b/libcult/cult/cli/options-spec.cxx deleted file mode 100644 index 9f1e43b..0000000 --- a/libcult/cult/cli/options-spec.cxx +++ /dev/null @@ -1,14 +0,0 @@ -// file : cult/cli/options-spec.cxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cult/cli/options-spec.hxx> - -namespace Cult -{ - namespace CLI - { - } -} - diff --git a/libcult/cult/cli/options-spec.hxx b/libcult/cult/cli/options-spec.hxx deleted file mode 100644 index aff4541..0000000 --- a/libcult/cult/cli/options-spec.hxx +++ /dev/null @@ -1,723 +0,0 @@ -// file : cult/cli/options-spec.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_CLI_OPTIONS_SPEC_HXX -#define CULT_CLI_OPTIONS_SPEC_HXX - -#include <cult/types.hxx> - -#include <cult/cli/options.hxx> - -namespace Cult -{ - namespace CLI - { - template <Char const* k, typename T> - class OptionSpec - { - public: - static Char const* const key; - typedef T Type; - - public: - ~OptionSpec () - { - } - - OptionSpec () - : default_value_ (), - name_ ("--") - { - name_ += k; - } - - T const& - default_value () const - { - return default_value_; - } - - Void - default_value (T const& value) - { - default_value_ = value; - } - - //@@ bad name - // - Char const* - name () const - { - return name_.c_str (); - } - - private: - T default_value_; - String name_; - }; - - template <Char const* k, typename T> - struct OptionSpecType - { - typedef OptionSpec<k, T> Type; - }; - - template <> - struct OptionSpecType<Bits::null, Bits::Null> - { - typedef Bits::Null Type; - }; - - - template <Char const* k, typename T> - Char const* const OptionSpec<k, T>::key = k; - - template <typename> - class OptionsSpec; - - template <Char const* k01, typename T01, - Char const* k02, typename T02, - Char const* k03, typename T03, - Char const* k04, typename T04, - Char const* k05, typename T05, - Char const* k06, typename T06, - Char const* k07, typename T07, - Char const* k08, typename T08, - Char const* k09, typename T09, - Char const* k10, typename T10, - Char const* k11, typename T11, - Char const* k12, typename T12, - Char const* k13, typename T13, - Char const* k14, typename T14, - Char const* k15, typename T15, - Char const* k16, typename T16, - Char const* k17, typename T17, - Char const* k18, typename T18, - Char const* k19, typename T19, - Char const* k20, typename T20, - Char const* k21, typename T21, - Char const* k22, typename T22, - Char const* k23, typename T23, - Char const* k24, typename T24, - Char const* k25, typename T25, - Char const* k26, typename T26, - Char const* k27, typename T27, - Char const* k28, typename T28, - Char const* k29, typename T29, - Char const* k30, typename T30, - Char const* k31, typename T31, - Char const* k32, typename T32, - Char const* k33, typename T33, - Char const* k34, typename T34, - Char const* k35, typename T35, - Char const* k36, typename T36, - Char const* k37, typename T37, - Char const* k38, typename T38, - Char const* k39, typename T39, - Char const* k40, typename T40, - Char const* k41, typename T41, - Char const* k42, typename T42, - Char const* k43, typename T43, - Char const* k44, typename T44, - Char const* k45, typename T45, - Char const* k46, typename T46, - Char const* k47, typename T47, - Char const* k48, typename T48, - Char const* k49, typename T49, - Char const* k50, typename T50, - Char const* k51, typename T51, - Char const* k52, typename T52, - Char const* k53, typename T53, - Char const* k54, typename T54, - Char const* k55, typename T55, - Char const* k56, typename T56, - Char const* k57, typename T57, - Char const* k58, typename T58, - Char const* k59, typename T59, - Char const* k60, typename T60, - Char const* k61, typename T61, - Char const* k62, typename T62, - Char const* k63, typename T63, - Char const* k64, typename T64, - Char const* k65, typename T65, - Char const* k66, typename T66, - Char const* k67, typename T67, - Char const* k68, typename T68, - Char const* k69, typename T69, - Char const* k70, typename T70, - Char const* k71, typename T71, - Char const* k72, typename T72, - Char const* k73, typename T73, - Char const* k74, typename T74, - Char const* k75, typename T75, - Char const* k76, typename T76, - Char const* k77, typename T77, - Char const* k78, typename T78, - Char const* k79, typename T79, - Char const* k80, typename T80, - Char const* k81, typename T81, - Char const* k82, typename T82, - Char const* k83, typename T83, - Char const* k84, typename T84, - Char const* k85, typename T85, - Char const* k86, typename T86, - Char const* k87, typename T87, - Char const* k88, typename T88, - Char const* k89, typename T89, - Char const* k90, typename T90, - Char const* k91, typename T91, - Char const* k92, typename T92, - Char const* k93, typename T93, - Char const* k94, typename T94, - Char const* k95, typename T95, - Char const* k96, typename T96, - Char const* k97, typename T97, - Char const* k98, typename T98, - Char const* k99, typename T99, - Char const* k100, typename T100> - - class OptionsSpec<Options<k01, T01, - k02, T02, - k03, T03, - k04, T04, - k05, T05, - k06, T06, - k07, T07, - k08, T08, - k09, T09, - k10, T10, - k11, T11, - k12, T12, - k13, T13, - k14, T14, - k15, T15, - k16, T16, - k17, T17, - k18, T18, - k19, T19, - k20, T20, - k21, T21, - k22, T22, - k23, T23, - k24, T24, - k25, T25, - k26, T26, - k27, T27, - k28, T28, - k29, T29, - k30, T30, - k31, T31, - k32, T32, - k33, T33, - k34, T34, - k35, T35, - k36, T36, - k37, T37, - k38, T38, - k39, T39, - k40, T40, - k41, T41, - k42, T42, - k43, T43, - k44, T44, - k45, T45, - k46, T46, - k47, T47, - k48, T48, - k49, T49, - k50, T50, - k51, T51, - k52, T52, - k53, T53, - k54, T54, - k55, T55, - k56, T56, - k57, T57, - k58, T58, - k59, T59, - k60, T60, - k61, T61, - k62, T62, - k63, T63, - k64, T64, - k65, T65, - k66, T66, - k67, T67, - k68, T68, - k69, T69, - k70, T70, - k71, T71, - k72, T72, - k73, T73, - k74, T74, - k75, T75, - k76, T76, - k77, T77, - k78, T78, - k79, T79, - k80, T80, - k81, T81, - k82, T82, - k83, T83, - k84, T84, - k85, T85, - k86, T86, - k87, T87, - k88, T88, - k89, T89, - k90, T90, - k91, T91, - k92, T92, - k93, T93, - k94, T94, - k95, T95, - k96, T96, - k97, T97, - k98, T98, - k99, T99, - k100, T100> > - { - public: - typedef CLI::Options<k01, T01, - k02, T02, - k03, T03, - k04, T04, - k05, T05, - k06, T06, - k07, T07, - k08, T08, - k09, T09, - k10, T10, - k11, T11, - k12, T12, - k13, T13, - k14, T14, - k15, T15, - k16, T16, - k17, T17, - k18, T18, - k19, T19, - k20, T20, - k21, T21, - k22, T22, - k23, T23, - k24, T24, - k25, T25, - k26, T26, - k27, T27, - k28, T28, - k29, T29, - k30, T30, - k31, T31, - k32, T32, - k33, T33, - k34, T34, - k35, T35, - k36, T36, - k37, T37, - k38, T38, - k39, T39, - k40, T40, - k41, T41, - k42, T42, - k43, T43, - k44, T44, - k45, T45, - k46, T46, - k47, T47, - k48, T48, - k49, T49, - k50, T50, - k51, T51, - k52, T52, - k53, T53, - k54, T54, - k55, T55, - k56, T56, - k57, T57, - k58, T58, - k59, T59, - k60, T60, - k61, T61, - k62, T62, - k63, T63, - k64, T64, - k65, T65, - k66, T66, - k67, T67, - k68, T68, - k69, T69, - k70, T70, - k71, T71, - k72, T72, - k73, T73, - k74, T74, - k75, T75, - k76, T76, - k77, T77, - k78, T78, - k79, T79, - k80, T80, - k81, T81, - k82, T82, - k83, T83, - k84, T84, - k85, T85, - k86, T86, - k87, T87, - k88, T88, - k89, T89, - k90, T90, - k91, T91, - k92, T92, - k93, T93, - k94, T94, - k95, T95, - k96, T96, - k97, T97, - k98, T98, - k99, T99, - k100, T100> Options; - - typedef typename OptionSpecType<k01, T01>::Type o01; - typedef typename OptionSpecType<k02, T02>::Type o02; - typedef typename OptionSpecType<k03, T03>::Type o03; - typedef typename OptionSpecType<k04, T04>::Type o04; - typedef typename OptionSpecType<k05, T05>::Type o05; - typedef typename OptionSpecType<k06, T06>::Type o06; - typedef typename OptionSpecType<k07, T07>::Type o07; - typedef typename OptionSpecType<k08, T08>::Type o08; - typedef typename OptionSpecType<k09, T09>::Type o09; - typedef typename OptionSpecType<k10, T10>::Type o10; - typedef typename OptionSpecType<k11, T11>::Type o11; - typedef typename OptionSpecType<k12, T12>::Type o12; - typedef typename OptionSpecType<k13, T13>::Type o13; - typedef typename OptionSpecType<k14, T14>::Type o14; - typedef typename OptionSpecType<k15, T15>::Type o15; - typedef typename OptionSpecType<k16, T16>::Type o16; - typedef typename OptionSpecType<k17, T17>::Type o17; - typedef typename OptionSpecType<k18, T18>::Type o18; - typedef typename OptionSpecType<k19, T19>::Type o19; - typedef typename OptionSpecType<k20, T20>::Type o20; - typedef typename OptionSpecType<k21, T21>::Type o21; - typedef typename OptionSpecType<k22, T22>::Type o22; - typedef typename OptionSpecType<k23, T23>::Type o23; - typedef typename OptionSpecType<k24, T24>::Type o24; - typedef typename OptionSpecType<k25, T25>::Type o25; - typedef typename OptionSpecType<k26, T26>::Type o26; - typedef typename OptionSpecType<k27, T27>::Type o27; - typedef typename OptionSpecType<k28, T28>::Type o28; - typedef typename OptionSpecType<k29, T29>::Type o29; - typedef typename OptionSpecType<k30, T30>::Type o30; - typedef typename OptionSpecType<k31, T31>::Type o31; - typedef typename OptionSpecType<k32, T32>::Type o32; - typedef typename OptionSpecType<k33, T33>::Type o33; - typedef typename OptionSpecType<k34, T34>::Type o34; - typedef typename OptionSpecType<k35, T35>::Type o35; - typedef typename OptionSpecType<k36, T36>::Type o36; - typedef typename OptionSpecType<k37, T37>::Type o37; - typedef typename OptionSpecType<k38, T38>::Type o38; - typedef typename OptionSpecType<k39, T39>::Type o39; - typedef typename OptionSpecType<k40, T40>::Type o40; - typedef typename OptionSpecType<k41, T41>::Type o41; - typedef typename OptionSpecType<k42, T42>::Type o42; - typedef typename OptionSpecType<k43, T43>::Type o43; - typedef typename OptionSpecType<k44, T44>::Type o44; - typedef typename OptionSpecType<k45, T45>::Type o45; - typedef typename OptionSpecType<k46, T46>::Type o46; - typedef typename OptionSpecType<k47, T47>::Type o47; - typedef typename OptionSpecType<k48, T48>::Type o48; - typedef typename OptionSpecType<k49, T49>::Type o49; - typedef typename OptionSpecType<k50, T50>::Type o50; - typedef typename OptionSpecType<k51, T51>::Type o51; - typedef typename OptionSpecType<k52, T52>::Type o52; - typedef typename OptionSpecType<k53, T53>::Type o53; - typedef typename OptionSpecType<k54, T54>::Type o54; - typedef typename OptionSpecType<k55, T55>::Type o55; - typedef typename OptionSpecType<k56, T56>::Type o56; - typedef typename OptionSpecType<k57, T57>::Type o57; - typedef typename OptionSpecType<k58, T58>::Type o58; - typedef typename OptionSpecType<k59, T59>::Type o59; - typedef typename OptionSpecType<k60, T60>::Type o60; - typedef typename OptionSpecType<k61, T61>::Type o61; - typedef typename OptionSpecType<k62, T62>::Type o62; - typedef typename OptionSpecType<k63, T63>::Type o63; - typedef typename OptionSpecType<k64, T64>::Type o64; - typedef typename OptionSpecType<k65, T65>::Type o65; - typedef typename OptionSpecType<k66, T66>::Type o66; - typedef typename OptionSpecType<k67, T67>::Type o67; - typedef typename OptionSpecType<k68, T68>::Type o68; - typedef typename OptionSpecType<k69, T69>::Type o69; - typedef typename OptionSpecType<k70, T70>::Type o70; - typedef typename OptionSpecType<k71, T71>::Type o71; - typedef typename OptionSpecType<k72, T72>::Type o72; - typedef typename OptionSpecType<k73, T73>::Type o73; - typedef typename OptionSpecType<k74, T74>::Type o74; - typedef typename OptionSpecType<k75, T75>::Type o75; - typedef typename OptionSpecType<k76, T76>::Type o76; - typedef typename OptionSpecType<k77, T77>::Type o77; - typedef typename OptionSpecType<k78, T78>::Type o78; - typedef typename OptionSpecType<k79, T79>::Type o79; - typedef typename OptionSpecType<k80, T80>::Type o80; - typedef typename OptionSpecType<k81, T81>::Type o81; - typedef typename OptionSpecType<k82, T82>::Type o82; - typedef typename OptionSpecType<k83, T83>::Type o83; - typedef typename OptionSpecType<k84, T84>::Type o84; - typedef typename OptionSpecType<k85, T85>::Type o85; - typedef typename OptionSpecType<k86, T86>::Type o86; - typedef typename OptionSpecType<k87, T87>::Type o87; - typedef typename OptionSpecType<k88, T88>::Type o88; - typedef typename OptionSpecType<k89, T89>::Type o89; - typedef typename OptionSpecType<k90, T90>::Type o90; - typedef typename OptionSpecType<k91, T91>::Type o91; - typedef typename OptionSpecType<k92, T92>::Type o92; - typedef typename OptionSpecType<k93, T93>::Type o93; - typedef typename OptionSpecType<k94, T94>::Type o94; - typedef typename OptionSpecType<k95, T95>::Type o95; - typedef typename OptionSpecType<k96, T96>::Type o96; - typedef typename OptionSpecType<k97, T97>::Type o97; - typedef typename OptionSpecType<k98, T98>::Type o98; - typedef typename OptionSpecType<k99, T99>::Type o99; - typedef typename OptionSpecType<k100, T100>::Type o100; - - - private: - typedef Bits::Mapper<k01, o01, - k02, o02, - k03, o03, - k04, o04, - k05, o05, - k06, o06, - k07, o07, - k08, o08, - k09, o09, - k10, o10, - k11, o11, - k12, o12, - k13, o13, - k14, o14, - k15, o15, - k16, o16, - k17, o17, - k18, o18, - k19, o19, - k20, o20, - k21, o21, - k22, o22, - k23, o23, - k24, o24, - k25, o25, - k26, o26, - k27, o27, - k28, o28, - k29, o29, - k30, o30, - k31, o31, - k32, o32, - k33, o33, - k34, o34, - k35, o35, - k36, o36, - k37, o37, - k38, o38, - k39, o39, - k40, o40, - k41, o41, - k42, o42, - k43, o43, - k44, o44, - k45, o45, - k46, o46, - k47, o47, - k48, o48, - k49, o49, - k50, o50, - k51, o51, - k52, o52, - k53, o53, - k54, o54, - k55, o55, - k56, o56, - k57, o57, - k58, o58, - k59, o59, - k60, o60, - k61, o61, - k62, o62, - k63, o63, - k64, o64, - k65, o65, - k66, o66, - k67, o67, - k68, o68, - k69, o69, - k70, o70, - k71, o71, - k72, o72, - k73, o73, - k74, o74, - k75, o75, - k76, o76, - k77, o77, - k78, o78, - k79, o79, - k80, o80, - k81, o81, - k82, o82, - k83, o83, - k84, o84, - k85, o85, - k86, o86, - k87, o87, - k88, o88, - k89, o89, - k90, o90, - k91, o91, - k92, o92, - k93, o93, - k94, o94, - k95, o95, - k96, o96, - k97, o97, - k98, o98, - k99, o99, - k100, o100> Mapper; - - public: - template <Char const* k> - typename Mapper::template Selector<k>::Type& - option () - { - typedef - typename Mapper::template Selector<k>::Type - Type; - - return *reinterpret_cast<Type*> (option (k)); - } - - template <Char const* k> - typename Mapper::template Selector<k>::Type const& - option () const - { - typedef - typename Mapper::template Selector<k>::Type - Type; - - return *reinterpret_cast<Type const*> (option (k)); - } - - private: - Void* - option (Char const*) const; - - private: - o01 o01_; - o02 o02_; - o03 o03_; - o04 o04_; - o05 o05_; - o06 o06_; - o07 o07_; - o08 o08_; - o09 o09_; - o10 o10_; - o11 o11_; - o12 o12_; - o13 o13_; - o14 o14_; - o15 o15_; - o16 o16_; - o17 o17_; - o18 o18_; - o19 o19_; - o20 o20_; - o21 o21_; - o22 o22_; - o23 o23_; - o24 o24_; - o25 o25_; - o26 o26_; - o27 o27_; - o28 o28_; - o29 o29_; - o30 o30_; - o31 o31_; - o32 o32_; - o33 o33_; - o34 o34_; - o35 o35_; - o36 o36_; - o37 o37_; - o38 o38_; - o39 o39_; - o40 o40_; - o41 o41_; - o42 o42_; - o43 o43_; - o44 o44_; - o45 o45_; - o46 o46_; - o47 o47_; - o48 o48_; - o49 o49_; - o50 o50_; - o51 o51_; - o52 o52_; - o53 o53_; - o54 o54_; - o55 o55_; - o56 o56_; - o57 o57_; - o58 o58_; - o59 o59_; - o60 o60_; - o61 o61_; - o62 o62_; - o63 o63_; - o64 o64_; - o65 o65_; - o66 o66_; - o67 o67_; - o68 o68_; - o69 o69_; - o70 o70_; - o71 o71_; - o72 o72_; - o73 o73_; - o74 o74_; - o75 o75_; - o76 o76_; - o77 o77_; - o78 o78_; - o79 o79_; - o80 o80_; - o81 o81_; - o82 o82_; - o83 o83_; - o84 o84_; - o85 o85_; - o86 o86_; - o87 o87_; - o88 o88_; - o89 o89_; - o90 o90_; - o91 o91_; - o92 o92_; - o93 o93_; - o94 o94_; - o95 o95_; - o96 o96_; - o97 o97_; - o98 o98_; - o99 o99_; - o100 o100_; - }; - } -} - -#include <cult/cli/options-spec.ixx> -#include <cult/cli/options-spec.txx> - -#endif // CULT_CLI_OPTIONS_SPEC_HXX diff --git a/libcult/cult/cli/options-spec.ixx b/libcult/cult/cli/options-spec.ixx deleted file mode 100644 index 1c47da1..0000000 --- a/libcult/cult/cli/options-spec.ixx +++ /dev/null @@ -1,12 +0,0 @@ -// file : cult/cli/options-spec.ixx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -namespace Cult -{ - namespace CLI - { - } -} - diff --git a/libcult/cult/cli/options-spec.txx b/libcult/cult/cli/options-spec.txx deleted file mode 100644 index f5d59a0..0000000 --- a/libcult/cult/cli/options-spec.txx +++ /dev/null @@ -1,320 +0,0 @@ -// file : cult/cli/options-spec.txx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -namespace Cult -{ - namespace CLI - { - template <Char const* k01, typename T01, - Char const* k02, typename T02, - Char const* k03, typename T03, - Char const* k04, typename T04, - Char const* k05, typename T05, - Char const* k06, typename T06, - Char const* k07, typename T07, - Char const* k08, typename T08, - Char const* k09, typename T09, - Char const* k10, typename T10, - Char const* k11, typename T11, - Char const* k12, typename T12, - Char const* k13, typename T13, - Char const* k14, typename T14, - Char const* k15, typename T15, - Char const* k16, typename T16, - Char const* k17, typename T17, - Char const* k18, typename T18, - Char const* k19, typename T19, - Char const* k20, typename T20, - Char const* k21, typename T21, - Char const* k22, typename T22, - Char const* k23, typename T23, - Char const* k24, typename T24, - Char const* k25, typename T25, - Char const* k26, typename T26, - Char const* k27, typename T27, - Char const* k28, typename T28, - Char const* k29, typename T29, - Char const* k30, typename T30, - Char const* k31, typename T31, - Char const* k32, typename T32, - Char const* k33, typename T33, - Char const* k34, typename T34, - Char const* k35, typename T35, - Char const* k36, typename T36, - Char const* k37, typename T37, - Char const* k38, typename T38, - Char const* k39, typename T39, - Char const* k40, typename T40, - Char const* k41, typename T41, - Char const* k42, typename T42, - Char const* k43, typename T43, - Char const* k44, typename T44, - Char const* k45, typename T45, - Char const* k46, typename T46, - Char const* k47, typename T47, - Char const* k48, typename T48, - Char const* k49, typename T49, - Char const* k50, typename T50, - Char const* k51, typename T51, - Char const* k52, typename T52, - Char const* k53, typename T53, - Char const* k54, typename T54, - Char const* k55, typename T55, - Char const* k56, typename T56, - Char const* k57, typename T57, - Char const* k58, typename T58, - Char const* k59, typename T59, - Char const* k60, typename T60, - Char const* k61, typename T61, - Char const* k62, typename T62, - Char const* k63, typename T63, - Char const* k64, typename T64, - Char const* k65, typename T65, - Char const* k66, typename T66, - Char const* k67, typename T67, - Char const* k68, typename T68, - Char const* k69, typename T69, - Char const* k70, typename T70, - Char const* k71, typename T71, - Char const* k72, typename T72, - Char const* k73, typename T73, - Char const* k74, typename T74, - Char const* k75, typename T75, - Char const* k76, typename T76, - Char const* k77, typename T77, - Char const* k78, typename T78, - Char const* k79, typename T79, - Char const* k80, typename T80, - Char const* k81, typename T81, - Char const* k82, typename T82, - Char const* k83, typename T83, - Char const* k84, typename T84, - Char const* k85, typename T85, - Char const* k86, typename T86, - Char const* k87, typename T87, - Char const* k88, typename T88, - Char const* k89, typename T89, - Char const* k90, typename T90, - Char const* k91, typename T91, - Char const* k92, typename T92, - Char const* k93, typename T93, - Char const* k94, typename T94, - Char const* k95, typename T95, - Char const* k96, typename T96, - Char const* k97, typename T97, - Char const* k98, typename T98, - Char const* k99, typename T99, - Char const* k100, typename T100> - Void* - OptionsSpec<Options<k01, T01, - k02, T02, - k03, T03, - k04, T04, - k05, T05, - k06, T06, - k07, T07, - k08, T08, - k09, T09, - k10, T10, - k11, T11, - k12, T12, - k13, T13, - k14, T14, - k15, T15, - k16, T16, - k17, T17, - k18, T18, - k19, T19, - k20, T20, - k21, T21, - k22, T22, - k23, T23, - k24, T24, - k25, T25, - k26, T26, - k27, T27, - k28, T28, - k29, T29, - k30, T30, - k31, T31, - k32, T32, - k33, T33, - k34, T34, - k35, T35, - k36, T36, - k37, T37, - k38, T38, - k39, T39, - k40, T40, - k41, T41, - k42, T42, - k43, T43, - k44, T44, - k45, T45, - k46, T46, - k47, T47, - k48, T48, - k49, T49, - k50, T50, - k51, T51, - k52, T52, - k53, T53, - k54, T54, - k55, T55, - k56, T56, - k57, T57, - k58, T58, - k59, T59, - k60, T60, - k61, T61, - k62, T62, - k63, T63, - k64, T64, - k65, T65, - k66, T66, - k67, T67, - k68, T68, - k69, T69, - k70, T70, - k71, T71, - k72, T72, - k73, T73, - k74, T74, - k75, T75, - k76, T76, - k77, T77, - k78, T78, - k79, T79, - k80, T80, - k81, T81, - k82, T82, - k83, T83, - k84, T84, - k85, T85, - k86, T86, - k87, T87, - k88, T88, - k89, T89, - k90, T90, - k91, T91, - k92, T92, - k93, T93, - k94, T94, - k95, T95, - k96, T96, - k97, T97, - k98, T98, - k99, T99, - k100, T100> >:: - option (Char const* k) const - { - Void* r (0); - - if (k == k01) r = (Void*) (&o01_); else - if (k == k02) r = (Void*) (&o02_); else - if (k == k03) r = (Void*) (&o03_); else - if (k == k04) r = (Void*) (&o04_); else - if (k == k05) r = (Void*) (&o05_); else - if (k == k06) r = (Void*) (&o06_); else - if (k == k07) r = (Void*) (&o07_); else - if (k == k08) r = (Void*) (&o08_); else - if (k == k09) r = (Void*) (&o09_); else - if (k == k10) r = (Void*) (&o10_); else - if (k == k11) r = (Void*) (&o11_); else - if (k == k12) r = (Void*) (&o12_); else - if (k == k13) r = (Void*) (&o13_); else - if (k == k14) r = (Void*) (&o14_); else - if (k == k15) r = (Void*) (&o15_); else - if (k == k16) r = (Void*) (&o16_); else - if (k == k17) r = (Void*) (&o17_); else - if (k == k18) r = (Void*) (&o18_); else - if (k == k19) r = (Void*) (&o19_); else - if (k == k20) r = (Void*) (&o20_); else - if (k == k21) r = (Void*) (&o21_); else - if (k == k22) r = (Void*) (&o22_); else - if (k == k23) r = (Void*) (&o23_); else - if (k == k24) r = (Void*) (&o24_); else - if (k == k25) r = (Void*) (&o25_); else - if (k == k26) r = (Void*) (&o26_); else - if (k == k27) r = (Void*) (&o27_); else - if (k == k28) r = (Void*) (&o28_); else - if (k == k29) r = (Void*) (&o29_); else - if (k == k30) r = (Void*) (&o30_); else - if (k == k31) r = (Void*) (&o31_); else - if (k == k32) r = (Void*) (&o32_); else - if (k == k33) r = (Void*) (&o33_); else - if (k == k34) r = (Void*) (&o34_); else - if (k == k35) r = (Void*) (&o35_); else - if (k == k36) r = (Void*) (&o36_); else - if (k == k37) r = (Void*) (&o37_); else - if (k == k38) r = (Void*) (&o38_); else - if (k == k39) r = (Void*) (&o39_); else - if (k == k40) r = (Void*) (&o40_); else - if (k == k41) r = (Void*) (&o41_); else - if (k == k42) r = (Void*) (&o42_); else - if (k == k43) r = (Void*) (&o43_); else - if (k == k44) r = (Void*) (&o44_); else - if (k == k45) r = (Void*) (&o45_); else - if (k == k46) r = (Void*) (&o46_); else - if (k == k47) r = (Void*) (&o47_); else - if (k == k48) r = (Void*) (&o48_); else - if (k == k49) r = (Void*) (&o49_); else - if (k == k50) r = (Void*) (&o50_); else - if (k == k51) r = (Void*) (&o51_); else - if (k == k52) r = (Void*) (&o52_); else - if (k == k53) r = (Void*) (&o53_); else - if (k == k54) r = (Void*) (&o54_); else - if (k == k55) r = (Void*) (&o55_); else - if (k == k56) r = (Void*) (&o56_); else - if (k == k57) r = (Void*) (&o57_); else - if (k == k58) r = (Void*) (&o58_); else - if (k == k59) r = (Void*) (&o59_); else - if (k == k60) r = (Void*) (&o60_); else - if (k == k61) r = (Void*) (&o61_); else - if (k == k62) r = (Void*) (&o62_); else - if (k == k63) r = (Void*) (&o63_); else - if (k == k64) r = (Void*) (&o64_); else - if (k == k65) r = (Void*) (&o65_); else - if (k == k66) r = (Void*) (&o66_); else - if (k == k67) r = (Void*) (&o67_); else - if (k == k68) r = (Void*) (&o68_); else - if (k == k69) r = (Void*) (&o69_); else - if (k == k70) r = (Void*) (&o70_); else - if (k == k71) r = (Void*) (&o71_); else - if (k == k72) r = (Void*) (&o72_); else - if (k == k73) r = (Void*) (&o73_); else - if (k == k74) r = (Void*) (&o74_); else - if (k == k75) r = (Void*) (&o75_); else - if (k == k76) r = (Void*) (&o76_); else - if (k == k77) r = (Void*) (&o77_); else - if (k == k78) r = (Void*) (&o78_); else - if (k == k79) r = (Void*) (&o79_); else - if (k == k80) r = (Void*) (&o80_); else - if (k == k81) r = (Void*) (&o81_); else - if (k == k82) r = (Void*) (&o82_); else - if (k == k83) r = (Void*) (&o83_); else - if (k == k84) r = (Void*) (&o84_); else - if (k == k85) r = (Void*) (&o85_); else - if (k == k86) r = (Void*) (&o86_); else - if (k == k87) r = (Void*) (&o87_); else - if (k == k88) r = (Void*) (&o88_); else - if (k == k89) r = (Void*) (&o89_); else - if (k == k90) r = (Void*) (&o90_); else - if (k == k91) r = (Void*) (&o91_); else - if (k == k92) r = (Void*) (&o92_); else - if (k == k93) r = (Void*) (&o93_); else - if (k == k94) r = (Void*) (&o94_); else - if (k == k95) r = (Void*) (&o95_); else - if (k == k96) r = (Void*) (&o96_); else - if (k == k97) r = (Void*) (&o97_); else - if (k == k98) r = (Void*) (&o98_); else - if (k == k99) r = (Void*) (&o99_); else - if (k == k100) r = (Void*) (&o100_); else - assert (false); - - return r; - } - } -} diff --git a/libcult/cult/cli/options.cxx b/libcult/cult/cli/options.cxx deleted file mode 100644 index 6b6e996..0000000 --- a/libcult/cult/cli/options.cxx +++ /dev/null @@ -1,17 +0,0 @@ -// file : cult/cli/options.cxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cult/cli/options.hxx> - -namespace Cult -{ - namespace CLI - { - namespace Bits - { - extern Char const null[] = ""; - } - } -} diff --git a/libcult/cult/cli/options.hxx b/libcult/cult/cli/options.hxx deleted file mode 100644 index 2a780e1..0000000 --- a/libcult/cult/cli/options.hxx +++ /dev/null @@ -1,502 +0,0 @@ -// file : cult/cli/options.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_CLI_OPTIONS_HXX -#define CULT_CLI_OPTIONS_HXX - -#include <cult/types.hxx> - -#include <cassert> - -namespace Cult -{ - namespace CLI - { - namespace Bits - { - template <Boolean t, typename X, typename Y> - struct if_; - - template <typename X, typename Y> - struct if_<true, X, Y> - { - typedef X Type; - }; - - template <typename X, typename Y> - struct if_<false, X, Y> - { - typedef Y Type; - }; - - template <Char const* x, Char const* y> - struct same - { - static Boolean const r = false; - }; - - template <Char const* x> - struct same<x, x> - { - static Boolean const r = true; - }; - - template <Char const* x> - struct Tag - { - }; - - //@@ should end up in Cult::Meta - // - struct Null {}; - extern Char const null[]; - -#include <cult/cli/mapper.hxx> - - } - - template <Char const* k01, typename T01, - Char const* k02 = Bits::null, typename T02 = Bits::Null, - Char const* k03 = Bits::null, typename T03 = Bits::Null, - Char const* k04 = Bits::null, typename T04 = Bits::Null, - Char const* k05 = Bits::null, typename T05 = Bits::Null, - Char const* k06 = Bits::null, typename T06 = Bits::Null, - Char const* k07 = Bits::null, typename T07 = Bits::Null, - Char const* k08 = Bits::null, typename T08 = Bits::Null, - Char const* k09 = Bits::null, typename T09 = Bits::Null, - Char const* k10 = Bits::null, typename T10 = Bits::Null, - Char const* k11 = Bits::null, typename T11 = Bits::Null, - Char const* k12 = Bits::null, typename T12 = Bits::Null, - Char const* k13 = Bits::null, typename T13 = Bits::Null, - Char const* k14 = Bits::null, typename T14 = Bits::Null, - Char const* k15 = Bits::null, typename T15 = Bits::Null, - Char const* k16 = Bits::null, typename T16 = Bits::Null, - Char const* k17 = Bits::null, typename T17 = Bits::Null, - Char const* k18 = Bits::null, typename T18 = Bits::Null, - Char const* k19 = Bits::null, typename T19 = Bits::Null, - Char const* k20 = Bits::null, typename T20 = Bits::Null, - Char const* k21 = Bits::null, typename T21 = Bits::Null, - Char const* k22 = Bits::null, typename T22 = Bits::Null, - Char const* k23 = Bits::null, typename T23 = Bits::Null, - Char const* k24 = Bits::null, typename T24 = Bits::Null, - Char const* k25 = Bits::null, typename T25 = Bits::Null, - Char const* k26 = Bits::null, typename T26 = Bits::Null, - Char const* k27 = Bits::null, typename T27 = Bits::Null, - Char const* k28 = Bits::null, typename T28 = Bits::Null, - Char const* k29 = Bits::null, typename T29 = Bits::Null, - Char const* k30 = Bits::null, typename T30 = Bits::Null, - Char const* k31 = Bits::null, typename T31 = Bits::Null, - Char const* k32 = Bits::null, typename T32 = Bits::Null, - Char const* k33 = Bits::null, typename T33 = Bits::Null, - Char const* k34 = Bits::null, typename T34 = Bits::Null, - Char const* k35 = Bits::null, typename T35 = Bits::Null, - Char const* k36 = Bits::null, typename T36 = Bits::Null, - Char const* k37 = Bits::null, typename T37 = Bits::Null, - Char const* k38 = Bits::null, typename T38 = Bits::Null, - Char const* k39 = Bits::null, typename T39 = Bits::Null, - Char const* k40 = Bits::null, typename T40 = Bits::Null, - Char const* k41 = Bits::null, typename T41 = Bits::Null, - Char const* k42 = Bits::null, typename T42 = Bits::Null, - Char const* k43 = Bits::null, typename T43 = Bits::Null, - Char const* k44 = Bits::null, typename T44 = Bits::Null, - Char const* k45 = Bits::null, typename T45 = Bits::Null, - Char const* k46 = Bits::null, typename T46 = Bits::Null, - Char const* k47 = Bits::null, typename T47 = Bits::Null, - Char const* k48 = Bits::null, typename T48 = Bits::Null, - Char const* k49 = Bits::null, typename T49 = Bits::Null, - Char const* k50 = Bits::null, typename T50 = Bits::Null, - Char const* k51 = Bits::null, typename T51 = Bits::Null, - Char const* k52 = Bits::null, typename T52 = Bits::Null, - Char const* k53 = Bits::null, typename T53 = Bits::Null, - Char const* k54 = Bits::null, typename T54 = Bits::Null, - Char const* k55 = Bits::null, typename T55 = Bits::Null, - Char const* k56 = Bits::null, typename T56 = Bits::Null, - Char const* k57 = Bits::null, typename T57 = Bits::Null, - Char const* k58 = Bits::null, typename T58 = Bits::Null, - Char const* k59 = Bits::null, typename T59 = Bits::Null, - Char const* k60 = Bits::null, typename T60 = Bits::Null, - Char const* k61 = Bits::null, typename T61 = Bits::Null, - Char const* k62 = Bits::null, typename T62 = Bits::Null, - Char const* k63 = Bits::null, typename T63 = Bits::Null, - Char const* k64 = Bits::null, typename T64 = Bits::Null, - Char const* k65 = Bits::null, typename T65 = Bits::Null, - Char const* k66 = Bits::null, typename T66 = Bits::Null, - Char const* k67 = Bits::null, typename T67 = Bits::Null, - Char const* k68 = Bits::null, typename T68 = Bits::Null, - Char const* k69 = Bits::null, typename T69 = Bits::Null, - Char const* k70 = Bits::null, typename T70 = Bits::Null, - Char const* k71 = Bits::null, typename T71 = Bits::Null, - Char const* k72 = Bits::null, typename T72 = Bits::Null, - Char const* k73 = Bits::null, typename T73 = Bits::Null, - Char const* k74 = Bits::null, typename T74 = Bits::Null, - Char const* k75 = Bits::null, typename T75 = Bits::Null, - Char const* k76 = Bits::null, typename T76 = Bits::Null, - Char const* k77 = Bits::null, typename T77 = Bits::Null, - Char const* k78 = Bits::null, typename T78 = Bits::Null, - Char const* k79 = Bits::null, typename T79 = Bits::Null, - Char const* k80 = Bits::null, typename T80 = Bits::Null, - Char const* k81 = Bits::null, typename T81 = Bits::Null, - Char const* k82 = Bits::null, typename T82 = Bits::Null, - Char const* k83 = Bits::null, typename T83 = Bits::Null, - Char const* k84 = Bits::null, typename T84 = Bits::Null, - Char const* k85 = Bits::null, typename T85 = Bits::Null, - Char const* k86 = Bits::null, typename T86 = Bits::Null, - Char const* k87 = Bits::null, typename T87 = Bits::Null, - Char const* k88 = Bits::null, typename T88 = Bits::Null, - Char const* k89 = Bits::null, typename T89 = Bits::Null, - Char const* k90 = Bits::null, typename T90 = Bits::Null, - Char const* k91 = Bits::null, typename T91 = Bits::Null, - Char const* k92 = Bits::null, typename T92 = Bits::Null, - Char const* k93 = Bits::null, typename T93 = Bits::Null, - Char const* k94 = Bits::null, typename T94 = Bits::Null, - Char const* k95 = Bits::null, typename T95 = Bits::Null, - Char const* k96 = Bits::null, typename T96 = Bits::Null, - Char const* k97 = Bits::null, typename T97 = Bits::Null, - Char const* k98 = Bits::null, typename T98 = Bits::Null, - Char const* k99 = Bits::null, typename T99 = Bits::Null, - Char const* k100 = Bits::null, typename T100 = Bits::Null> - class Options - { - typedef Bits::Mapper<k01, T01, - k02, T02, - k03, T03, - k04, T04, - k05, T05, - k06, T06, - k07, T07, - k08, T08, - k09, T09, - k10, T10, - k11, T11, - k12, T12, - k13, T13, - k14, T14, - k15, T15, - k16, T16, - k17, T17, - k18, T18, - k19, T19, - k20, T20, - k21, T21, - k22, T22, - k23, T23, - k24, T24, - k25, T25, - k26, T26, - k27, T27, - k28, T28, - k29, T29, - k30, T30, - k31, T31, - k32, T32, - k33, T33, - k34, T34, - k35, T35, - k36, T36, - k37, T37, - k38, T38, - k39, T39, - k40, T40, - k41, T41, - k42, T42, - k43, T43, - k44, T44, - k45, T45, - k46, T46, - k47, T47, - k48, T48, - k49, T49, - k50, T50, - k51, T51, - k52, T52, - k53, T53, - k54, T54, - k55, T55, - k56, T56, - k57, T57, - k58, T58, - k59, T59, - k60, T60, - k61, T61, - k62, T62, - k63, T63, - k64, T64, - k65, T65, - k66, T66, - k67, T67, - k68, T68, - k69, T69, - k70, T70, - k71, T71, - k72, T72, - k73, T73, - k74, T74, - k75, T75, - k76, T76, - k77, T77, - k78, T78, - k79, T79, - k80, T80, - k81, T81, - k82, T82, - k83, T83, - k84, T84, - k85, T85, - k86, T86, - k87, T87, - k88, T88, - k89, T89, - k90, T90, - k91, T91, - k92, T92, - k93, T93, - k94, T94, - k95, T95, - k96, T96, - k97, T97, - k98, T98, - k99, T99, - k100, T100> Mapper; - - public: - Options () - : i01_ (), - i02_ (), - i03_ (), - i04_ (), - i05_ (), - i06_ (), - i07_ (), - i08_ (), - i09_ (), - i10_ (), - i11_ (), - i12_ (), - i13_ (), - i14_ (), - i15_ (), - i16_ (), - i17_ (), - i18_ (), - i19_ (), - i20_ (), - i21_ (), - i22_ (), - i23_ (), - i24_ (), - i25_ (), - i26_ (), - i27_ (), - i28_ (), - i29_ (), - i30_ (), - i31_ (), - i32_ (), - i33_ (), - i34_ (), - i35_ (), - i36_ (), - i37_ (), - i38_ (), - i39_ (), - i40_ (), - i41_ (), - i42_ (), - i43_ (), - i44_ (), - i45_ (), - i46_ (), - i47_ (), - i48_ (), - i49_ (), - i50_ (), - i51_ (), - i52_ (), - i53_ (), - i54_ (), - i55_ (), - i56_ (), - i57_ (), - i58_ (), - i59_ (), - i60_ (), - i61_ (), - i62_ (), - i63_ (), - i64_ (), - i65_ (), - i66_ (), - i67_ (), - i68_ (), - i69_ (), - i70_ (), - i71_ (), - i72_ (), - i73_ (), - i74_ (), - i75_ (), - i76_ (), - i77_ (), - i78_ (), - i79_ (), - i80_ (), - i81_ (), - i82_ (), - i83_ (), - i84_ (), - i85_ (), - i86_ (), - i87_ (), - i88_ (), - i89_ (), - i90_ (), - i91_ (), - i92_ (), - i93_ (), - i94_ (), - i95_ (), - i96_ (), - i97_ (), - i98_ (), - i99_ (), - i100_ () - { - } - - template <Char const* k> - typename Mapper::template Selector<k>::Type& - value () - { - typedef - typename Mapper::template Selector<k>::Type - Type; - - return *reinterpret_cast<Type*> (value (k)); - } - - template <Char const* k> - typename Mapper::template Selector<k>::Type const& - value () const - { - typedef - typename Mapper::template Selector<k>::Type - Type; - - return *reinterpret_cast<Type const*> (value (k)); - } - - private: - Void* - value (Char const*) const; - - private: - T01 i01_; - T02 i02_; - T03 i03_; - T04 i04_; - T05 i05_; - T06 i06_; - T07 i07_; - T08 i08_; - T09 i09_; - T10 i10_; - T11 i11_; - T12 i12_; - T13 i13_; - T14 i14_; - T15 i15_; - T16 i16_; - T17 i17_; - T18 i18_; - T19 i19_; - T20 i20_; - T21 i21_; - T22 i22_; - T23 i23_; - T24 i24_; - T25 i25_; - T26 i26_; - T27 i27_; - T28 i28_; - T29 i29_; - T30 i30_; - T31 i31_; - T32 i32_; - T33 i33_; - T34 i34_; - T35 i35_; - T36 i36_; - T37 i37_; - T38 i38_; - T39 i39_; - T40 i40_; - T41 i41_; - T42 i42_; - T43 i43_; - T44 i44_; - T45 i45_; - T46 i46_; - T47 i47_; - T48 i48_; - T49 i49_; - T50 i50_; - T51 i51_; - T52 i52_; - T53 i53_; - T54 i54_; - T55 i55_; - T56 i56_; - T57 i57_; - T58 i58_; - T59 i59_; - T60 i60_; - T61 i61_; - T62 i62_; - T63 i63_; - T64 i64_; - T65 i65_; - T66 i66_; - T67 i67_; - T68 i68_; - T69 i69_; - T70 i70_; - T71 i71_; - T72 i72_; - T73 i73_; - T74 i74_; - T75 i75_; - T76 i76_; - T77 i77_; - T78 i78_; - T79 i79_; - T80 i80_; - T81 i81_; - T82 i82_; - T83 i83_; - T84 i84_; - T85 i85_; - T86 i86_; - T87 i87_; - T88 i88_; - T89 i89_; - T90 i90_; - T91 i91_; - T92 i92_; - T93 i93_; - T94 i94_; - T95 i95_; - T96 i96_; - T97 i97_; - T98 i98_; - T99 i99_; - T100 i100_; - }; - } -} - -#include <cult/cli/options.ixx> -#include <cult/cli/options.txx> - -#endif // CULT_CLI_OPTIONS_HXX diff --git a/libcult/cult/cli/options.ixx b/libcult/cult/cli/options.ixx deleted file mode 100644 index c25b833..0000000 --- a/libcult/cult/cli/options.ixx +++ /dev/null @@ -1,12 +0,0 @@ -// file : cult/cli/options.ixx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -namespace Cult -{ - namespace CLI - { - } -} - diff --git a/libcult/cult/cli/options.txx b/libcult/cult/cli/options.txx deleted file mode 100644 index b26666d..0000000 --- a/libcult/cult/cli/options.txx +++ /dev/null @@ -1,320 +0,0 @@ -// file : cult/cli/options.txx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -namespace Cult -{ - namespace CLI - { - template <Char const* k01, typename T01, - Char const* k02, typename T02, - Char const* k03, typename T03, - Char const* k04, typename T04, - Char const* k05, typename T05, - Char const* k06, typename T06, - Char const* k07, typename T07, - Char const* k08, typename T08, - Char const* k09, typename T09, - Char const* k10, typename T10, - Char const* k11, typename T11, - Char const* k12, typename T12, - Char const* k13, typename T13, - Char const* k14, typename T14, - Char const* k15, typename T15, - Char const* k16, typename T16, - Char const* k17, typename T17, - Char const* k18, typename T18, - Char const* k19, typename T19, - Char const* k20, typename T20, - Char const* k21, typename T21, - Char const* k22, typename T22, - Char const* k23, typename T23, - Char const* k24, typename T24, - Char const* k25, typename T25, - Char const* k26, typename T26, - Char const* k27, typename T27, - Char const* k28, typename T28, - Char const* k29, typename T29, - Char const* k30, typename T30, - Char const* k31, typename T31, - Char const* k32, typename T32, - Char const* k33, typename T33, - Char const* k34, typename T34, - Char const* k35, typename T35, - Char const* k36, typename T36, - Char const* k37, typename T37, - Char const* k38, typename T38, - Char const* k39, typename T39, - Char const* k40, typename T40, - Char const* k41, typename T41, - Char const* k42, typename T42, - Char const* k43, typename T43, - Char const* k44, typename T44, - Char const* k45, typename T45, - Char const* k46, typename T46, - Char const* k47, typename T47, - Char const* k48, typename T48, - Char const* k49, typename T49, - Char const* k50, typename T50, - Char const* k51, typename T51, - Char const* k52, typename T52, - Char const* k53, typename T53, - Char const* k54, typename T54, - Char const* k55, typename T55, - Char const* k56, typename T56, - Char const* k57, typename T57, - Char const* k58, typename T58, - Char const* k59, typename T59, - Char const* k60, typename T60, - Char const* k61, typename T61, - Char const* k62, typename T62, - Char const* k63, typename T63, - Char const* k64, typename T64, - Char const* k65, typename T65, - Char const* k66, typename T66, - Char const* k67, typename T67, - Char const* k68, typename T68, - Char const* k69, typename T69, - Char const* k70, typename T70, - Char const* k71, typename T71, - Char const* k72, typename T72, - Char const* k73, typename T73, - Char const* k74, typename T74, - Char const* k75, typename T75, - Char const* k76, typename T76, - Char const* k77, typename T77, - Char const* k78, typename T78, - Char const* k79, typename T79, - Char const* k80, typename T80, - Char const* k81, typename T81, - Char const* k82, typename T82, - Char const* k83, typename T83, - Char const* k84, typename T84, - Char const* k85, typename T85, - Char const* k86, typename T86, - Char const* k87, typename T87, - Char const* k88, typename T88, - Char const* k89, typename T89, - Char const* k90, typename T90, - Char const* k91, typename T91, - Char const* k92, typename T92, - Char const* k93, typename T93, - Char const* k94, typename T94, - Char const* k95, typename T95, - Char const* k96, typename T96, - Char const* k97, typename T97, - Char const* k98, typename T98, - Char const* k99, typename T99, - Char const* k100, typename T100> - Void* - Options<k01, T01, - k02, T02, - k03, T03, - k04, T04, - k05, T05, - k06, T06, - k07, T07, - k08, T08, - k09, T09, - k10, T10, - k11, T11, - k12, T12, - k13, T13, - k14, T14, - k15, T15, - k16, T16, - k17, T17, - k18, T18, - k19, T19, - k20, T20, - k21, T21, - k22, T22, - k23, T23, - k24, T24, - k25, T25, - k26, T26, - k27, T27, - k28, T28, - k29, T29, - k30, T30, - k31, T31, - k32, T32, - k33, T33, - k34, T34, - k35, T35, - k36, T36, - k37, T37, - k38, T38, - k39, T39, - k40, T40, - k41, T41, - k42, T42, - k43, T43, - k44, T44, - k45, T45, - k46, T46, - k47, T47, - k48, T48, - k49, T49, - k50, T50, - k51, T51, - k52, T52, - k53, T53, - k54, T54, - k55, T55, - k56, T56, - k57, T57, - k58, T58, - k59, T59, - k60, T60, - k61, T61, - k62, T62, - k63, T63, - k64, T64, - k65, T65, - k66, T66, - k67, T67, - k68, T68, - k69, T69, - k70, T70, - k71, T71, - k72, T72, - k73, T73, - k74, T74, - k75, T75, - k76, T76, - k77, T77, - k78, T78, - k79, T79, - k80, T80, - k81, T81, - k82, T82, - k83, T83, - k84, T84, - k85, T85, - k86, T86, - k87, T87, - k88, T88, - k89, T89, - k90, T90, - k91, T91, - k92, T92, - k93, T93, - k94, T94, - k95, T95, - k96, T96, - k97, T97, - k98, T98, - k99, T99, - k100, T100>:: - value (Char const* k) const - { - Void* r (0); - - if (k == k01) r = (Void*) (&i01_); else - if (k == k02) r = (Void*) (&i02_); else - if (k == k03) r = (Void*) (&i03_); else - if (k == k04) r = (Void*) (&i04_); else - if (k == k05) r = (Void*) (&i05_); else - if (k == k06) r = (Void*) (&i06_); else - if (k == k07) r = (Void*) (&i07_); else - if (k == k08) r = (Void*) (&i08_); else - if (k == k09) r = (Void*) (&i09_); else - if (k == k10) r = (Void*) (&i10_); else - if (k == k11) r = (Void*) (&i11_); else - if (k == k12) r = (Void*) (&i12_); else - if (k == k13) r = (Void*) (&i13_); else - if (k == k14) r = (Void*) (&i14_); else - if (k == k15) r = (Void*) (&i15_); else - if (k == k16) r = (Void*) (&i16_); else - if (k == k17) r = (Void*) (&i17_); else - if (k == k18) r = (Void*) (&i18_); else - if (k == k19) r = (Void*) (&i19_); else - if (k == k20) r = (Void*) (&i20_); else - if (k == k21) r = (Void*) (&i21_); else - if (k == k22) r = (Void*) (&i22_); else - if (k == k23) r = (Void*) (&i23_); else - if (k == k24) r = (Void*) (&i24_); else - if (k == k25) r = (Void*) (&i25_); else - if (k == k26) r = (Void*) (&i26_); else - if (k == k27) r = (Void*) (&i27_); else - if (k == k28) r = (Void*) (&i28_); else - if (k == k29) r = (Void*) (&i29_); else - if (k == k30) r = (Void*) (&i30_); else - if (k == k31) r = (Void*) (&i31_); else - if (k == k32) r = (Void*) (&i32_); else - if (k == k33) r = (Void*) (&i33_); else - if (k == k34) r = (Void*) (&i34_); else - if (k == k35) r = (Void*) (&i35_); else - if (k == k36) r = (Void*) (&i36_); else - if (k == k37) r = (Void*) (&i37_); else - if (k == k38) r = (Void*) (&i38_); else - if (k == k39) r = (Void*) (&i39_); else - if (k == k40) r = (Void*) (&i40_); else - if (k == k41) r = (Void*) (&i41_); else - if (k == k42) r = (Void*) (&i42_); else - if (k == k43) r = (Void*) (&i43_); else - if (k == k44) r = (Void*) (&i44_); else - if (k == k45) r = (Void*) (&i45_); else - if (k == k46) r = (Void*) (&i46_); else - if (k == k47) r = (Void*) (&i47_); else - if (k == k48) r = (Void*) (&i48_); else - if (k == k49) r = (Void*) (&i49_); else - if (k == k50) r = (Void*) (&i50_); else - if (k == k51) r = (Void*) (&i51_); else - if (k == k52) r = (Void*) (&i52_); else - if (k == k53) r = (Void*) (&i53_); else - if (k == k54) r = (Void*) (&i54_); else - if (k == k55) r = (Void*) (&i55_); else - if (k == k56) r = (Void*) (&i56_); else - if (k == k57) r = (Void*) (&i57_); else - if (k == k58) r = (Void*) (&i58_); else - if (k == k59) r = (Void*) (&i59_); else - if (k == k60) r = (Void*) (&i60_); else - if (k == k61) r = (Void*) (&i61_); else - if (k == k62) r = (Void*) (&i62_); else - if (k == k63) r = (Void*) (&i63_); else - if (k == k64) r = (Void*) (&i64_); else - if (k == k65) r = (Void*) (&i65_); else - if (k == k66) r = (Void*) (&i66_); else - if (k == k67) r = (Void*) (&i67_); else - if (k == k68) r = (Void*) (&i68_); else - if (k == k69) r = (Void*) (&i69_); else - if (k == k70) r = (Void*) (&i70_); else - if (k == k71) r = (Void*) (&i71_); else - if (k == k72) r = (Void*) (&i72_); else - if (k == k73) r = (Void*) (&i73_); else - if (k == k74) r = (Void*) (&i74_); else - if (k == k75) r = (Void*) (&i75_); else - if (k == k76) r = (Void*) (&i76_); else - if (k == k77) r = (Void*) (&i77_); else - if (k == k78) r = (Void*) (&i78_); else - if (k == k79) r = (Void*) (&i79_); else - if (k == k80) r = (Void*) (&i80_); else - if (k == k81) r = (Void*) (&i81_); else - if (k == k82) r = (Void*) (&i82_); else - if (k == k83) r = (Void*) (&i83_); else - if (k == k84) r = (Void*) (&i84_); else - if (k == k85) r = (Void*) (&i85_); else - if (k == k86) r = (Void*) (&i86_); else - if (k == k87) r = (Void*) (&i87_); else - if (k == k88) r = (Void*) (&i88_); else - if (k == k89) r = (Void*) (&i89_); else - if (k == k90) r = (Void*) (&i90_); else - if (k == k91) r = (Void*) (&i91_); else - if (k == k92) r = (Void*) (&i92_); else - if (k == k93) r = (Void*) (&i93_); else - if (k == k94) r = (Void*) (&i94_); else - if (k == k95) r = (Void*) (&i95_); else - if (k == k96) r = (Void*) (&i96_); else - if (k == k97) r = (Void*) (&i97_); else - if (k == k98) r = (Void*) (&i98_); else - if (k == k99) r = (Void*) (&i99_); else - if (k == k100) r = (Void*) (&i100_); else - assert (false); - - return r; - } - } -} diff --git a/libcult/cult/cli/scanner.cxx b/libcult/cult/cli/scanner.cxx deleted file mode 100644 index af51bfa..0000000 --- a/libcult/cult/cli/scanner.cxx +++ /dev/null @@ -1,17 +0,0 @@ -// file : cult/cli/scanner.cxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cult/cli/scanner.hxx> - -namespace Cult -{ - namespace CLI - { - Scanner::Action const Scanner::Action::keep (Scanner::Action::keep_); - Scanner::Action const Scanner::Action::erase (Scanner::Action::erase_); - - Char const* const Scanner::eos = 0; - } -} diff --git a/libcult/cult/cli/scanner.hxx b/libcult/cult/cli/scanner.hxx deleted file mode 100644 index 13fa804..0000000 --- a/libcult/cult/cli/scanner.hxx +++ /dev/null @@ -1,132 +0,0 @@ -// file : cult/cli/scanner.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_CLI_SCANNER_HXX -#define CULT_CLI_SCANNER_HXX - -#include <cult/types.hxx> - -#include <cult/cli/exceptions.hxx> -#include <cult/cli/arguments.hxx> - -namespace Cult -{ - namespace CLI - { - class Scanner: public NonCopyable - { - public: - class Action - { - public: - static Action const keep, erase; - - friend Boolean - operator== (Action const& a, Action const& b) - { - return a.v_ == b.v_; - } - - friend Boolean - operator!= (Action const& a, Action const& b) - { - return a.v_ != b.v_; - } - - private: - enum Value { keep_, erase_ } v_; - - Action (Value v) - : v_ (v) - { - } - }; - - public: - Scanner (Arguments& args, Action a = Action::keep, Index start = 1) - : cargs_ (args), - args_ (a == Action::erase ? &args : 0), - next_ (start) - { - } - - Scanner (Arguments const& args, Index start = 1) - : cargs_ (args), args_ (0), next_ (start) - { - } - - public: - static Char const* const eos; - - class PastEOS: public virtual Exception {}; - - Char const* - next () - { - if (next_ > cargs_.size ()) - { - throw PastEOS (); - } - else if (next_ == cargs_.size ()) - { - ++next_; - return eos; - } - else - { - Char const* r (cargs_[next_]); - - if (args_ != 0) - { - hold_ = r; - args_->erase (next_); - return hold_.c_str (); - } - else - { - ++next_; - return r; - } - } - } - - Char const* - peek () - { - if (next_ > cargs_.size ()) - { - throw PastEOS (); - } - else if (next_ == cargs_.size ()) - { - return eos; - } - else - { - return cargs_[next_]; - } - } - - Void - skip () - { - if (next_ > cargs_.size ()) - throw PastEOS (); - else - ++next_; - } - - private: - Arguments const& cargs_; - Arguments* args_; - Index next_; - String hold_; - }; - } -} - -#include <cult/cli/scanner.ixx> - -#endif // CULT_CLI_SCANNER_HXX diff --git a/libcult/cult/cli/scanner.ixx b/libcult/cult/cli/scanner.ixx deleted file mode 100644 index 5e84451..0000000 --- a/libcult/cult/cli/scanner.ixx +++ /dev/null @@ -1,12 +0,0 @@ -// file : cult/cli/scanner.ixx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -namespace Cult -{ - namespace CLI - { - } -} - |