diff options
author | John Wiegley <johnw@newartisans.com> | 2012-05-18 01:31:01 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-05-18 01:31:01 -0600 |
commit | a38ed141c1f33ecdad99b322acb1ae07b30a5da2 (patch) | |
tree | c6555946e2575a6bcb0ae7642673257954e38ac1 /src/ptree.h | |
parent | 3c3bda19d62eed165b9191dbf1adcb3e7c975356 (diff) | |
download | fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.tar.gz fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.tar.bz2 fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.zip |
Switched to Boost.PropertyTree for XML generation
Diffstat (limited to 'src/ptree.h')
-rw-r--r-- | src/ptree.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/src/ptree.h b/src/ptree.h new file mode 100644 index 00000000..d3fecc88 --- /dev/null +++ b/src/ptree.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2003-2012, John Wiegley. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of New Artisans LLC nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @addtogroup report + */ + +/** + * @file ptree.h + * @author John Wiegley + * + * @ingroup report + * + * @brief Brief + * + * Long. + */ +#ifndef _PTREE_H +#define _PTREE_H + +#include "chain.h" + +namespace ledger { + +class xact_t; +class account_t; +class commodity_t; +class post_t; +class report_t; + +/** + * @brief Brief + * + * Long. + */ +class format_ptree : public item_handler<post_t> +{ +protected: + report_t& report; + + typedef std::map<string, commodity_t *> commodities_map; + typedef std::pair<string, commodity_t *> commodities_pair; + + commodities_map commodities; + std::set<xact_t *> transactions_set; + std::deque<xact_t *> transactions; + +public: + format_ptree(report_t& _report) : report(_report) { + TRACE_CTOR(format_ptree, "report&"); + } + virtual ~format_ptree() { + TRACE_DTOR(format_ptree); + } + + virtual void flush(); + virtual void operator()(post_t& post); + + virtual void clear() { + commodities.clear(); + transactions_set.clear(); + transactions.clear(); + + item_handler<post_t>::clear(); + } +}; + +} // namespace ledger + +#endif // _PTREE_H |