summaryrefslogtreecommitdiff
path: root/src/value.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-12-07 13:12:25 -0800
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-12-07 13:12:25 -0800
commit80c8a16fb145f7ed4867d31fad3c22318a1ce708 (patch)
treef7605cdb86d653efaac761363ed596dd6b2e0459 /src/value.cpp
parent964d6274b0eba38df43d77b87c44bd728d2f0fb5 (diff)
replaces tabs in source code with regular spaces, added example for working with global variables
Diffstat (limited to 'src/value.cpp')
-rw-r--r--src/value.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/value.cpp b/src/value.cpp
index b0c3350..194934d 100644
--- a/src/value.cpp
+++ b/src/value.cpp
@@ -299,7 +299,7 @@ Value &Value::operator=(Value &&value)
}
// update the object
- return *this;
+ return validate();
}
/**
@@ -345,7 +345,7 @@ Value &Value::operator=(const Value &value)
}
// update the object
- return *this;
+ return validate();
}
/**
@@ -365,7 +365,7 @@ Value &Value::operator=(int16_t value)
ZVAL_LONG(_val, value);
// update the object
- return *this;
+ return validate();
}
/**
@@ -385,7 +385,7 @@ Value &Value::operator=(int32_t value)
ZVAL_LONG(_val, value);
// update the object
- return *this;
+ return validate();
}
/**
@@ -405,7 +405,7 @@ Value &Value::operator=(int64_t value)
ZVAL_LONG(_val, value);
// update the object
- return *this;
+ return validate();
}
/**
@@ -425,7 +425,7 @@ Value &Value::operator=(bool value)
ZVAL_BOOL(_val, value);
// update the object
- return *this;
+ return validate();
}
/**
@@ -445,7 +445,7 @@ Value &Value::operator=(char value)
ZVAL_STRINGL(_val, &value, 1, 1);
// update the object
- return *this;
+ return validate();
}
/**
@@ -465,7 +465,7 @@ Value &Value::operator=(const std::string &value)
ZVAL_STRINGL(_val, value.c_str(), value.size(), 1);
// update the object
- return *this;
+ return validate();
}
/**
@@ -485,7 +485,7 @@ Value &Value::operator=(const char *value)
ZVAL_STRING(_val, value, 1);
// update the object
- return *this;
+ return validate();
}
/**
@@ -505,7 +505,7 @@ Value &Value::operator=(double value)
ZVAL_DOUBLE(_val, value);
// update the object
- return *this;
+ return validate();
}
/**
@@ -971,8 +971,6 @@ long Value::numericValue() const
// already a long?
if (isNumeric()) return Z_LVAL_P(_val);
- std::cout << "clone to numeric" << std::endl;
-
// make a clone
return clone(numericType).numericValue();
}
@@ -1208,6 +1206,9 @@ const Value &Value::set(int index, const Value &value)
// the variable has one more reference (the array entry)
Z_ADDREF_P(value._val);
+ // object should stay valid
+ validate();
+
// done
return value;
}
@@ -1243,6 +1244,9 @@ const Value &Value::set(const char *key, int size, const Value &value)
// the variable has one more reference (the array entry)
Z_ADDREF_P(value._val);
+ // object should stay valid
+ validate();
+
// done
return value;
}