diff options
author | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:35:00 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:35:00 -0400 |
commit | 42f43b7686038e4cbca16d8d2118b139544e6de3 (patch) | |
tree | 52c5473401c57282242d66b8dd75f4c07bf41d07 /option.h | |
parent | c7b4370ff9c8ab5c96f15b1e712e6db6bdab6324 (diff) | |
download | fork-ledger-42f43b7686038e4cbca16d8d2118b139544e6de3.tar.gz fork-ledger-42f43b7686038e4cbca16d8d2118b139544e6de3.tar.bz2 fork-ledger-42f43b7686038e4cbca16d8d2118b139544e6de3.zip |
Check in all changes made so far toward 3.0.
Diffstat (limited to 'option.h')
-rw-r--r-- | option.h | 45 |
1 files changed, 12 insertions, 33 deletions
@@ -2,20 +2,24 @@ #define _OPTION_H #include <list> +#include <map> #include <string> #include <exception> +#include "xpath.h" #include "error.h" -typedef void (*handler_t)(const char * arg); +namespace ledger { -struct option_t { - const char * long_opt; - char short_opt; - bool wants_arg; - handler_t handler; - bool handled; -}; +bool process_option(const std::string& name, xml::xpath_t::scope_t * scope, + const char * arg = NULL); + +void process_environment(const char ** envp, const std::string& tag, + xml::xpath_t::scope_t * scope); + +void process_arguments(int argc, char ** argv, const bool anywhere, + xml::xpath_t::scope_t * scope, + std::list<std::string>& args); class option_error : public error { public: @@ -23,31 +27,6 @@ class option_error : public error { virtual ~option_error() throw() {} }; -bool process_option(option_t * options, const std::string& opt, - const char * arg = NULL); -void process_arguments(option_t * options, int argc, char ** argv, - const bool anywhere, std::list<std::string>& args); -void process_environment(option_t * options, const char ** envp, - const std::string& tag); - -namespace ledger { - -class config_t; -class report_t; - -extern config_t * config; -extern report_t * report; - -#define CONFIG_OPTIONS_SIZE 97 -extern option_t config_options[CONFIG_OPTIONS_SIZE]; - -void option_help(std::ostream& out); - -#define OPT_BEGIN(tag, chars) \ - void opt_ ## tag(const char * optarg) - -#define OPT_END(tag) - } // namespace ledger #endif // _OPTION_H |