From e124811d8a31292c06430815683b2e0fe87f7ceb Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 22 Feb 2009 04:43:34 -0400 Subject: Added --exchange (-x) option This is like -V, except it lets you specify the goal commodity to report in terms of, for example: reg -x CAD --- src/commodity.h | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/commodity.h') diff --git a/src/commodity.h b/src/commodity.h index b6ce0c85..4e57ec6f 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -72,13 +72,13 @@ struct price_point_t * Long. */ class commodity_t - : public delegates_flags<>, + : public delegates_flags, public equality_comparable1 { friend class commodity_pool_t; public: - class base_t : public noncopyable, public supports_flags<> + class base_t : public noncopyable, public supports_flags { base_t(); @@ -90,7 +90,7 @@ public: history_map prices; ptime last_lookup; - void add_price(const commodity_t& source, + void add_price(commodity_t& source, const datetime_t& date, const amount_t& price, const bool reflexive = true); @@ -111,14 +111,14 @@ public: { history_by_commodity_map histories; - void add_price(const commodity_t& source, + void add_price(commodity_t& source, const datetime_t& date, const amount_t& price, const bool reflexive = true); bool remove_price(const datetime_t& date, commodity_t& commodity); optional - find_price(const commodity_t& source, + find_price(const commodity_t& source, const optional& commodity = none, const optional& moment = none, const optional& oldest = none @@ -127,7 +127,7 @@ public: #endif ) const; optional - find_price(const commodity_t& source, + find_price(const commodity_t& source, const std::vector& commodities, const optional& moment = none, const optional& oldest = none @@ -142,15 +142,16 @@ public: history(const std::vector& commodities); }; -#define COMMODITY_STYLE_DEFAULTS 0x00 -#define COMMODITY_STYLE_SUFFIXED 0x01 -#define COMMODITY_STYLE_SEPARATED 0x02 -#define COMMODITY_STYLE_EUROPEAN 0x04 -#define COMMODITY_STYLE_THOUSANDS 0x08 -#define COMMODITY_NOMARKET 0x10 -#define COMMODITY_BUILTIN 0x20 -#define COMMODITY_WALKED 0x40 -#define COMMODITY_KNOWN 0x80 +#define COMMODITY_STYLE_DEFAULTS 0x000 +#define COMMODITY_STYLE_SUFFIXED 0x001 +#define COMMODITY_STYLE_SEPARATED 0x002 +#define COMMODITY_STYLE_EUROPEAN 0x004 +#define COMMODITY_STYLE_THOUSANDS 0x008 +#define COMMODITY_NOMARKET 0x010 +#define COMMODITY_BUILTIN 0x020 +#define COMMODITY_WALKED 0x040 +#define COMMODITY_KNOWN 0x080 +#define COMMODITY_PRIMARY 0x100 string symbol; amount_t::precision_t precision; @@ -164,7 +165,7 @@ public: public: explicit base_t(const string& _symbol) - : supports_flags<>(COMMODITY_STYLE_DEFAULTS), + : supports_flags(COMMODITY_STYLE_DEFAULTS), symbol(_symbol), precision(0), searched(false) { TRACE_CTOR(base_t, "const string&"); } @@ -191,7 +192,7 @@ public: public: explicit commodity_t(commodity_pool_t * _parent, const shared_ptr& _base) - : delegates_flags<>(*_base.get()), base(_base), + : delegates_flags(*_base.get()), base(_base), parent_(_parent), annotated(false) { TRACE_CTOR(commodity_t, ""); } -- cgit v1.2.3