summaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/parser.h b/parser.h
new file mode 100644
index 00000000..3ced3432
--- /dev/null
+++ b/parser.h
@@ -0,0 +1,31 @@
+#ifndef _PARSER_H
+#define _PARSER_H
+
+#include "ledger.h"
+
+namespace ledger {
+
+class parser_t;
+typedef std::list<parser_t *> parsers_list;
+
+class parser_t
+{
+ public:
+ virtual bool test(std::istream& in) const = 0;
+
+ virtual unsigned int parse(std::istream& in,
+ journal_t * journal,
+ account_t * master = NULL,
+ const std::string * original_file = NULL) = 0;
+
+ static parsers_list parsers;
+
+ static unsigned int parse_file(const std::string& path,
+ journal_t * journal,
+ account_t * master = NULL,
+ const std::string * original_file = NULL);
+};
+
+} // namespace ledger
+
+#endif // _PARSER_H