diff options
author | John Wiegley <johnw@newartisans.com> | 2007-05-19 07:34:52 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:39:05 -0400 |
commit | 3e0f510b296c0b72353f146912bb0225af0a5647 (patch) | |
tree | 8ff4098ea790bbaf2b26a13d1b76487fe80b6041 /src/compile.h | |
parent | 5a72d17d026aa6a1bb0cd32f413963ef9f24ab64 (diff) | |
download | fork-ledger-3e0f510b296c0b72353f146912bb0225af0a5647.tar.gz fork-ledger-3e0f510b296c0b72353f146912bb0225af0a5647.tar.bz2 fork-ledger-3e0f510b296c0b72353f146912bb0225af0a5647.zip |
More work on the compilation of nodes.
Diffstat (limited to 'src/compile.h')
-rw-r--r-- | src/compile.h | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/src/compile.h b/src/compile.h index 81319345..d8b9f536 100644 --- a/src/compile.h +++ b/src/compile.h @@ -38,6 +38,8 @@ namespace ledger { namespace xml { +void compile_node(node_t& node, xml::xpath_t::scope_t& scope); + #if 0 class commodity_node_t : public parent_node_t { @@ -82,6 +84,25 @@ public: }; #endif +class journal_node_t : public parent_node_t +{ +public: + shared_ptr<journal_t> journal; + + journal_node_t(nameid_t _name_id, + document_t& _document, + const optional<parent_node_t&>& _parent = none, + journal_t * _journal = NULL) + : parent_node_t(_name_id, _document, _parent), journal(_journal) { + TRACE_CTOR(journal_node_t, "document_t *, journal_t *, parent_node_t *"); + } + virtual ~journal_node_t() { + TRACE_DTOR(journal_node_t); + } + + void compile(xpath_t::scope_t& scope); +}; + class entry_node_t : public parent_node_t { public: @@ -99,7 +120,7 @@ public: TRACE_DTOR(entry_node_t); } - virtual void compile(); + void compile(xpath_t::scope_t& scope); }; class transaction_node_t : public parent_node_t @@ -120,30 +141,15 @@ public: virtual ~transaction_node_t() { TRACE_DTOR(transaction_node_t); } -}; -#if 0 -class entry_node_t : public parent_node_t -{ - entry_t * entry; + void compile(xpath_t::scope_t& scope); -public: - entry_node_t(document_t * _document, entry_t * _entry, - parent_node_t * _parent = NULL) - : parent_node_t(_document, _parent), entry(_entry) { - TRACE_CTOR(entry_node_t, "document_t *, entry_t *, parent_node_t *"); - set_name(document_t::ENTRY); - } - virtual ~entry_node_t() { - TRACE_DTOR(entry_node_t); - } - - virtual node_t * children() const; - virtual node_t * lookup_child(int _name_id) const; - - friend class transaction_node_t; +private: + void parse_amount_expr(xpath_t::scope_t& scope, + const char * amount_expr); }; +#if 0 class account_node_t : public parent_node_t { account_t * account; @@ -162,26 +168,6 @@ public: virtual node_t * children() const; }; -class journal_node_t : public parent_node_t -{ - journal_t * journal; - -public: - journal_node_t(document_t * _document, journal_t * _journal, - parent_node_t * _parent = NULL) - : parent_node_t(_document, _parent), journal(_journal) { - TRACE_CTOR(journal_node_t, "document_t *, journal_t *, parent_node_t *"); - set_name(document_t::JOURNAL); - } - virtual ~journal_node_t() { - TRACE_DTOR(journal_node_t); - } - - virtual node_t * children() const; - - friend class transaction_node_t; -}; - template <typename T> inline typename T::node_type * wrap_node(document_t * doc, T * item, void * parent_node = NULL) { |