summaryrefslogtreecommitdiff
path: root/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-21 20:41:42 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-21 20:41:42 -0400
commitaa4f0d4364783ed5cbc97972755c7fd6b0da3cf0 (patch)
tree51c223e4f7dc4226831ae15330d424ff610a018f /value.cc
parent8601a2a8bfd63b54a8c65d34ad021cbe2270d201 (diff)
downloadfork-ledger-aa4f0d4364783ed5cbc97972755c7fd6b0da3cf0.tar.gz
fork-ledger-aa4f0d4364783ed5cbc97972755c7fd6b0da3cf0.tar.bz2
fork-ledger-aa4f0d4364783ed5cbc97972755c7fd6b0da3cf0.zip
Added the var_t helper class, which can be seen in the beginning
implementation of register_command in main.cc.
Diffstat (limited to 'value.cc')
-rw-r--r--value.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/value.cc b/value.cc
index 16091e47..87b5f59a 100644
--- a/value.cc
+++ b/value.cc
@@ -1413,19 +1413,31 @@ void value_t::print(std::ostream& out, const int first_width,
{
switch (type()) {
case VOID:
- out << "NULL";
+ out << "VOID";
break;
case BOOLEAN:
+ out << const_cast<value_t&>(*this).as_boolean_lval();
+ break;
+
case DATETIME:
+ out << const_cast<value_t&>(*this).as_datetime_lval();
+ break;
+
case INTEGER:
+ out << const_cast<value_t&>(*this).as_long_lval();
+ break;
+
case AMOUNT:
+ out << const_cast<value_t&>(*this).as_amount_lval();
+ break;
+
case STRING:
+ out << const_cast<value_t&>(*this).as_string_lval();
+ break;
+
case POINTER:
- // jww (2007-05-14): I need a version of this print just for XPath
- // expression, since amounts and strings need to be output with
- // special syntax.
- out << *this;
+ out << boost::unsafe_any_cast<void *>(&const_cast<value_t&>(*this).as_any_pointer_lval());
break;
case SEQUENCE: {