summaryrefslogtreecommitdiff
path: root/config.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-09-14 06:25:29 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-09-14 06:25:29 -0400
commit061e19e302fb62eaafbd2029671bdd46dd4d7814 (patch)
tree081700c4302e6efc0f7954dbeaf8d86d4e63e907 /config.h
parent0b0c9b5bd13b1dedf100b137e3a35be60d3d3a27 (diff)
downloadfork-ledger-061e19e302fb62eaafbd2029671bdd46dd4d7814.tar.gz
fork-ledger-061e19e302fb62eaafbd2029671bdd46dd4d7814.tar.bz2
fork-ledger-061e19e302fb62eaafbd2029671bdd46dd4d7814.zip
make config_t visible to Python; almost possible to implement main.cc in main.py
Diffstat (limited to 'config.h')
-rw-r--r--config.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/config.h b/config.h
index 4342d8c1..d481757d 100644
--- a/config.h
+++ b/config.h
@@ -9,6 +9,7 @@
#include <iostream>
#include <memory>
+#include <list>
namespace ledger {
@@ -58,24 +59,35 @@ struct config_t
format_t format;
format_t nformat;
- std::auto_ptr<value_expr_t> sort_order;
- std::auto_ptr<std::ostream> 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<option_t> 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);
}
};