diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/member.h | 93 | ||||
-rw-r--r-- | include/protected.h | 10 | ||||
-rw-r--r-- | include/public.h | 10 |
3 files changed, 105 insertions, 8 deletions
diff --git a/include/member.h b/include/member.h index 4a9a754..5043ead 100644 --- a/include/member.h +++ b/include/member.h @@ -18,6 +18,11 @@ struct _zend_class_entry; namespace Php { /** + * Forward declarations + */ +class MemberInfo; + +/** * Class definition */ class Member @@ -27,15 +32,90 @@ public: * Constructor * @param name Name of the member * @param pub Is this a public property (otherwise it is protected) + */ + Member(const char *name, bool pub); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) + * @param value The value to add + */ + Member(const char *name, bool pub, std::nullptr_t value); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) + * @param value The value to add + */ + Member(const char *name, bool pub, int value); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) + * @param value The value to add + */ + Member(const char *name, bool pub, long value); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) + * @param value The value to add + */ + Member(const char *name, bool pub, bool value); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) * @param value The value to add */ - Member(const char *name, bool pub, const Value &value) : - _name(name), _public(pub), _value(value) {} + Member(const char *name, bool pub, char value); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) + * @param value The value to add + */ + Member(const char *name, bool pub, const std::string &value); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) + * @param value The value to add + * @param size String length + */ + Member(const char *name, bool pub, const char *value, int size = -1); + + /** + * Constructor + * @param name Name of the member + * @param pub Is this a public property (otherwise it is protected) + * @param value The value to add + */ + Member(const char *name, bool pub, double value); + + /** + * Copy constructor + * @param member The member to copy + */ + Member(const Member &member); + + /** + * Move constructor + * @param member The member to move + */ + Member(Member &&member); /** * Destructor */ - virtual ~Member() {} + virtual ~Member(); /** * Internal method to declare the property @@ -58,10 +138,11 @@ private: bool _public; /** - * The default value - * @var Value + * The implementation for the member + * @var MemberInfo */ - Value _value; + MemberInfo *_info; + }; diff --git a/include/protected.h b/include/protected.h index e660f76..a1fdde5 100644 --- a/include/protected.h +++ b/include/protected.h @@ -23,7 +23,15 @@ public: * @param name Name of the property * @param value Default value of the property */ - Protected(const char *name, const Value &value) : Member(name, false, value) {} + Protected(const char *name) : Member(name, false) {} + Protected(const char *name, std::nullptr_t value) : Member(name, false, value) {} + Protected(const char *name, int value) : Member(name, false, value) {} + Protected(const char *name, long value) : Member(name, false, value) {} + Protected(const char *name, bool value) : Member(name, false, value) {} + Protected(const char *name, char value) : Member(name, false, value) {} + Protected(const char *name, const std::string &value) : Member(name, false, value) {} + Protected(const char *name, const char *value, int size=-1) : Member(name, false, value, size) {} + Protected(const char *name, double value) : Member(name, false, value) {} /** * Destructor diff --git a/include/public.h b/include/public.h index 17a5d0c..b37230b 100644 --- a/include/public.h +++ b/include/public.h @@ -23,7 +23,15 @@ public: * @param name Name of the property * @param value Default value of the property */ - Public(const char *name, const Value &value) : Member(name, true, value) {} + Public(const char *name) : Member(name, true) {} + Public(const char *name, std::nullptr_t value) : Member(name, true, value) {} + Public(const char *name, int value) : Member(name, true, value) {} + Public(const char *name, long value) : Member(name, true, value) {} + Public(const char *name, bool value) : Member(name, true, value) {} + Public(const char *name, char value) : Member(name, true, value) {} + Public(const char *name, const std::string &value) : Member(name, true, value) {} + Public(const char *name, const char *value, int size=-1) : Member(name, true, value, size) {} + Public(const char *name, double value) : Member(name, true, value) {} /** * Destructor |