summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-14 15:02:40 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-14 15:02:40 +0100
commitab98c70a98e860f4cce0332d7164077cffa51b30 (patch)
tree44f429f0b0c920cb51724171ebd167b926cc8122 /include
parent6c64773dc5edd4b56eabcfa76b66b53ab76ecdf6 (diff)
Value::numericValue() now returns a int64_t, and no longer a long
Diffstat (limited to 'include')
-rw-r--r--include/callstatic.h64
-rw-r--r--include/value.h12
2 files changed, 9 insertions, 67 deletions
diff --git a/include/callstatic.h b/include/callstatic.h
deleted file mode 100644
index 3979ef3..0000000
--- a/include/callstatic.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * CallStatic.h
- *
- * Class that performs a lot of C++11 magic to find out if the __callStatic()
- * method was implemented by the user, and if it was, calls it
- *
- */
-
-namespace Php {
-
-/**
- * SFINAE test to check if the __callStatic method is defined
- *
- * This type trait checks if the __callStatic method is defined in class T
- *
- * @see http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence
- */
-template <typename T>
-class HasCallStatic
-{
- typedef char one;
- typedef long two;
-
- template <typename C> static one test( decltype(&C::__callStatic) ) ;
- template <typename C> static two test(...);
-
-public:
- static const bool value = sizeof(test<T>(0)) == sizeof(char);
-};
-
-/**
- * Function that only exists if the class T has a __callStatic method
- * @param name Name of the function
- * @param params Parameters passed to the function
- * @return Value
- */
-template<typename T>
-typename std::enable_if<HasCallStatic<T>::value, Value >::type
-callStatic(const char *name, Parameters &params)
-{
- // call the __callStatic() function
- return T::__callStatic(name, params);
-}
-
-/**
- * Function that only exists if the class T does not have a __callStatic method
- * @param name Name of the function
- * @param params Parameters passed to the function
- * @return Value
- */
-template<typename T>
-typename std::enable_if<!HasCallStatic<T>::value >::type
-callStatic(const char *name, Parameters &params)
-{
- std::cout << "has NO call static" << std::endl;
-
- return nullptr;
-}
-
-/**
- * End namespace
- */
-}
-
diff --git a/include/value.h b/include/value.h
index 9c48f1f..fce8750 100644
--- a/include/value.h
+++ b/include/value.h
@@ -381,9 +381,15 @@ public:
/**
* Retrieve the value as number
- * @return long
- */
- long numericValue() const;
+ *
+ * We force this to be a int64_t because we assume that most
+ * servers run 64 bits nowadays, and because we use int32_t, int64_t
+ * almost everywhere, instead of 'long' and on OSX neither of
+ * these intxx_t types is defined as 'long'...
+ *
+ * @return int64_t
+ */
+ int64_t numericValue() const;
/**
* Retrieve the value as boolean