+class usage_error: public std::runtime_error
+{
+private:
+ std::string help_;
+
+public:
+ usage_error(const std::string &w, const std::string &h = std::string()): std::runtime_error(w), help_(h) { }
+ ~usage_error() throw() { }
+
+ const char *help() const throw() { return help_.c_str(); }
+};
+
+
+/**
+Command line option processor. Both short and long options are supported, with
+optional and required arguments. Automatic help text generation is also
+available.
+
+Short options begin with a single dash and are identified by a single letter.
+Multiple short options may be grouped if they take no arguments; for example,
+the string "-abc" could be interpreted as having the options 'a', 'b' and 'c'.
+If the option takes an argument and there are unused characters in the argv
+element, then those characters are interpreted as the argument. Otherwise the
+next element is taken as the argument. An optional argument must be given in
+the same element if it is given.
+
+Long options begin with a double dash and are identified by an arbitrary
+string. An argument can be specified either in the same argv element,
+separated by an equals sign, or in the next element. As with short options,
+an optional argument, if given, must be in the same element.
+
+A single option may have both alternative forms, but must always have at least
+a long form. This is to encourage self-documenting options; it's much easier
+to remember words than letters.
+
+Positional arguments are also supported. They are identified by an arbitrary
+string, but the identifier is only used in help text and error messages. Any
+number of the final arguments may be optional.
+
+To support applications that take an arbitrary amount of arguments, a single
+positional argument list can be specified. Fixed positional arguments are
+allowed together with a list, but they can't be optional. An application that
+wants to do complex processing on the argument list can declare a list of
+string arguments.
+
+A built-in --help option is provided and will output a list of options,
+arguments and their associated help texts. An application may override this by
+providing its own option with the same name.
+*/
+class GetOpt: private NonCopyable