*** no comment ***
This commit is contained in:
parent
994fb34699
commit
9044bf168a
20 changed files with 46 additions and 56 deletions
|
|
@ -659,7 +659,7 @@ optional<amount_t> amount_t::value(const optional<moment_t>& moment) const
|
|||
} else {
|
||||
throw_(amount_error, "Cannot determine value of an uninitialized amount");
|
||||
}
|
||||
return optional<amount_t>();
|
||||
return none;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -359,8 +359,7 @@ public:
|
|||
}
|
||||
amount_t& in_place_unreduce();
|
||||
|
||||
optional<amount_t> value(const optional<moment_t>& moment =
|
||||
optional<moment_t>()) const;
|
||||
optional<amount_t> value(const optional<moment_t>& moment = none) const;
|
||||
|
||||
/**
|
||||
* Truth tests. An amount may be truth test in several ways:
|
||||
|
|
@ -502,7 +501,7 @@ public:
|
|||
* annotate_commodity(amount_t price, [moment_t date, string tag])
|
||||
* sets the annotations for the current amount's commodity. Only
|
||||
* the price argument is required, although it can be passed as
|
||||
* `optional<amount_t>()' if no price is desired.
|
||||
* `none' if no price is desired.
|
||||
*
|
||||
* commodity_annotated() returns true if an amount's commodity has
|
||||
* any annotation details associated with it.
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ balance_t::amount(const optional<const commodity_t&>& commodity) const
|
|||
if (i != amounts.end())
|
||||
return (*i).second;
|
||||
}
|
||||
return optional<amount_t>();
|
||||
return none;
|
||||
}
|
||||
|
||||
optional<balance_t>
|
||||
|
|
|
|||
|
|
@ -179,10 +179,9 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
optional<amount_t> amount(const optional<const commodity_t&>& commodity =
|
||||
optional<const commodity_t&>()) const;
|
||||
optional<balance_t> value(const optional<moment_t>& moment =
|
||||
optional<moment_t>()) const;
|
||||
optional<amount_t>
|
||||
amount(const optional<const commodity_t&>& commodity = none) const;
|
||||
optional<balance_t> value(const optional<moment_t>& moment = none) const;
|
||||
|
||||
balance_t
|
||||
strip_annotations(const bool keep_price = amount_t::keep_price,
|
||||
|
|
|
|||
|
|
@ -157,12 +157,11 @@ public:
|
|||
return temp;
|
||||
}
|
||||
|
||||
optional<amount_t> amount(const optional<const commodity_t&>& commodity =
|
||||
optional<const commodity_t&>()) const {
|
||||
optional<amount_t>
|
||||
amount(const optional<const commodity_t&>& commodity = none) const {
|
||||
return quantity.amount(commodity);
|
||||
}
|
||||
optional<balance_t> value(const optional<moment_t>& moment =
|
||||
optional<moment_t>()) const {
|
||||
optional<balance_t> value(const optional<moment_t>& moment = none) const {
|
||||
return quantity.value(moment);
|
||||
}
|
||||
|
||||
|
|
@ -179,7 +178,7 @@ public:
|
|||
}
|
||||
|
||||
balance_pair_t& add(const amount_t& amt,
|
||||
const optional<amount_t>& a_cost = optional<amount_t>()) {
|
||||
const optional<amount_t>& a_cost = none) {
|
||||
if (a_cost && ! cost)
|
||||
cost = quantity;
|
||||
quantity += amt;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ class builder_t
|
|||
|
||||
virtual void appendText(const string& text) = 0;
|
||||
|
||||
virtual node_t * endNode(const optional<string>& name =
|
||||
optional<string>()) = 0;
|
||||
virtual node_t * endNode(const optional<string>& name = none) = 0;
|
||||
virtual node_t * endNode(const nameid_t name_id) = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ optional<amount_t> commodity_t::value(const optional<moment_t>& moment)
|
|||
age = (*i).first;
|
||||
price = (*i).second;
|
||||
} else {
|
||||
age = optional<moment_t>();
|
||||
age = none;
|
||||
}
|
||||
} else {
|
||||
price = (*i).second;
|
||||
|
|
@ -307,9 +307,9 @@ annotated_commodity_t::strip_annotations(const bool _keep_price,
|
|||
{
|
||||
new_comm = parent().find_or_create
|
||||
(referent(),
|
||||
annotation_t(_keep_price ? details.price : optional<amount_t>(),
|
||||
_keep_date ? details.date : optional<moment_t>(),
|
||||
_keep_tag ? details.tag : optional<string>()));
|
||||
annotation_t(_keep_price ? details.price : none,
|
||||
_keep_date ? details.date : none,
|
||||
_keep_tag ? details.tag : none));
|
||||
} else {
|
||||
new_comm = parent().find_or_create(base_symbol());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,14 +148,14 @@ public:
|
|||
optional<string> name() const {
|
||||
return base->name;
|
||||
}
|
||||
void set_name(const optional<string>& arg = optional<string>()) {
|
||||
void set_name(const optional<string>& arg = none) {
|
||||
base->name = arg;
|
||||
}
|
||||
|
||||
optional<string> note() const {
|
||||
return base->note;
|
||||
}
|
||||
void set_note(const optional<string>& arg = optional<string>()) {
|
||||
void set_note(const optional<string>& arg = none) {
|
||||
base->note = arg;
|
||||
}
|
||||
|
||||
|
|
@ -169,14 +169,14 @@ public:
|
|||
optional<amount_t> smaller() const {
|
||||
return base->smaller;
|
||||
}
|
||||
void set_smaller(const optional<amount_t>& arg = optional<amount_t>()) {
|
||||
void set_smaller(const optional<amount_t>& arg = none) {
|
||||
base->smaller = arg;
|
||||
}
|
||||
|
||||
optional<amount_t> larger() const {
|
||||
return base->larger;
|
||||
}
|
||||
void set_larger(const optional<amount_t>& arg = optional<amount_t>()) {
|
||||
void set_larger(const optional<amount_t>& arg = none) {
|
||||
base->larger = arg;
|
||||
}
|
||||
|
||||
|
|
@ -187,8 +187,7 @@ public:
|
|||
void add_price(const moment_t& date, const amount_t& price);
|
||||
bool remove_price(const moment_t& date);
|
||||
|
||||
optional<amount_t> value(const optional<moment_t>& moment =
|
||||
optional<moment_t>());
|
||||
optional<amount_t> value(const optional<moment_t>& moment = none);
|
||||
|
||||
static void parse_symbol(std::istream& in, string& symbol);
|
||||
static string parse_symbol(std::istream& in) {
|
||||
|
|
@ -220,9 +219,9 @@ struct annotation_t : public equality_comparable<annotation_t>
|
|||
optional<string> tag;
|
||||
|
||||
explicit annotation_t
|
||||
(const optional<amount_t>& _price = optional<amount_t>(),
|
||||
const optional<moment_t>& _date = optional<moment_t>(),
|
||||
const optional<string>& _tag = optional<string>())
|
||||
(const optional<amount_t>& _price = none,
|
||||
const optional<moment_t>& _date = none,
|
||||
const optional<string>& _tag = none)
|
||||
: price(_price), date(_date), tag(_tag) {}
|
||||
|
||||
operator bool() const {
|
||||
|
|
@ -354,8 +353,7 @@ public:
|
|||
(commodity_t& commodity,
|
||||
const optional<moment_t>& date,
|
||||
const optional<moment_t>& moment,
|
||||
const optional<moment_t>& last),
|
||||
first_initialized<optional<amount_t> > > get_quote;
|
||||
const optional<moment_t>& last)> get_quote;
|
||||
|
||||
explicit commodity_pool_t();
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ struct gnucash_parser_t : public parser_t
|
|||
virtual unsigned int parse(std::istream& in,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>());
|
||||
const optional<path>& original = none);
|
||||
|
||||
amount_t convert_number(const string& number, int * precision = NULL);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -94,10 +94,10 @@ class transaction_t : public supports_flags<>
|
|||
data(NULL) {
|
||||
TRACE_CTOR(transaction_t, "account_t *");
|
||||
}
|
||||
explicit transaction_t(account_t * _account,
|
||||
const amount_t& _amount,
|
||||
unsigned int _flags = TRANSACTION_NORMAL,
|
||||
const optional<string> _note = optional<string>())
|
||||
explicit transaction_t(account_t * _account,
|
||||
const amount_t& _amount,
|
||||
unsigned int _flags = TRANSACTION_NORMAL,
|
||||
const optional<string> _note = none)
|
||||
: supports_flags<>(_flags),
|
||||
entry(NULL),
|
||||
state(UNCLEARED),
|
||||
|
|
@ -345,7 +345,7 @@ class account_t
|
|||
|
||||
account_t(account_t * _parent = NULL,
|
||||
const string& _name = "",
|
||||
const optional<string> _note = optional<string>())
|
||||
const optional<string> _note = none)
|
||||
: parent(_parent), name(_name), note(_note),
|
||||
depth(parent ? parent->depth + 1 : 0), data(NULL), ident(0) {
|
||||
TRACE_CTOR(account_t, "account_t *, const string&, const string&");
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class ofx_parser_t : public parser_t
|
|||
virtual unsigned int parse(std::istream& in,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>());
|
||||
const optional<path>& original = none);
|
||||
};
|
||||
|
||||
} // namespace ledger
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class parser_t
|
|||
virtual unsigned int parse(std::istream& in,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>()) = 0;
|
||||
const optional<path>& original = none) = 0;
|
||||
};
|
||||
|
||||
DECLARE_EXCEPTION(parse_error);
|
||||
|
|
|
|||
|
|
@ -291,8 +291,7 @@ void export_journal()
|
|||
;
|
||||
|
||||
class_< account_t >
|
||||
("Account",
|
||||
init<optional<account_t *, string, string> >()
|
||||
("Account", init<optional<account_t *, string, string> >()
|
||||
[with_custodian_and_ward<1, 2>()])
|
||||
.def(self == self)
|
||||
.def(self != self)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class qif_parser_t : public parser_t
|
|||
virtual unsigned int parse(std::istream& in,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>());
|
||||
const optional<path>& original = none);
|
||||
};
|
||||
|
||||
} // namespace ledger
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ quotes_by_script::operator()(commodity_t& commodity,
|
|||
(last && (now - *last) < pricing_leeway) ||
|
||||
(moment && date && *moment > *date &&
|
||||
(*moment - *date) <= pricing_leeway))
|
||||
return optional<amount_t>();
|
||||
return none;
|
||||
|
||||
DEBUG_("downloading quote for symbol " << commodity.symbol());
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ quotes_by_script::operator()(commodity_t& commodity,
|
|||
"Failed to download price for '" << commodity.symbol() <<
|
||||
"' (command: \"getquote " << commodity.base_symbol() << "\")");
|
||||
}
|
||||
return optional<amount_t>();
|
||||
return none;
|
||||
}
|
||||
|
||||
} // namespace ledger
|
||||
|
|
|
|||
|
|
@ -93,8 +93,7 @@ unsigned int session_t::read_journal(const path& pathname,
|
|||
journal->sources.push_back(pathname);
|
||||
|
||||
if (! exists(pathname))
|
||||
throw filesystem_error(BOOST_CURRENT_FUNCTION, pathname,
|
||||
"Cannot read file");
|
||||
throw_(std::logic_error, "Cannot read file" << pathname);
|
||||
|
||||
ifstream stream(pathname);
|
||||
return read_journal(stream, journal, master,
|
||||
|
|
@ -107,8 +106,7 @@ void session_t::read_init()
|
|||
return;
|
||||
|
||||
if (! exists(*init_file))
|
||||
throw filesystem_error(BOOST_CURRENT_FUNCTION, *init_file,
|
||||
"Cannot read init file");
|
||||
throw_(std::logic_error, "Cannot read init file" << *init_file);
|
||||
|
||||
ifstream init(*init_file);
|
||||
|
||||
|
|
|
|||
|
|
@ -151,12 +151,12 @@ class session_t : public xml::xpath_t::scope_t
|
|||
unsigned int read_journal(std::istream& in,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>());
|
||||
const optional<path>& original = none);
|
||||
|
||||
unsigned int read_journal(const path& pathname,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>());
|
||||
const optional<path>& original = none);
|
||||
|
||||
void read_init();
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class textual_parser_t : public parser_t
|
|||
virtual unsigned int parse(std::istream& in,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>());
|
||||
const optional<path>& original = none);
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ class value_t
|
|||
bool operator<(const value_t& val) const;
|
||||
//bool operator>(const value_t& val) const;
|
||||
|
||||
string label(optional<type_t> the_type = optional<type_t>()) const {
|
||||
string label(optional<type_t> the_type = none) const {
|
||||
switch (the_type ? *the_type : type) {
|
||||
case VOID:
|
||||
return "an uninitialized value";
|
||||
|
|
@ -362,9 +362,8 @@ class value_t
|
|||
const bool keep_tag = amount_t::keep_tag) const;
|
||||
|
||||
value_t& add(const amount_t& amount,
|
||||
const optional<amount_t>& cost = optional<amount_t>());
|
||||
value_t value(const optional<moment_t>& moment =
|
||||
optional<moment_t>()) const;
|
||||
const optional<amount_t>& cost = none);
|
||||
value_t value(const optional<moment_t>& moment = none) const;
|
||||
|
||||
void in_place_reduce();
|
||||
value_t reduce() const {
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class xml_parser_t : public parser_t
|
|||
virtual unsigned int parse(std::istream& in,
|
||||
journal_t * journal,
|
||||
account_t * master = NULL,
|
||||
const optional<path>& original = optional<path>());
|
||||
const optional<path>& original = none);
|
||||
};
|
||||
|
||||
DECLARE_EXCEPTION(parse_error);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue