summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-23 15:22:05 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-23 15:22:05 -0400
commit1406cbe853e495391ee92daa7d636042349d1c6d (patch)
tree0b2ae6b2dede1c08ca2d1af587eed314e693e436 /src
parent49d79045a5ca3f8a5c9df02d9be8e25c49d4daa7 (diff)
downloadfork-ledger-1406cbe853e495391ee92daa7d636042349d1c6d.tar.gz
fork-ledger-1406cbe853e495391ee92daa7d636042349d1c6d.tar.bz2
fork-ledger-1406cbe853e495391ee92daa7d636042349d1c6d.zip
Changed the constness of interactive_t::get<T>
Diffstat (limited to 'src')
-rw-r--r--src/interactive.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/interactive.h b/src/interactive.h
index a2c64ffb..a0388726 100644
--- a/src/interactive.h
+++ b/src/interactive.h
@@ -78,39 +78,53 @@ public:
return false;
}
- const value_t& value_at(std::size_t index) const {
+ value_t& value_at(std::size_t index) {
assert(has(index));
return args[index];
}
template <typename T>
- T get(std::size_t index) const;
+ T get(std::size_t index);
};
template <>
-inline bool interactive_t::get<bool>(std::size_t index) const {
+inline bool interactive_t::get<bool>(std::size_t index) {
return value_at(index).to_boolean();
}
template <>
-inline long interactive_t::get<long>(std::size_t index) const {
+inline long interactive_t::get<long>(std::size_t index) {
return value_at(index).to_long();
}
template <>
-inline string interactive_t::get<string>(std::size_t index) const {
+inline amount_t interactive_t::get<amount_t>(std::size_t index) {
+ return value_at(index).to_amount();
+}
+template <>
+inline string interactive_t::get<string>(std::size_t index) {
return value_at(index).to_string();
}
template <>
-inline mask_t interactive_t::get<mask_t>(std::size_t index) const {
+inline mask_t interactive_t::get<mask_t>(std::size_t index) {
return value_at(index).to_mask();
}
template <>
-inline date_t interactive_t::get<date_t>(std::size_t index) const {
+inline date_t interactive_t::get<date_t>(std::size_t index) {
return value_at(index).to_date();
}
template <>
-inline datetime_t interactive_t::get<datetime_t>(std::size_t index) const {
+inline datetime_t interactive_t::get<datetime_t>(std::size_t index) {
return value_at(index).to_datetime();
}
+template <>
+inline value_t::sequence_t&
+interactive_t::get<value_t::sequence_t&>(std::size_t index) {
+ return value_at(index).as_sequence_lval();
+}
+template <>
+inline const value_t::sequence_t&
+interactive_t::get<const value_t::sequence_t&>(std::size_t index) {
+ return value_at(index).as_sequence();
+}
template <typename T>
class in_context_t : public interactive_t