summaryrefslogtreecommitdiff
path: root/src/pool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pool.h')
-rw-r--r--src/pool.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pool.h b/src/pool.h
index 7328df9d..995ab23c 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -57,6 +57,7 @@ struct cost_breakdown_t
class commodity_pool_t : public noncopyable
{
+public:
/**
* The commodities collection in commodity_pool_t maintains pointers to all
* the commodities which have ever been created by the user, whether
@@ -65,7 +66,6 @@ class commodity_pool_t : public noncopyable
*/
typedef std::map<string, commodity_t *> commodities_map;
-public:
commodities_map commodities;
commodity_t * null_commodity;
commodity_t * default_commodity;
@@ -76,13 +76,15 @@ public:
long quote_leeway; // --leeway=
bool get_quotes; // --download
+ static shared_ptr<commodity_pool_t> current_pool;
+
function<optional<price_point_t>
(commodity_t& commodity, const optional<commodity_t&>& in_terms_of)>
get_commodity_quote;
explicit commodity_pool_t();
- ~commodity_pool_t() {
+ virtual ~commodity_pool_t() {
TRACE_DTOR(commodity_pool_t);
foreach (commodities_map::value_type pair, commodities)
checked_delete(pair.second);
@@ -121,7 +123,8 @@ public:
// Parse commodity prices from a textual representation
- optional<price_point_t> parse_price_directive(char * line);
+ optional<std::pair<commodity_t *, price_point_t> >
+ parse_price_directive(char * line, bool do_not_add_price = false);
commodity_t *
parse_price_expression(const std::string& str,
@@ -136,6 +139,7 @@ private:
template<class Archive>
void serialize(Archive& ar, const unsigned int /* version */) {
+ ar & current_pool;
ar & commodities;
ar & null_commodity;
ar & default_commodity;