summaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h49
1 files changed, 29 insertions, 20 deletions
diff --git a/parser.h b/parser.h
index cea67e41..d63ebcf0 100644
--- a/parser.h
+++ b/parser.h
@@ -1,10 +1,7 @@
#ifndef _PARSER_H
#define _PARSER_H
-#include <iostream>
-#include <string>
-
-#include "error.h"
+#include "utils.h"
namespace ledger {
@@ -19,27 +16,39 @@ class parser_t
virtual bool test(std::istream& in) const = 0;
- virtual unsigned int parse(std::istream& in,
- config_t& config,
- journal_t * journal,
- account_t * master = NULL,
- const std::string * original_file = NULL) = 0;
+ virtual unsigned int parse(std::istream& in,
+ config_t& config,
+ journal_t * journal,
+ account_t * master = NULL,
+ const path * original_file = NULL) = 0;
+};
+
+class binary_parser_t : public parser_t
+{
+public:
+ virtual bool test(std::istream& in) const;
+
+ virtual unsigned int parse(std::istream& in,
+ config_t& config,
+ journal_t * journal,
+ account_t * master = NULL,
+ const path * original_file = NULL);
};
bool register_parser(parser_t * parser);
bool unregister_parser(parser_t * parser);
-unsigned int parse_journal(std::istream& in,
- config_t& config,
- journal_t * journal,
- account_t * master = NULL,
- const std::string * original_file = NULL);
+unsigned int parse_journal(std::istream& in,
+ config_t& config,
+ journal_t * journal,
+ account_t * master = NULL,
+ const path * original_file = NULL);
-unsigned int parse_journal_file(const std::string& path,
- config_t& config,
- journal_t * journal,
- account_t * master = NULL,
- const std::string * original_file = NULL);
+unsigned int parse_journal_file(const path& path,
+ config_t& config,
+ journal_t * journal,
+ account_t * master = NULL,
+ const path * original_file = NULL);
unsigned int parse_ledger_data(config_t& config,
journal_t * journal,
@@ -52,7 +61,7 @@ void shutdown_parser_support();
class parse_error : public error {
public:
- parse_error(const std::string& reason, error_context * ctxt = NULL) throw()
+ parse_error(const string& reason, error_context * ctxt = NULL) throw()
: error(reason, ctxt) {}
virtual ~parse_error() throw() {}
};