summaryrefslogtreecommitdiff
path: root/project2/variables-moduri.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/variables-moduri.cpp')
-rw-r--r--project2/variables-moduri.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/project2/variables-moduri.cpp b/project2/variables-moduri.cpp
index f6793e1..00fb7bf 100644
--- a/project2/variables-moduri.cpp
+++ b/project2/variables-moduri.cpp
@@ -11,21 +11,17 @@ class VariableUri : public VariableImplDyn {
index(atoi(e->get_attribute_value("index").c_str()))
{
}
- const VariableType & value() const
+ VariableType value() const
{
- if (!cacheValid) {
- try {
- cache = ApplicationEngine::getCurrent()->env()->getParamUri(index);
- }
- catch (UriElementOutOfRange) {
- if (!defaultValue) {
- throw;
- }
- cache = (*defaultValue)();
+ try {
+ return ApplicationEngine::getCurrent()->env()->getParamUri(index);
+ }
+ catch (UriElementOutOfRange) {
+ if (!defaultValue) {
+ throw;
}
- cacheValid = true;
+ return (*defaultValue)();
}
- return cache;
}
private:
unsigned int index;