diff options
author | Martijn Otto <martijn.otto@copernica.com> | 2014-02-17 16:38:58 +0100 |
---|---|---|
committer | Martijn Otto <martijn.otto@copernica.com> | 2014-02-17 16:38:58 +0100 |
commit | ff3c75d116f3764253b727b3d8e8106710c22628 (patch) | |
tree | feb7cdeac1c3662caa498fae20f5c9ea5a335000 /src/stringmember.h | |
parent | ca595b1d7aa8ed4a482b8a5ea598ecc1a2636083 (diff) |
Removed unnecessary function declareConst and made the declare function for memberinfo descendants override
Diffstat (limited to 'src/stringmember.h')
-rw-r--r-- | src/stringmember.h | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/stringmember.h b/src/stringmember.h index d6ac6ea..8f0a1e9 100644 --- a/src/stringmember.h +++ b/src/stringmember.h @@ -56,28 +56,14 @@ public: * @param size Size of the name * @param flags Additional flags */ - virtual void declare(struct _zend_class_entry *entry, const char *name, int size, int flags) - { -#if PHP_VERSION_ID >= 50400 - zend_declare_property_stringl(entry, name, size, _value.c_str(), _value.size(), flags); -#else - zend_declare_property_stringl(entry, (char*) name, size, (char *) _value.c_str(), _value.size(), flags); -#endif - } - - /** - * Virtual method to declare the class constant - * @param entry Class entry - * @param name Name of the member - * @param size Size of the name - * @param flags Additional flags - */ - virtual void declareConst(struct _zend_class_entry *entry, const char *name, int size) + virtual void declare(struct _zend_class_entry *entry, const char *name, int size, int flags) override { #if PHP_VERSION_ID >= 50400 - zend_declare_class_constant_stringl(entry, name, size, _value.c_str(), _value.size()); + if (flags == constMember) zend_declare_class_constant_stringl(entry, name, size, _value.c_str(), _value.size()); + else zend_declare_property_stringl(entry, name, size, _value.c_str(), _value.size(), flags); #else - zend_declare_class_constant_stringl(entry, (char*) name, size, (char *) _value.c_str(), _value.size()); + if (flags == constMember) zend_declare_property_stringl(entry, (char*) name, size, (char *) _value.c_str(), _value.size(), flags); + else zend_declare_class_constant_stringl(entry, (char*) name, size, (char *) _value.c_str(), _value.size()); #endif } }; |