summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-25 19:52:06 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-25 19:52:06 +0100
commit110f379c083a9e061d2337efabb86f12ce0fa750 (patch)
tree3c5e541532607246feeecd8d9dea3f36f803071f /include
parentb42532f1f49d9f404b100fe1a441de0c131673ee (diff)
added functions Php::constant() to retrieve the value of a constant, and Php::defined() to find out if a constant is defined
Diffstat (limited to 'include')
-rw-r--r--include/call.h6
-rw-r--r--include/constant.h2
-rw-r--r--include/value.h5
3 files changed, 12 insertions, 1 deletions
diff --git a/include/call.h b/include/call.h
index 279cbac..950cc3e 100644
--- a/include/call.h
+++ b/include/call.h
@@ -18,6 +18,12 @@ namespace Php {
extern bool class_exists(const char *classname, size_t size, bool autoload = true);
inline bool class_exists(const char *classname, bool autoload = true) { return class_exists(classname, strlen(classname), autoload); }
inline bool class_exists(const std::string &classname, bool autoload = true) { return class_exists(classname.c_str(), classname.size(), autoload); }
+extern Value constant(const char *constant);
+extern Value constant(const char *constant, size_t size);
+extern Value constant(const std::string &constant);
+extern bool defined(const char *constant);
+extern bool defined(const char *constant, size_t size);
+extern bool defined(const std::string &constant);
extern Value eval(const std::string &phpCode);
extern Value include(const std::string &filename);
extern Value include_once(const std::string &filename);
diff --git a/include/constant.h b/include/constant.h
index 36b3417..5e18792 100644
--- a/include/constant.h
+++ b/include/constant.h
@@ -66,7 +66,7 @@ public:
* @param clss Class to which the constant is added
* @internal
*/
- void addTo(ClassBase &clss);
+ void addTo(ClassBase &clss) const;
private:
/**
diff --git a/include/value.h b/include/value.h
index a450755..dbd3788 100644
--- a/include/value.h
+++ b/include/value.h
@@ -1158,6 +1158,11 @@ protected:
struct _zend_class_entry *classEntry(bool allowString = true) const;
/**
+ * Functions that need access to the privates
+ */
+ friend Value constant(const char *name, size_t size);
+
+ /**
* The Globals and Member classes can access the zval directly
*/
friend class Globals;