diff --git a/HISTORY.md b/HISTORY.md index ad2a69d..715e725 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,23 @@ +---------------------------- +Date: 02/08/2023 +Version: 2.3.3 + +- [x] deserialize_exception : Save line and description + +---------------------------- +Date: 02/08/2023 +Version: 2.3.2 + +- [x] Change ArrayJsonVarNumber to ArrayNumberJsonVar + +---------------------------- +Date: 6/07/2023 +Version: 2.3.1 + +- [x] Fix include directory for linux + ---------------------------- Date: 8/06/2023 Version: 2.3.0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 798245f..83cedca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -132,7 +132,7 @@ else() message("-- Memmanager: -fsanitize NOT supported") endif() else() - message("-- Memmanager: OFF ($ENV{EIPM_DEVELOP_LIBS_CPP}/memmgr not exist)") + message("-- Memmanager: OFF (${PROJECT_SOURCE_DIR}/../../memmgr not exist)") endif() endif() diff --git a/src/deserialize_exception.h b/src/deserialize_exception.h index 19d0222..90a8bc7 100644 --- a/src/deserialize_exception.h +++ b/src/deserialize_exception.h @@ -8,20 +8,23 @@ namespace zetjsoncpp { class deserialize_exception: public std::exception { - std::string error_description; - + std::string description; + int line; + std::string file; char what_msg[4096]; public: - deserialize_exception(const char * _file, int _line, const std::string & _error_description){ + deserialize_exception(const char * _file, int _line, const std::string & _description){ memset(what_msg,0,sizeof(what_msg)); - error_description=_error_description; + description=_description; + line = _line; if(_file != NULL && *_file != 0){ - sprintf(what_msg,"[file:%s line:%i] %s",_file, _line, (char *)error_description.c_str()); + file=_file; + sprintf(what_msg,"[file:%s line:%i] %s",_file, _line, (char *)description.c_str()); }else{ - sprintf(what_msg,"[line:%i] %s",_line,(char *)error_description.c_str()); + sprintf(what_msg,"[line:%i] %s",_line,(char *)description.c_str()); } } @@ -29,6 +32,14 @@ namespace zetjsoncpp { { return (const char *)what_msg; } + + int getLine(){ + return line; + } + + const std::string & getDescription(){ + return description; + } }; } diff --git a/src/jsonvar/ArrayNumberJsonVar.h b/src/jsonvar/ArrayNumberJsonVar.h index 759d72f..7b3c7db 100644 --- a/src/jsonvar/ArrayNumberJsonVar.h +++ b/src/jsonvar/ArrayNumberJsonVar.h @@ -2,21 +2,21 @@ namespace zetjsoncpp{ // ARRAY FLOAT template - class ArrayJsonVarNumber : public NamedJsonVar<_T_NAME...>, public ArrayJsonVar> { + class ArrayNumberJsonVar : public NamedJsonVar<_T_NAME...>, public ArrayJsonVar> { public: //_T_NAME name; - ArrayJsonVarNumber() { + ArrayNumberJsonVar() { init(); } - ArrayJsonVarNumber(const std::vector & _vec_numbers) { + ArrayNumberJsonVar(const std::vector & _vec_numbers) { init(); copy(_vec_numbers); } - ArrayJsonVarNumber<> & operator=(const std::vector & _vec_numbers){ + ArrayNumberJsonVar<> & operator=(const std::vector & _vec_numbers){ copy(_vec_numbers); return *this; } @@ -50,7 +50,7 @@ namespace zetjsoncpp{ return shortBuf; } - virtual ~ArrayJsonVarNumber() { + virtual ~ArrayNumberJsonVar() { } private: @@ -63,7 +63,7 @@ namespace zetjsoncpp{ void init(){ this->__zj_type__ = JsonVarType::JSON_VAR_TYPE_VECTOR_OF_NUMBERS; - this->__zj_size_data__ = sizeof(ArrayJsonVarNumber<_T_NAME...>); + this->__zj_size_data__ = sizeof(ArrayNumberJsonVar<_T_NAME...>); } }; } diff --git a/src/jsonvar/JsonVar.cpp b/src/jsonvar/JsonVar.cpp index 207d465..a04d144 100644 --- a/src/jsonvar/JsonVar.cpp +++ b/src/jsonvar/JsonVar.cpp @@ -23,7 +23,7 @@ namespace zetjsoncpp { case JSON_VAR_TYPE_VECTOR_OF_BOOLEANS: return "ArrayBooleanJsonVar"; //case ARRAY_INT32_TYPE: return "ARRAY INT32 TYPE"; - case JSON_VAR_TYPE_VECTOR_OF_NUMBERS: return "ArrayJsonVarNumber"; + case JSON_VAR_TYPE_VECTOR_OF_NUMBERS: return "ArrayNumberJsonVar"; case JSON_VAR_TYPE_VECTOR_OF_STRINGS: return "ArrayStringJsonVar"; case JSON_VAR_TYPE_VECTOR_OF_OBJECTS: return "ArrayObjectJsonVar"; diff --git a/src/jsonvar/JsonVar.h b/src/jsonvar/JsonVar.h index 1b4d530..5cf0cb6 100644 --- a/src/jsonvar/JsonVar.h +++ b/src/jsonvar/JsonVar.h @@ -72,7 +72,7 @@ #define ZJ_CAST_JSON_VAR_NUMBER (zetjsoncpp::NumberJsonVar<> *) #define ZJ_CAST_JSON_VAR_OBJECT (zetjsoncpp::ObjectJsonVar<> *) #define ZJ_CAST_JSON_VAR_VECTOR_OF_BOOLEANS (zetjsoncpp::ArrayBooleanJsonVar<> *) -#define ZJ_CAST_JSON_VAR_VECTOR_OF_NUMBERS (zetjsoncpp::ArrayJsonVarNumber<> *) +#define ZJ_CAST_JSON_VAR_VECTOR_OF_NUMBERS (zetjsoncpp::ArrayNumberJsonVar<> *) #define ZJ_CAST_JSON_VAR_VECTOR_OF_STRINGS (zetjsoncpp::ArrayStringJsonVar<> *) #define ZJ_CAST_JSON_VAR_VECTOR_OF_OBJECTS (zetjsoncpp::ArrayObjectJsonVar<> *) #define ZJ_CAST_JSON_VAR_MAP_OF_BOOLEANS (zetjsoncpp::MapBooleanJsonVar<> *) @@ -86,7 +86,7 @@ #define ZJ_VAR_OBJECT(type,name) zetjsoncpp::ObjectJsonVar name #define ZJ_VAR_VECTOR_BOOLEAN(name) zetjsoncpp::ArrayBooleanJsonVar name -#define ZJ_VAR_VECTOR_NUMBER(name) zetjsoncpp::ArrayJsonVarNumber name +#define ZJ_VAR_VECTOR_NUMBER(name) zetjsoncpp::ArrayNumberJsonVar name #define ZJ_VAR_VECTOR_STRING(name) zetjsoncpp::ArrayStringJsonVar name #define ZJ_VAR_VECTOR_OBJECT(type,name) zetjsoncpp::ArrayObjectJsonVar name diff --git a/src/jsonvar/MapNumberJsonVar.h b/src/jsonvar/MapNumberJsonVar.h index 7647f90..7ea805d 100644 --- a/src/jsonvar/MapNumberJsonVar.h +++ b/src/jsonvar/MapNumberJsonVar.h @@ -15,7 +15,7 @@ namespace zetjsoncpp{ } - ArrayJsonVarNumber<> & operator=(const std::map & _map_numbers){ + ArrayNumberJsonVar<> & operator=(const std::map & _map_numbers){ copy(_map_numbers); return *this; } diff --git a/src/zetjsoncpp.h b/src/zetjsoncpp.h index b1ff628..bfe1338 100644 --- a/src/zetjsoncpp.h +++ b/src/zetjsoncpp.h @@ -27,7 +27,7 @@ #define ZETJSONCPP_VERSION_MAJOR 2 #define ZETJSONCPP_VERSION_MINOR 3 -#define ZETJSONCPP_VERSION_PATCH 0 +#define ZETJSONCPP_VERSION_PATCH 3 #ifdef __MEMMANAGER__ #include "memmgr.h" @@ -36,9 +36,9 @@ #define ZJ_UNUSUED_PARAM(x) ((void)(x)) #define ZJ_UNUSUED_2PARAMS(x1,x2) ((void)(x1),(void)(x2)) -#include "utils\file_utils.h" -#include "utils\path_utils.h" -#include "utils\string_utils.h" +#include "utils/file_utils.h" +#include "utils/path_utils.h" +#include "utils/string_utils.h" #include "deserialize_exception.h" #include "jsonvar/JsonVar.h" diff --git a/src/zetjsoncpp_serializer.cpp b/src/zetjsoncpp_serializer.cpp index ae409d6..3b36588 100644 --- a/src/zetjsoncpp_serializer.cpp +++ b/src/zetjsoncpp_serializer.cpp @@ -269,9 +269,9 @@ namespace zetjsoncpp{ ); break; case JSON_VAR_TYPE_VECTOR_OF_NUMBERS: - serialize_json_var_vector>( + serialize_json_var_vector>( _str_result - ,(ArrayJsonVarNumber<> *)_json_var + ,(ArrayNumberJsonVar<> *)_json_var ,_ident ,_minimized ,_discard_non_serialized diff --git a/test/test.cpp b/test/test.cpp index a709521..b6a8c39 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -72,7 +72,7 @@ int main(int argc, char *argv[]){ std::cout << std::endl << "3. Testing json vector primitives..."<< std::endl<< std::endl; - auto v1=zetjsoncpp::deserialize>("[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]"); + auto v1=zetjsoncpp::deserialize>("[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]"); std::cout <<"v1="<< zetjsoncpp::serialize(v1)<< std::endl; auto v2=zetjsoncpp::deserialize>("[\"string_1\",\"string_2\",\"string_3\",\"string_5\"]"); diff --git a/test/test_file.cpp b/test/test_file.cpp index 0ce35d6..e36a7fe 100644 --- a/test/test_file.cpp +++ b/test/test_file.cpp @@ -31,7 +31,7 @@ typedef struct{ channels; // Vector of numbers data - zetjsoncpp::ArrayJsonVarNumber + zetjsoncpp::ArrayNumberJsonVar data; }Interpolation; diff --git a/test/test_number.cpp b/test/test_number.cpp index 340d076..d4762f2 100644 --- a/test/test_number.cpp +++ b/test/test_number.cpp @@ -17,8 +17,8 @@ void test_json_var_number(){ ,{"id_3",2.5} }; - zetjsoncpp::ArrayJsonVarNumber<> jvn1=v1; - zetjsoncpp::ArrayJsonVarNumber<> jvn2=v2; + zetjsoncpp::ArrayNumberJsonVar<> jvn1=v1; + zetjsoncpp::ArrayNumberJsonVar<> jvn2=v2; zetjsoncpp::MapNumberJsonVar<> jmn1=m1; size_t len=v1.size();