summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-13 03:54:36 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-13 03:54:36 -0400
commit44a5103e1ce9f968df02ac6e1f86fcf9415a1983 (patch)
tree6dba3e3fcbfb32b294d7c2bbbd84c953d2ef8b2f /src
parentf3fa011d39336f9a13ad1f09016e30f88e09ba56 (diff)
downloadfork-ledger-44a5103e1ce9f968df02ac6e1f86fcf9415a1983.tar.gz
fork-ledger-44a5103e1ce9f968df02ac6e1f86fcf9415a1983.tar.bz2
fork-ledger-44a5103e1ce9f968df02ac6e1f86fcf9415a1983.zip
Moved value_t::label() to value.cc
Diffstat (limited to 'src')
-rw-r--r--src/value.cc39
-rw-r--r--src/value.h34
2 files changed, 40 insertions, 33 deletions
diff --git a/src/value.cc b/src/value.cc
index f03b4017..fd49e85c 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -1700,6 +1700,45 @@ value_t value_t::strip_annotations(const keep_details_t& what_to_keep) const
return NULL_VALUE;
}
+string value_t::label(optional<type_t> the_type) const
+{
+ switch (the_type ? *the_type : type()) {
+ case VOID:
+ return _("an uninitialized value");
+ case BOOLEAN:
+ return _("a boolean");
+ case DATETIME:
+ return _("a date/time");
+ case DATE:
+ return _("a date");
+ case INTEGER:
+ return _("an integer");
+ case AMOUNT:
+ return _("an amount");
+ case BALANCE:
+ return _("a balance");
+ case STRING:
+ return _("a string");
+ case MASK:
+ return _("a regexp");
+ case SEQUENCE:
+ return _("a sequence");
+ case SCOPE:
+ return _("a scope");
+ case ANY:
+ if (as_any().type() == typeid(expr_t::ptr_op_t))
+ return _("an expr");
+ else
+ return _("an object");
+ break;
+ default:
+ assert(false);
+ break;
+ }
+ assert(false);
+ return _("<invalid>");
+}
+
void value_t::print(std::ostream& out,
const int first_width,
const int latter_width,
diff --git a/src/value.h b/src/value.h
index 5971535c..7bd09c9a 100644
--- a/src/value.h
+++ b/src/value.h
@@ -904,39 +904,7 @@ public:
/**
* Informational methods.
*/
- string label(optional<type_t> the_type = none) const {
- switch (the_type ? *the_type : type()) {
- case VOID:
- return _("an uninitialized value");
- case BOOLEAN:
- return _("a boolean");
- case DATETIME:
- return _("a date/time");
- case DATE:
- return _("a date");
- case INTEGER:
- return _("an integer");
- case AMOUNT:
- return _("an amount");
- case BALANCE:
- return _("a balance");
- case STRING:
- return _("a string");
- case MASK:
- return _("a regexp");
- case SEQUENCE:
- return _("a sequence");
- case SCOPE:
- return _("a scope");
- case EXPR:
- return _("a expr");
- default:
- assert(false);
- break;
- }
- assert(false);
- return _("<invalid>");
- }
+ string label(optional<type_t> the_type = none) const;
/**
* Printing methods.