summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-25 04:35:19 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-25 05:01:39 -0400
commit588f2ef2f51d7bdf209820bfb244034863601939 (patch)
tree7a473de7c117bf71bb802398823826ca4dfbfdca /src/value.cc
parentdc66840dd745863c06ad6513f9f66d589bcc29d8 (diff)
downloadfork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.tar.gz
fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.tar.bz2
fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.zip
Fixed many compiler warnings from g++ 4.4
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index 702b889e..0f831cdf 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -173,6 +173,17 @@ date_t value_t::to_date() const
}
}
+int value_t::to_int() const
+{
+ if (is_long()) {
+ return static_cast<int>(as_long());
+ } else {
+ value_t temp(*this);
+ temp.in_place_cast(INTEGER);
+ return static_cast<int>(temp.as_long());
+ }
+}
+
long value_t::to_long() const
{
if (is_long()) {