summaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-09 17:27:54 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-09 17:27:54 -0400
commit6ca01af594148e12cd8e1da87302644a0bbae3a0 (patch)
treebb83af15a352e3125053a3d5c0761f8e395ed2c3 /src/item.cc
parentcad86ed87f3548aaf9d35890f2b686c2bf064368 (diff)
downloadfork-ledger-6ca01af594148e12cd8e1da87302644a0bbae3a0.tar.gz
fork-ledger-6ca01af594148e12cd8e1da87302644a0bbae3a0.tar.bz2
fork-ledger-6ca01af594148e12cd8e1da87302644a0bbae3a0.zip
Fixed the use of --effective and --date-format (-y).
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/item.cc b/src/item.cc
index 44a80e63..22e24738 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -33,6 +33,8 @@
namespace ledger {
+bool item_t::use_effective_date = false;
+
bool item_t::has_tag(const string& tag) const
{
if (! metadata)
@@ -136,12 +138,8 @@ namespace {
}
value_t get_date(item_t& item) {
- if (optional<date_t> date = item.date())
- return *date;
- else
- return 0L;
+ return item.date();
}
-
value_t get_note(item_t& item) {
return string_value(item.note ? *item.note : empty_string);
}
@@ -334,6 +332,13 @@ string item_context(const item_t& item, const string& desc)
assert(len > 0);
assert(len < 2048);
+ std::ostringstream out;
+
+ if (item.pathname == path("/dev/stdin")) {
+ out << desc << " from standard input:";
+ return out.str();
+ }
+
ifstream in(item.pathname);
in.seekg(item.beg_pos, std::ios::beg);
@@ -342,8 +347,6 @@ string item_context(const item_t& item, const string& desc)
assert(static_cast<std::size_t>(in.gcount()) == len);
buf[len] = '\0';
- std::ostringstream out;
-
out << desc << " from \"" << item.pathname.string() << "\"";
if (item.beg_line != item.end_line)