summaryrefslogtreecommitdiff
path: root/amount.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-03-16 19:14:30 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:31 -0400
commit9800e3febc456edcafbb172c6bef67526a8481da (patch)
tree358f5ca7500ce774398e2511d16403129dc03051 /amount.h
parent31b68bbebcf448406020a8177efe6ae2f381d5cb (diff)
downloadfork-ledger-9800e3febc456edcafbb172c6bef67526a8481da.tar.gz
fork-ledger-9800e3febc456edcafbb172c6bef67526a8481da.tar.bz2
fork-ledger-9800e3febc456edcafbb172c6bef67526a8481da.zip
*** empty log message ***
Diffstat (limited to 'amount.h')
-rw-r--r--amount.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/amount.h b/amount.h
index 5df11817..c9ea7948 100644
--- a/amount.h
+++ b/amount.h
@@ -283,6 +283,9 @@ class amount_t
friend void clean_commodity_history(char * item_pool,
char * item_pool_end);
+
+ friend void parse_annotations(std::istream& in, amount_t& price,
+ std::time_t& date, std::string& tag);
};
unsigned int sizeof_bigint_t();
@@ -365,8 +368,9 @@ class commodity_base_t
amount_t * smaller;
amount_t * larger;
- commodity_base_t() : precision(0), flags(COMMODITY_STYLE_DEFAULTS),
- history(NULL), smaller(NULL), larger(NULL) {}
+ commodity_base_t()
+ : precision(0), flags(COMMODITY_STYLE_DEFAULTS),
+ history(NULL), smaller(NULL), larger(NULL) {}
commodity_base_t(const std::string& _symbol,
unsigned int _precision = 0,
@@ -388,18 +392,13 @@ class commodity_base_t
struct history_t {
history_map prices;
std::time_t last_lookup;
+ std::time_t bogus_time;
+ history_t() : last_lookup(0), bogus_time(0) {}
};
history_t * history;
- void add_price(const std::time_t date, const amount_t& price);
- bool remove_price(const std::time_t date) {
- if (history) {
- history_map::size_type n = history->prices.erase(date);
- return n > 0;
- }
- return false;
- }
-
+ void add_price(const std::time_t date, const amount_t& price);
+ bool remove_price(const std::time_t date);
amount_t value(const std::time_t moment = std::time(NULL));
class updater_t {