4
1
mirror of https://github.com/QuasarApp/Heart.git synced 2025-05-06 14:39:41 +00:00

added new option for disable strong validation of the template type of DataPacks

This commit is contained in:
Andrei Yankovich 2023-04-24 21:58:58 +02:00
parent 01429a41c2
commit 64cdc993cb
3 changed files with 7 additions and 0 deletions

@ -35,6 +35,7 @@ endif()
option(HEART_STATIC_SSL "This option enable or disabled static link ssl libraryes" OFF) option(HEART_STATIC_SSL "This option enable or disabled static link ssl libraryes" OFF)
option(HEART_PRINT_PACKAGES "This option enable or disabled log of add incoming network packages" OFF) option(HEART_PRINT_PACKAGES "This option enable or disabled log of add incoming network packages" OFF)
option(HEART_PRINT_SQL_QUERIES "This option enable or disabled log of all sql queries" OFF) option(HEART_PRINT_SQL_QUERIES "This option enable or disabled log of all sql queries" OFF)
option(HEART_VALIDATE_PACKS "This option enable or disabled validation of child classes of the DataPack class" ON)
option(BUILD_SHARED_LIBS "Enable or disable shared libraryes" OFF) option(BUILD_SHARED_LIBS "Enable or disable shared libraryes" OFF)

@ -25,6 +25,10 @@ if (HEART_PRINT_PACKAGES)
add_definitions(-DHEART_PRINT_PACKAGES) add_definitions(-DHEART_PRINT_PACKAGES)
endif() endif()
if (HEART_VALIDATE_PACKS)
add_definitions(-DHEART_VALIDATE_PACKS)
endif()
set(SLL_DEFINE "WITHOUT_SSL") set(SLL_DEFINE "WITHOUT_SSL")
if (HEART_SSL) if (HEART_SSL)

@ -31,8 +31,10 @@ public:
DataPack(const QList<QSharedPointer<Package>> &newPackData = {}) { DataPack(const QList<QSharedPointer<Package>> &newPackData = {}) {
setPackData(newPackData); setPackData(newPackData);
#ifdef HEART_VALIDATE_PACKS
static_assert(std::is_base_of_v<UniversalData, Package> && static_assert(std::is_base_of_v<UniversalData, Package> &&
"The template class of DataPack must be child of the UniversalData class"); "The template class of DataPack must be child of the UniversalData class");
#endif
} }
/** /**