diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f83f34b..147c860b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,10 +29,16 @@ link_directories(${PHP_LDFLAGS}) include_directories(include) include_directories(BEFORE ${PHP_INCLUDE_DIR} ${PHP_INCLUDE_DIR}/Zend ${PHP_INCLUDE_DIR}/main ${PHP_INCLUDE_DIR}/TSRM) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +IF (APPLE) + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") + message(${CMAKE_SHARED_LINKER_FLAGS}) +ENDIF () + #libary add_library(phpx SHARED ${DIR_SRCS}) #install INSTALL(CODE "MESSAGE(\"Are you run command using root user?\")") INSTALL(TARGETS phpx LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -INSTALL(FILES ${HEADER_FILES} DESTINATION include) \ No newline at end of file +INSTALL(FILES ${HEADER_FILES} DESTINATION include) diff --git a/include/phpx.h b/include/phpx.h index 662b246a..19f73061 100644 --- a/include/phpx.h +++ b/include/phpx.h @@ -332,6 +332,50 @@ class Variant } return static_cast(_ptr); } + bool operator ==(Variant &v) + { + return equals(v); + } + bool operator ==(bool v) + { + Variant _tmp(v); + return equals(_tmp); + } + bool operator ==(int v) + { + Variant _tmp(v); + return equals(_tmp); + } + bool operator ==(long v) + { + Variant _tmp(v); + return equals(_tmp); + } + bool operator ==(float v) + { + Variant _tmp(v); + return equals(_tmp); + } + bool operator ==(double v) + { + Variant _tmp(v); + return equals(_tmp); + } + bool operator ==(nullptr_t v) + { + Variant _tmp(v); + return equals(_tmp); + } + bool operator ==(string &v) + { + Variant _tmp(v); + return equals(_tmp); + } + bool operator ==(const char *v) + { + Variant _tmp(v); + return equals(_tmp); + } bool equals(Variant &v, bool strict = false) { if (strict) @@ -455,6 +499,10 @@ class String } return memcmp(str.c_str(), value->val, value->len) == 0; } + inline bool operator ==(String &v) + { + return equals(v); + } bool equals(String &str, bool ci = false) { if (str.length() != value->len) @@ -1387,11 +1435,11 @@ typedef void (*resource_dtor)(zend_resource *); typedef void (*method_t)(Object &, Args &, Variant &retval); struct strCmp -{ - bool operator()( const char * s1, const char * s2 ) const - { - return strcmp( s1, s2 ) < 0; - } +{ + bool operator()( const char * s1, const char * s2 ) const + { + return strcmp( s1, s2 ) < 0; + } }; extern map, strCmp> method_map;