diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-05 10:17:26 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-05 10:17:26 +0100 |
commit | ed200cc18fb5fea88b8e9e2ff730af6cf1d50663 (patch) | |
tree | af2db9588d957d8cbdcb50cd7ce2d448eb4ef3a9 /src | |
parent | 29ea3a29642f5cec612f102683e6d43aba226148 (diff) |
fixed some compiler warnings in value.cpp, added documentation on how to install PHP-CPP, removed the Makefile from the src directory and moved everything into the single Makefile in the library root directory, also updated the main (and now only) Makefile with instructions so that it is easier for others to understand
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 23 | ||||
-rw-r--r-- | src/value.cpp | 21 |
2 files changed, 14 insertions, 30 deletions
diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 64b4eb1..0000000 --- a/src/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -CPP = g++ -RM = rm -f -PHP_DIR = /usr/include/php5 -CPP_FLAGS = -c -I. -I${PHP_DIR} -I${PHP_DIR}/main -I${PHP_DIR}/ext -I${PHP_DIR}/Zend -I${PHP_DIR}/TSRM -g -std=c++11 - -LD = g++ -LD_FLAGS = -Wall -shared -O2 -RESULT = libphpcpp.so - -SOURCES = $(wildcard *.cpp) -OBJECTS = $(SOURCES:%.cpp=%.o) - -all: ${OBJECTS} ${RESULT} - -${RESULT}: ${OBJECTS} - ${LD} ${LD_FLAGS} -o $@ ${OBJECTS} - -clean: - ${RM} *.obj *~* ${OBJECTS} ${RESULT} - -${OBJECTS}: - ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} - diff --git a/src/value.cpp b/src/value.cpp index b43d72f..1bec146 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -329,6 +329,9 @@ Value &Value::operator=(Value &&value) // the other object is no longer valid value._val = nullptr; } + + // done + return *this; } /** @@ -1201,13 +1204,17 @@ Value &Value::setType(Type type) // run the conversion switch (type) { - case Type::Null: convert_to_null(_val); break; - case Type::Numeric: convert_to_long(_val); break; - case Type::Float: convert_to_double(_val); break; - case Type::Bool: convert_to_boolean(_val); break; - case Type::Array: convert_to_array(_val); break; - case Type::Object: convert_to_object(_val); break; - case Type::String: convert_to_string(_val); break; + case Type::Null: convert_to_null(_val); break; + case Type::Numeric: convert_to_long(_val); break; + case Type::Float: convert_to_double(_val); break; + case Type::Bool: convert_to_boolean(_val); break; + case Type::Array: convert_to_array(_val); break; + case Type::Object: convert_to_object(_val); break; + case Type::String: convert_to_string(_val); break; + case Type::Resource: throw Php::Exception("Resource types can not be handled by the PHP-CPP library"); break; + case Type::Constant: throw Php::Exception("Constant types can not be assigned to a PHP-CPP library variable"); break; + case Type::ConstantArray: throw Php::Exception("Constant types can not be assigned to a PHP-CPP library variable"); break; + case Type::Callable: throw Php::Exception("Callable types can not be assigned to a PHP-CPP library variable"); break; } // done |