diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-14 09:21:35 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-14 09:21:35 +0200 |
commit | 6b5506dfe7b0f5ac9ce923c1d9cdd2ebc4c72a7c (patch) | |
tree | 4b8e29c6cdb8347569a89e2758edb6518ff6f962 | |
parent | 792497f731c5c3a93a442bd487bd7ae4e0ffb2bf (diff) |
added Php::IniValue constructor to the Php::Value class, so that "return Php::ini_get("extension.x");" can be implemented
-rw-r--r-- | include/call.h | 18 | ||||
-rw-r--r-- | include/value.h | 1 | ||||
-rw-r--r-- | zend/value.cpp | 8 |
3 files changed, 17 insertions, 10 deletions
diff --git a/include/call.h b/include/call.h index f881782..16de1fe 100644 --- a/include/call.h +++ b/include/call.h @@ -57,16 +57,6 @@ inline Value echo(const std::string &input) { out << input; return nullptr; } inline Value empty(const Value &value) { return value.isNull() || !value.boolValue(); } inline Value empty(const HashMember<std::string> &member) { return !member.exists() || empty(member.value()); } inline Value empty(const HashMember<int> &member) { return !member.exists() || empty(member.value()); } - -inline IniValue ini_get(const char* name) -{ - return IniValue(name, false); -} -inline IniValue ini_get_orig(const char* name) -{ - return IniValue(name, true); -} - inline Value is_array(const Value &value) { return value.isArray(); } inline Value strlen(const Value &value) { return call("strlen", value); } inline void unset(const HashMember<std::string> &member) { member.unset(); } @@ -74,6 +64,14 @@ inline void unset(const HashMember<int> &member) { member.unset(); } inline void unset(const HashMember<Value> &member) { member.unset(); } /** + * The 'ini_get' function returns an IniValue, so that it can also be used + * before the PHP engine is started. + */ +inline IniValue ini_get(const char* name) { return IniValue(name, false); } +inline IniValue ini_get_orig(const char* name) { return IniValue(name, true); } + + +/** * The isset function conflicts with the 'isset' macro defined by the Zend engine */ #pragma push_macro("isset") diff --git a/include/value.h b/include/value.h index d64eeed..63e8e6f 100644 --- a/include/value.h +++ b/include/value.h @@ -59,6 +59,7 @@ public: Value(const std::string &value); Value(const char *value, int size = -1); Value(double value); + Value(const IniValue &value); /** * Construct to a specific type diff --git a/zend/value.cpp b/zend/value.cpp index dd371b9..9040234 100644 --- a/zend/value.cpp +++ b/zend/value.cpp @@ -205,6 +205,14 @@ Value::Value(const Base *object) } /** + * Wrap around a php.ini value + * @param value + */ +Value::Value(const IniValue &value) : Value((const char *)value) +{ +} + +/** * Copy constructor * @param value */ |