From 061e19e302fb62eaafbd2029671bdd46dd4d7814 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 14 Sep 2004 06:25:29 -0400 Subject: make config_t visible to Python; almost possible to implement main.cc in main.py --- config.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'config.h') diff --git a/config.h b/config.h index 4342d8c1..d481757d 100644 --- a/config.h +++ b/config.h @@ -9,6 +9,7 @@ #include #include +#include namespace ledger { @@ -58,24 +59,35 @@ struct config_t format_t format; format_t nformat; - std::auto_ptr sort_order; - std::auto_ptr output_stream; + value_expr_t * sort_order; + std::ostream * output_stream; config_t(); + config_t(const config_t&) { + assert(0); + } + + ~config_t() { + if (sort_order) + delete sort_order; + if (output_stream) + delete output_stream; + } void process_options(const std::string& command, strings_list::iterator arg, strings_list::iterator args_end); }; -extern config_t config; +extern config_t config; +extern std::list config_options; void option_help(std::ostream& out); struct declared_option_handler : public option_handler { declared_option_handler(const std::string& label, const std::string& opt_chars) { - register_option(label, opt_chars, *this); + add_option_handler(config_options, label, opt_chars, *this); } }; -- cgit v1.2.3