mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-06 00:42:48 +02:00
Text verticalAlignment, send entity property enums as uint8_t, fix text recalculating too often, fix textSize
625 lines
50 KiB
CMake
625 lines
50 KiB
CMake
#
|
|
# GenerateEntityProperites.cmake
|
|
#
|
|
# Created by HifiExperiments on 7/21/24
|
|
# Copyright 2024 Overte e.V.
|
|
#
|
|
# Distributed under the Apache License, Version 2.0.
|
|
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
#
|
|
|
|
macro(CAPITALIZE_FIRST_LETTER)
|
|
string(SUBSTRING ${ARGV0} 0 1 FIRST_LETTER)
|
|
string(TOUPPER ${FIRST_LETTER} FIRST_LETTER)
|
|
string(REGEX REPLACE "^.(.*)" "${FIRST_LETTER}\\1" CAPITALIZE_RESULT "${ARGV0}")
|
|
endmacro()
|
|
|
|
macro(GENERATE_ENTITY_PROPERTIES)
|
|
message(STATUS "Entity property processing start")
|
|
|
|
# Define most of our variables. Some are initialized only in the loops below.
|
|
set(ENTITY_ITEM_PROPERTY_DEFINES "")
|
|
set(ENTITY_ITEM_PROPERTY_INCLUDES "#include \"EntityItem.h\"\n")
|
|
set(ENTITY_ITEM_PROPERTY_FRIENDS "\tfriend class EntityItem;\n")
|
|
set(ENTITY_ITEM_PROPERTY_STATIC_GROUPS "")
|
|
set(ENTITY_ITEM_PROPERTY_DEBUG_DUMP_GROUPS "")
|
|
set(ENTITY_ITEM_PROPERTY_CHANGED_PROPERTIES "")
|
|
set(ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "")
|
|
set(ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "")
|
|
set(ENTITY_ITEM_PROPERTY_MERGE "")
|
|
set(ENTITY_ITEM_PROPERTY_ADD_TO_MAP "")
|
|
set(ENTITY_ITEM_PROPERTY_APPEND "")
|
|
set(ENTITY_ITEM_PROPERTY_READ "")
|
|
set(ENTITY_ITEM_PROPERTY_MARK_CHANGED "")
|
|
set(ENTITY_ITEM_PROPERTY_LIST_CHANGED "")
|
|
set(ENTITY_ITEM_PROPERTY_DEBUG "")
|
|
set(CURRENT_TYPE "Base")
|
|
list(APPEND ENTITY_TYPES ${CURRENT_TYPE})
|
|
set(ENTITY_PROPERTY_FLAGS "")
|
|
|
|
# These types are passed by value everywhere, anything else is passed by reference.
|
|
set(NON_REF_TYPES "bool" "int" "float" "uint8_t" "uint16_t" "quint16" "uint32_t" "quint32" "quint64")
|
|
# These property sections are shared by all types. "Common" must be at the end.
|
|
set(BASE_ENTITY_TYPES "Core" "Physics" "Cloning" "Scripts" "LocalProps" "Common")
|
|
# These types have special methods for converting to/from scripts.
|
|
set(TYPED_SCRIPT_CONVERT "u8vec3Color" "vec3Color" "qVectorVec3Color")
|
|
set(COMMON_PROPS false)
|
|
set(LOCAL_PROPS false)
|
|
set(NEEDS_CLOSING_BRACE false)
|
|
|
|
# All (non-group) properties are defined in EntityItemProperties.txt. We loop over them in order.
|
|
file(STRINGS src/EntityItemProperties.txt ENTITY_PROPERTIES_FILE)
|
|
while(ENTITY_PROPERTIES_FILE)
|
|
list(POP_FRONT ENTITY_PROPERTIES_FILE LINE)
|
|
|
|
# Single-word lines represent sections of properties, which can be base properties like "Physics" or
|
|
# Entity types like "Model". We use the section names to generate comments, and also handle indentation
|
|
# and opening/closing braces.
|
|
if(NOT LINE MATCHES ".*:.*")
|
|
if(LINE STREQUAL "Common")
|
|
set(COMMON_PROPS true)
|
|
else()
|
|
set(COMMON_PROPS false)
|
|
endif()
|
|
if(LINE STREQUAL "LocalProps")
|
|
set(LOCAL_PROPS true)
|
|
else()
|
|
set(LOCAL_PROPS false)
|
|
endif()
|
|
list(APPEND ENTITY_PROPERTY_FLAGS ${LINE})
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_DEFINES "${ENTITY_ITEM_PROPERTY_DEFINES}" "\t// ${LINE}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_CHANGED_PROPERTIES "${ENTITY_ITEM_PROPERTY_CHANGED_PROPERTIES}" "\t// ${LINE}\n")
|
|
if(NEEDS_CLOSING_BRACE)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\t}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\t}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\t}\n")
|
|
endif()
|
|
if(NOT COMMON_PROPS)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\t// ${LINE}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\t// ${LINE}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\t// ${LINE}\n")
|
|
endif()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\t// ${LINE}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_MERGE "${ENTITY_ITEM_PROPERTY_MERGE}" "\t// ${LINE}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_ADD_TO_MAP "${ENTITY_ITEM_PROPERTY_ADD_TO_MAP}" "\t\t// ${LINE}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_MARK_CHANGED "${ENTITY_ITEM_PROPERTY_MARK_CHANGED}" "\t// ${LINE}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_LIST_CHANGED "${ENTITY_ITEM_PROPERTY_LIST_CHANGED}" "\t// ${LINE}\n")
|
|
|
|
if(NOT ${LINE} IN_LIST BASE_ENTITY_TYPES)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_INCLUDES "${ENTITY_ITEM_PROPERTY_INCLUDES}" "#include \"${LINE}EntityItem.h\"\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_FRIENDS "${ENTITY_ITEM_PROPERTY_FRIENDS}" "\tfriend class ${LINE}EntityItem;\n")
|
|
if(LINE STREQUAL "Shape")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tif (_type == EntityTypes::Box) {\n\t\tCOPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, QString(\"Box\"));\n\t}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tif (_type == EntityTypes::Sphere) {\n\t\tCOPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_SHAPE_TYPE, shapeType, QString(\"Sphere\"));\n\t}\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tif (_type == EntityTypes::Box || _type == EntityTypes::Sphere || _type == EntityTypes::Shape) {\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\tif (properties.getType() == EntityTypes::Box || properties.getType() == EntityTypes::Sphere || properties.getType() == EntityTypes::Shape) {\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\tif (properties.getType() == EntityTypes::Box || properties.getType() == EntityTypes::Sphere || properties.getType() == EntityTypes::Shape) {\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tif (_type == EntityTypes::${LINE}) {\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\tif (properties.getType() == EntityTypes::${LINE}) {\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\tif (properties.getType() == EntityTypes::${LINE}) {\n")
|
|
endif()
|
|
set(NEEDS_CLOSING_BRACE true)
|
|
endif()
|
|
|
|
if (NEEDS_CLOSING_BRACE)
|
|
set(CURRENT_TYPE ${LINE})
|
|
list(APPEND ENTITY_TYPES ${LINE})
|
|
endif()
|
|
|
|
if (NOT COMMON_PROPS)
|
|
string(CONCAT ${CURRENT_TYPE}_REQUESTED_PROPS "${${CURRENT_TYPE}_REQUESTED_PROPS}" "\t// ${LINE}\n")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_APPEND "${${CURRENT_TYPE}_ENTITY_APPEND}" "\t\t// ${LINE}\n")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_READ "${${CURRENT_TYPE}_ENTITY_READ}" "\t// ${LINE}\n")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_COPY_TO "${${CURRENT_TYPE}_ENTITY_COPY_TO}" "\t// ${LINE}\n")
|
|
if (NOT LOCAL_PROPS)
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_SET_FROM "${${CURRENT_TYPE}_ENTITY_SET_FROM}" "\t// ${LINE}\n")
|
|
endif()
|
|
endif()
|
|
elseif(LINE MATCHES "group:.*,")
|
|
# Lines that start with "group:" represent property groups like "grab".
|
|
string(REGEX MATCH ".*group:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_GROUP ${LINE})
|
|
set(ENTITY_PROPERTY_GROUP ${CMAKE_MATCH_1})
|
|
CAPITALIZE_FIRST_LETTER(${ENTITY_PROPERTY_GROUP})
|
|
set(ENTITY_PROPERTY_GROUP_CAPS ${CAPITALIZE_RESULT})
|
|
# Most property groups have the same filenames, e.g. "pulse" to "PulsePropertyGroup", but some are different,
|
|
# e.g. "ring" is "RingGizmoPropertyGroup"
|
|
string(REGEX MATCH ".*type:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_GROUP_TYPE ${LINE})
|
|
if (CMAKE_MATCH_1)
|
|
set(ENTITY_PROPERTY_GROUP_TYPE "${CMAKE_MATCH_1}PropertyGroup")
|
|
else()
|
|
set(ENTITY_PROPERTY_GROUP_TYPE "${ENTITY_PROPERTY_GROUP_CAPS}PropertyGroup")
|
|
endif()
|
|
|
|
if(NOT LINE MATCHES ".*common( |,).*")
|
|
list(APPEND ENTITY_PROPERTY_FLAGS "group:${ENTITY_PROPERTY_GROUP}")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_DEFINES "${ENTITY_ITEM_PROPERTY_DEFINES}" "\tDEFINE_PROPERTY_GROUP(${ENTITY_PROPERTY_GROUP_CAPS}, ${ENTITY_PROPERTY_GROUP}, ${ENTITY_PROPERTY_GROUP_TYPE});\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_INCLUDES "${ENTITY_ITEM_PROPERTY_INCLUDES}" "#include \"${ENTITY_PROPERTY_GROUP_TYPE}.h\"\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_STATIC_GROUPS "${ENTITY_ITEM_PROPERTY_STATIC_GROUPS}" "${ENTITY_PROPERTY_GROUP_TYPE} EntityItemProperties::_static${ENTITY_PROPERTY_GROUP_CAPS};\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_DEBUG_DUMP_GROUPS "${ENTITY_ITEM_PROPERTY_DEBUG_DUMP_GROUPS}" "\tget${ENTITY_PROPERTY_GROUP_CAPS}().debugDump();\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_CHANGED_PROPERTIES "${ENTITY_ITEM_PROPERTY_CHANGED_PROPERTIES}" "\tchangedProperties += _${ENTITY_PROPERTY_GROUP}.getChangedProperties();\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\t_${ENTITY_PROPERTY_GROUP}.copyFromScriptValue(object, namesSet, _defaultSettings);\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_MERGE "${ENTITY_ITEM_PROPERTY_MERGE}" "\t_${ENTITY_PROPERTY_GROUP}.merge(other._${ENTITY_PROPERTY_GROUP});\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_ADD_TO_MAP "${ENTITY_ITEM_PROPERTY_ADD_TO_MAP}" "\t\t${ENTITY_PROPERTY_GROUP_TYPE}::addPropertyMap(_propertyInfos, _enumsToPropertyStrings);\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_MARK_CHANGED "${ENTITY_ITEM_PROPERTY_MARK_CHANGED}" "\t_${ENTITY_PROPERTY_GROUP}.markAllChanged();\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_LIST_CHANGED "${ENTITY_ITEM_PROPERTY_LIST_CHANGED}" "\tget${ENTITY_PROPERTY_GROUP_CAPS}().listChangedProperties(out);\n")
|
|
endif()
|
|
if(NEEDS_CLOSING_BRACE)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\t")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\t")
|
|
endif()
|
|
if(NOT COMMON_PROPS)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\t_${ENTITY_PROPERTY_GROUP}.copyToScriptValue(_desiredProperties, properties, engine, skipDefaults, defaultEntityProperties, returnNothingOnEmptyPropertyFlags, isMyOwnAvatarEntity);\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\t_static${ENTITY_PROPERTY_GROUP_CAPS}.setProperties(properties);\n")
|
|
if (NEEDS_CLOSING_BRACE)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t")
|
|
endif()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\t_static${ENTITY_PROPERTY_GROUP_CAPS}.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState);\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\tproperties.get${ENTITY_PROPERTY_GROUP_CAPS}().decodeFromEditPacket(propertyFlags, dataAt, processedBytes);\n")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_PROPS "${${CURRENT_TYPE}_ENTITY_PROPS}" "\t${ENTITY_PROPERTY_GROUP_TYPE} _${ENTITY_PROPERTY_GROUP}Properties;\n")
|
|
string(CONCAT ${CURRENT_TYPE}_REQUESTED_PROPS "${${CURRENT_TYPE}_REQUESTED_PROPS}" "\trequestedProperties += _${ENTITY_PROPERTY_GROUP}Properties.getEntityProperties(params);\n")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_APPEND "${${CURRENT_TYPE}_ENTITY_APPEND}" "\twithReadLock([&] {\n\t\t_${ENTITY_PROPERTY_GROUP}Properties.appendToEditPacket(packetData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState);\n\t});\n")
|
|
if (NOT LINE MATCHES ".*customVariableRead( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_READ "${${CURRENT_TYPE}_ENTITY_READ}" "\twithWriteLock([&] {\n\t\tint bytesFrom${ENTITY_PROPERTY_GROUP_CAPS} = _${ENTITY_PROPERTY_GROUP}Properties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, propertyFlags, overwriteLocalData, somethingChanged);\n\t\tbytesRead += bytesFrom${ENTITY_PROPERTY_GROUP_CAPS};\n\t\tdataAt += bytesFrom${ENTITY_PROPERTY_GROUP_CAPS};\n\t});\n")
|
|
endif()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_COPY_TO "${${CURRENT_TYPE}_ENTITY_COPY_TO}" "\twithReadLock([&] {\n\t\t_${ENTITY_PROPERTY_GROUP}Properties.getProperties(properties);\n\t});\n")
|
|
if (NOT LINE MATCHES ".*customVariableSetFrom( |,).*")
|
|
if (LINE MATCHES ".*recordChange( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_SET_FROM "${${CURRENT_TYPE}_ENTITY_SET_FROM}" "\twithWriteLock([&] {\n\t\t_${ENTITY_PROPERTY_GROUP}PropertiesChanged |= _${ENTITY_PROPERTY_GROUP}Properties.setProperties(properties);\n\t});\n")
|
|
elseif (LINE MATCHES ".*renderUpdateOnSet( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_SET_FROM "${${CURRENT_TYPE}_ENTITY_SET_FROM}" "\twithWriteLock([&] {\n\t\tbool ${ENTITY_PROPERTY_GROUP}PropertiesChanged = _${ENTITY_PROPERTY_GROUP}Properties.setProperties(properties);\n\t\tsomethingChanged |= ${ENTITY_PROPERTY_GROUP}PropertiesChanged;\n\t\t_needsRenderUpdate |= ${ENTITY_PROPERTY_GROUP}PropertiesChanged;\n\t});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_SET_FROM "${${CURRENT_TYPE}_ENTITY_SET_FROM}" "\twithWriteLock([&] {\n\t\tbool ${ENTITY_PROPERTY_GROUP}PropertiesChanged = _${ENTITY_PROPERTY_GROUP}Properties.setProperties(properties);\n\t\tsomethingChanged |= ${ENTITY_PROPERTY_GROUP}PropertiesChanged;\n\t});\n")
|
|
endif()
|
|
endif()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_DEBUG "${${CURRENT_TYPE}_ENTITY_DEBUG}" "\t_${ENTITY_PROPERTY_GROUP}Properties.debugDump();\n")
|
|
endif()
|
|
else()
|
|
# Everything else is just a normal, non-group property. Properties support a wide variety of settings,
|
|
# which control things like default/min/max, script conversions, and networking behavior.
|
|
string(REGEX MATCH ".*enum:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_ENUM ${LINE})
|
|
string(CONCAT ENTITY_PROPERTY_ENUM "PROP_" ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*prop:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_NAME ${LINE})
|
|
set(ENTITY_PROPERTY_NAME ${CMAKE_MATCH_1})
|
|
CAPITALIZE_FIRST_LETTER(${ENTITY_PROPERTY_NAME})
|
|
set(ENTITY_PROPERTY_NAME_CAPS ${CAPITALIZE_RESULT})
|
|
string(REGEX MATCH ".*type:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_TYPE ${LINE})
|
|
set(ENTITY_PROPERTY_TYPE ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*default:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_DEFAULT ${LINE})
|
|
set(ENTITY_PROPERTY_DEFAULT ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*min:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_MIN ${LINE})
|
|
set(ENTITY_PROPERTY_MIN ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*max:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_MAX ${LINE})
|
|
set(ENTITY_PROPERTY_MAX ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*fromScriptType:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_FROM_SCRIPT_TYPE ${LINE})
|
|
set(ENTITY_PROPERTY_FROM_SCRIPT_TYPE ${CMAKE_MATCH_1})
|
|
if (NOT ENTITY_PROPERTY_FROM_SCRIPT_TYPE)
|
|
set(ENTITY_PROPERTY_FROM_SCRIPT_TYPE ${ENTITY_PROPERTY_TYPE})
|
|
endif()
|
|
string(REGEX MATCH ".*getter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_GETTER ${LINE})
|
|
set(ENTITY_PROPERTY_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*setter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_SETTER ${LINE})
|
|
set(ENTITY_PROPERTY_SETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*networkGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_NETWORK_GETTER ${LINE})
|
|
set(ENTITY_PROPERTY_NETWORK_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableNetworkGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_VARIABLE_NETWORK_GETTER ${LINE})
|
|
set(ENTITY_VARIABLE_NETWORK_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableNetworkSetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_VARIABLE_NETWORK_SETTER ${LINE})
|
|
set(ENTITY_VARIABLE_NETWORK_SETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableCopyGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_VARIABLE_COPY_GETTER ${LINE})
|
|
set(ENTITY_VARIABLE_COPY_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableCopySetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_VARIABLE_COPY_SETTER ${LINE})
|
|
set(ENTITY_VARIABLE_COPY_SETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*readType:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_READ_TYPE ${LINE})
|
|
set(ENTITY_PROPERTY_READ_TYPE ${CMAKE_MATCH_1})
|
|
if (NOT ENTITY_PROPERTY_READ_TYPE)
|
|
set(ENTITY_PROPERTY_READ_TYPE ${ENTITY_PROPERTY_TYPE})
|
|
endif()
|
|
string(REGEX MATCH ".*debugString:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_DEBUG_STRING ${LINE})
|
|
set(ENTITY_PROPERTY_DEBUG_STRING ${CMAKE_MATCH_1})
|
|
if (NOT ENTITY_PROPERTY_DEBUG_STRING)
|
|
set(ENTITY_PROPERTY_DEBUG_STRING "\"\"")
|
|
endif()
|
|
string(REGEX MATCH ".*debugGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_DEBUG_GETTER ${LINE})
|
|
set(ENTITY_PROPERTY_DEBUG_GETTER ${CMAKE_MATCH_1})
|
|
|
|
if(NOT LINE MATCHES ".*legacy( |,).*")
|
|
if(NOT LINE MATCHES ".*common( |,).*")
|
|
list(APPEND ENTITY_PROPERTY_FLAGS ${ENTITY_PROPERTY_ENUM})
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY_REF")
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY_REF_ENUM")
|
|
elseif(${ENTITY_PROPERTY_TYPE} IN_LIST NON_REF_TYPES)
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY")
|
|
elseif(LINE MATCHES ".*propertySetter( |,).*")
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY_REF_WITH_SETTER")
|
|
endif()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_DEFINES "${ENTITY_ITEM_PROPERTY_DEFINES}" "\t${DEFINE_FUNC}(${ENTITY_PROPERTY_NAME_CAPS}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_TYPE}, ${ENTITY_PROPERTY_DEFAULT});\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_CHANGED_PROPERTIES "${ENTITY_ITEM_PROPERTY_CHANGED_PROPERTIES}" "\tCHECK_PROPERTY_CHANGE(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME});\n")
|
|
if(NOT LINE MATCHES ".*noScript( |,).*")
|
|
if(LINE MATCHES ".*readOnly( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tif (!honorReadOnly) {\n\t")
|
|
endif()
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tCOPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_NAME_CAPS});\n")
|
|
elseif(ENTITY_PROPERTY_GETTER AND ENTITY_PROPERTY_SETTER)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tCOPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_FROM_SCRIPT_TYPE}, ${ENTITY_PROPERTY_SETTER}, ${ENTITY_PROPERTY_GETTER});\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tCOPY_PROPERTY_FROM_QSCRIPTVALUE(${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_TYPE}, set${ENTITY_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
if(LINE MATCHES ".*readOnly( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\t}\n")
|
|
endif()
|
|
endif()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_MERGE "${ENTITY_ITEM_PROPERTY_MERGE}" "\tCOPY_PROPERTY_IF_CHANGED(${ENTITY_PROPERTY_NAME});\n")
|
|
if(DEFINED ENTITY_PROPERTY_MIN AND DEFINED ENTITY_PROPERTY_MAX)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_ADD_TO_MAP "${ENTITY_ITEM_PROPERTY_ADD_TO_MAP}" "\t\tADD_PROPERTY_TO_MAP_WITH_RANGE(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_MIN}, ${ENTITY_PROPERTY_MAX});\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_ADD_TO_MAP "${ENTITY_ITEM_PROPERTY_ADD_TO_MAP}" "\t\tADD_PROPERTY_TO_MAP(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_TYPE});\n")
|
|
endif()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_MARK_CHANGED "${ENTITY_ITEM_PROPERTY_MARK_CHANGED}" "\t_${ENTITY_PROPERTY_NAME}Changed = true;\n")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_LIST_CHANGED "${ENTITY_ITEM_PROPERTY_LIST_CHANGED}" "\tif (${ENTITY_PROPERTY_NAME}Changed()) {\n\t\tout += \"${ENTITY_PROPERTY_NAME}\";\n\t}\n")
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_DEBUG "${ENTITY_ITEM_PROPERTY_DEBUG}" "\tDEBUG_PROPERTY_IF_CHANGED(debug, properties, ${ENTITY_PROPERTY_NAME_CAPS}AsString, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_DEBUG_STRING});\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_DEBUG "${ENTITY_ITEM_PROPERTY_DEBUG}" "\tDEBUG_PROPERTY_IF_CHANGED(debug, properties, ${ENTITY_PROPERTY_NAME_CAPS}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_DEBUG_STRING});\n")
|
|
endif()
|
|
endif()
|
|
if(NOT LINE MATCHES ".*noScript( |,).*")
|
|
if(NEEDS_CLOSING_BRACE)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\t")
|
|
endif()
|
|
if(NOT COMMON_PROPS)
|
|
if(ENTITY_PROPERTY_GETTER)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tCOPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_GETTER}());\n")
|
|
elseif(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tCOPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME}, get${ENTITY_PROPERTY_NAME_CAPS}AsString());\n")
|
|
elseif(${ENTITY_PROPERTY_TYPE} IN_LIST TYPED_SCRIPT_CONVERT)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tCOPY_PROPERTY_TO_QSCRIPTVALUE_TYPED(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_TYPE});\n")
|
|
elseif(LINE MATCHES ".*urlPermission( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tCOPY_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME});\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tCOPY_PROPERTY_TO_QSCRIPTVALUE(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME});\n")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
if(NOT LINE MATCHES ".*noNetwork( |,).*")
|
|
if(NEEDS_CLOSING_BRACE)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\t")
|
|
endif()
|
|
if(NOT COMMON_PROPS)
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\tAPPEND_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, (uint8_t)properties.get${ENTITY_PROPERTY_NAME_CAPS}());\n")
|
|
elseif(ENTITY_PROPERTY_NETWORK_GETTER)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\tAPPEND_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NETWORK_GETTER});\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\tAPPEND_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, properties.get${ENTITY_PROPERTY_NAME_CAPS}());\n")
|
|
endif()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\tREAD_ENTITY_PROPERTY_TO_PROPERTIES(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_READ_TYPE}, set${ENTITY_PROPERTY_NAME_CAPS});\n")
|
|
string(CONCAT ${CURRENT_TYPE}_REQUESTED_PROPS "${${CURRENT_TYPE}_REQUESTED_PROPS}" "\trequestedProperties += ${ENTITY_PROPERTY_ENUM};\n")
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_APPEND "${${CURRENT_TYPE}_ENTITY_APPEND}" "\tAPPEND_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, (uint8_t)get${ENTITY_PROPERTY_NAME_CAPS}());\n")
|
|
elseif(ENTITY_VARIABLE_NETWORK_GETTER)
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_APPEND "${${CURRENT_TYPE}_ENTITY_APPEND}" "\tAPPEND_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, ${ENTITY_VARIABLE_NETWORK_GETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_APPEND "${${CURRENT_TYPE}_ENTITY_APPEND}" "\tAPPEND_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, get${ENTITY_PROPERTY_NAME_CAPS}());\n")
|
|
endif()
|
|
if(NOT LINE MATCHES ".*noVariableNetworkSetter( |,).*")
|
|
if(ENTITY_VARIABLE_NETWORK_SETTER)
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_READ "${${CURRENT_TYPE}_ENTITY_READ}" "\tREAD_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_TYPE}, ${ENTITY_VARIABLE_NETWORK_SETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_READ "${${CURRENT_TYPE}_ENTITY_READ}" "\tREAD_ENTITY_PROPERTY(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_TYPE}, set${ENTITY_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
if (NOT COMMON_PROPS)
|
|
set(VARIABLE_DEFINE_FUNC "DEFINE_VARIABLE_REF")
|
|
if(LINE MATCHES ".*noGetterSetterProp( |,).*")
|
|
set(VARIABLE_DEFINE_FUNC "DEFINE_VARIABLE_NO_GETTER_SETTER")
|
|
elseif(LINE MATCHES ".*enum( |,).*")
|
|
set(VARIABLE_DEFINE_FUNC "DEFINE_VARIABLE")
|
|
elseif(${ENTITY_PROPERTY_TYPE} IN_LIST NON_REF_TYPES)
|
|
set(VARIABLE_DEFINE_FUNC "DEFINE_VARIABLE")
|
|
endif()
|
|
if(LINE MATCHES ".*basicProp( |,).*")
|
|
string(REPLACE "DEFINE_VARIABLE" "DEFINE_VARIABLE_BASIC" VARIABLE_DEFINE_FUNC ${VARIABLE_DEFINE_FUNC})
|
|
elseif(LINE MATCHES ".*renderProp( |,).*")
|
|
string(REPLACE "DEFINE_VARIABLE" "DEFINE_VARIABLE_RENDER" VARIABLE_DEFINE_FUNC ${VARIABLE_DEFINE_FUNC})
|
|
endif()
|
|
if(NOT LINE MATCHES ".*inherited( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_PROPS "${${CURRENT_TYPE}_ENTITY_PROPS}" "\t${VARIABLE_DEFINE_FUNC}(${ENTITY_PROPERTY_NAME_CAPS}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_TYPE}, ${ENTITY_PROPERTY_DEFAULT});\n")
|
|
endif()
|
|
|
|
if(ENTITY_VARIABLE_COPY_GETTER)
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_COPY_TO "${${CURRENT_TYPE}_ENTITY_COPY_TO}" "\tCOPY_ENTITY_PROPERTY_TO_PROPERTIES(${ENTITY_PROPERTY_NAME}, ${ENTITY_VARIABLE_COPY_GETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_COPY_TO "${${CURRENT_TYPE}_ENTITY_COPY_TO}" "\tCOPY_ENTITY_PROPERTY_TO_PROPERTIES(${ENTITY_PROPERTY_NAME}, get${ENTITY_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
if (NOT LOCAL_PROPS)
|
|
if(ENTITY_VARIABLE_COPY_SETTER)
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_SET_FROM "${${CURRENT_TYPE}_ENTITY_SET_FROM}" "\tSET_ENTITY_PROPERTY_FROM_PROPERTIES(${ENTITY_PROPERTY_NAME}, ${ENTITY_VARIABLE_COPY_SETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_SET_FROM "${${CURRENT_TYPE}_ENTITY_SET_FROM}" "\tSET_ENTITY_PROPERTY_FROM_PROPERTIES(${ENTITY_PROPERTY_NAME}, set${ENTITY_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
endif()
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_DEBUG "${${CURRENT_TYPE}_ENTITY_DEBUG}" "\tqCDebug(entities) << \" ${ENTITY_PROPERTY_NAME}:\" << (int)get${ENTITY_PROPERTY_NAME_CAPS}();\n")
|
|
elseif(ENTITY_PROPERTY_DEBUG_GETTER)
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_DEBUG "${${CURRENT_TYPE}_ENTITY_DEBUG}" "\tqCDebug(entities) << \" ${ENTITY_PROPERTY_NAME}:\" << ${ENTITY_PROPERTY_DEBUG_GETTER};\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE}_ENTITY_DEBUG "${${CURRENT_TYPE}_ENTITY_DEBUG}" "\tqCDebug(entities) << \" ${ENTITY_PROPERTY_NAME}:\" << get${ENTITY_PROPERTY_NAME_CAPS}();\n")
|
|
endif()
|
|
endif()
|
|
else()
|
|
# We have some "legacy" properties, which are mostly aliases of existing properties with old names or different types.
|
|
# They only need to worry about script conversions.
|
|
if(NOT LINE MATCHES ".*noScript( |,).*")
|
|
string(REGEX MATCH ".*proxy:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_PROXY ${LINE})
|
|
set(ENTITY_PROPERTY_PROXY ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*proxyType:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" ENTITY_PROPERTY_PROXY_MAP_TYPE ${LINE})
|
|
set(ENTITY_PROPERTY_PROXY_MAP_TYPE ${CMAKE_MATCH_1})
|
|
if (NOT ENTITY_PROPERTY_PROXY_MAP_TYPE)
|
|
set(ENTITY_PROPERTY_PROXY_MAP_TYPE ${ENTITY_PROPERTY_TYPE})
|
|
endif()
|
|
|
|
if(NOT COMMON_PROPS)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\tCOPY_PROXY_PROPERTY_TO_QSCRIPTVALUE_GETTER(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_PROXY}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_GETTER}); // legacy support\n")
|
|
endif()
|
|
if(LINE MATCHES ".*readOnly( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tif (!honorReadOnly) {\n\t")
|
|
endif()
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tCOPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_TYPE}); // legacy support\n")
|
|
elseif(ENTITY_PROPERTY_GETTER AND ENTITY_PROPERTY_SETTER)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tCOPY_PROPERTY_FROM_QSCRIPTVALUE_GETTER(${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_FROM_SCRIPT_TYPE}, ${ENTITY_PROPERTY_SETTER}, ${ENTITY_PROPERTY_GETTER}); // legacy support\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\tCOPY_PROPERTY_FROM_QSCRIPTVALUE(${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_TYPE}, set${ENTITY_PROPERTY_NAME_CAPS}); // legacy support\n")
|
|
endif()
|
|
if(LINE MATCHES ".*readOnly( |,).*")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_FROM_SCRIPT}" "\t}\n")
|
|
endif()
|
|
endif()
|
|
if(DEFINED ENTITY_PROPERTY_MIN AND DEFINED ENTITY_PROPERTY_MAX)
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_ADD_TO_MAP "${ENTITY_ITEM_PROPERTY_ADD_TO_MAP}" "\t\tADD_PROPERTY_TO_MAP_WITH_RANGE(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_PROXY_MAP_TYPE}, ${ENTITY_PROPERTY_MIN}, ${ENTITY_PROPERTY_MAX}); // legacy support\n")
|
|
else()
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_ADD_TO_MAP "${ENTITY_ITEM_PROPERTY_ADD_TO_MAP}" "\t\tADD_PROPERTY_TO_MAP(${ENTITY_PROPERTY_ENUM}, ${ENTITY_PROPERTY_NAME}, ${ENTITY_PROPERTY_PROXY_MAP_TYPE}); // legacy support\n")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
endwhile()
|
|
|
|
# Final closing parentheses
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT "${ENTITY_ITEM_PROPERTY_COPY_TO_SCRIPT}" "\t}")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_APPEND "${ENTITY_ITEM_PROPERTY_APPEND}" "\t\t\t}")
|
|
string(CONCAT ENTITY_ITEM_PROPERTY_READ "${ENTITY_ITEM_PROPERTY_READ}" "\t}")
|
|
|
|
# Generate the real code!
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/EntityItemProperties.cpp.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/EntityItemProperties.cpp)
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/EntityItemProperties.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/EntityItemProperties.h)
|
|
list(APPEND GENERATE_ENTITIES_LIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/src/EntityItemProperties.h ${CMAKE_CURRENT_BINARY_DIR}/src/EntityItemProperties.cpp)
|
|
|
|
foreach(TYPE IN LISTS ENTITY_TYPES)
|
|
if(TYPE STREQUAL "Base")
|
|
set(TYPE "")
|
|
endif()
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/${TYPE}EntityItem.cpp.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}EntityItem.cpp)
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/${TYPE}EntityItem.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}EntityItem.h)
|
|
list(APPEND GENERATE_ENTITIES_LIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}EntityItem.h ${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}EntityItem.cpp)
|
|
endforeach()
|
|
|
|
# Group Properties
|
|
set(GROUP_TYPES "")
|
|
|
|
# All group properties are defined in EntityItemGroupProperties.txt. We loop over them in order.
|
|
file(STRINGS src/EntityItemGroupProperties.txt GROUP_PROPERTIES_FILE)
|
|
while(GROUP_PROPERTIES_FILE)
|
|
list(POP_FRONT GROUP_PROPERTIES_FILE LINE)
|
|
|
|
# Lines that don't end in a comma represent the start of a new property group.
|
|
if(NOT LINE MATCHES ".*,")
|
|
string(REGEX MATCH ".*type:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+).*" GROUP_PROPERTY_TYPE ${LINE})
|
|
set(GROUP_PROPERTY_TYPE ${CMAKE_MATCH_1})
|
|
|
|
if (GROUP_PROPERTY_TYPE)
|
|
string(REGEX MATCH "([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+) type:.*" CURRENT_TYPE ${LINE})
|
|
set(CURRENT_TYPE ${CMAKE_MATCH_1})
|
|
CAPITALIZE_FIRST_LETTER(${CURRENT_TYPE})
|
|
set(CURRENT_TYPE_CAPS ${CAPITALIZE_RESULT})
|
|
|
|
list(APPEND GROUP_TYPES ${GROUP_PROPERTY_TYPE})
|
|
else()
|
|
set(CURRENT_TYPE ${LINE})
|
|
CAPITALIZE_FIRST_LETTER(${CURRENT_TYPE})
|
|
set(CURRENT_TYPE_CAPS ${CAPITALIZE_RESULT})
|
|
|
|
list(APPEND GROUP_TYPES ${CURRENT_TYPE_CAPS})
|
|
endif()
|
|
else()
|
|
# Everything else is just a normal group property. Group properties support almost all of the same
|
|
# settings as non-group properties.
|
|
string(REGEX MATCH ".*enum:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_ENUM ${LINE})
|
|
string(CONCAT GROUP_PROPERTY_ENUM "PROP_" ${CMAKE_MATCH_1})
|
|
list(APPEND ${CURRENT_TYPE}_PROPERTY_FLAGS ${GROUP_PROPERTY_ENUM})
|
|
string(REGEX MATCH ".*prop:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_NAME ${LINE})
|
|
set(GROUP_PROPERTY_NAME ${CMAKE_MATCH_1})
|
|
CAPITALIZE_FIRST_LETTER(${GROUP_PROPERTY_NAME})
|
|
set(GROUP_PROPERTY_NAME_CAPS ${CAPITALIZE_RESULT})
|
|
string(REGEX MATCH ".*type:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_TYPE ${LINE})
|
|
set(GROUP_PROPERTY_TYPE ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*default:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_DEFAULT ${LINE})
|
|
set(GROUP_PROPERTY_DEFAULT ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*min:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_MIN ${LINE})
|
|
set(GROUP_PROPERTY_MIN ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*max:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_MAX ${LINE})
|
|
set(GROUP_PROPERTY_MAX ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*getter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_GETTER ${LINE})
|
|
set(GROUP_PROPERTY_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*setter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_SETTER ${LINE})
|
|
set(GROUP_PROPERTY_SETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*networkGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_PROPERTY_NETWORK_GETTER ${LINE})
|
|
set(GROUP_PROPERTY_NETWORK_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableNetworkGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_VARIABLE_NETWORK_GETTER ${LINE})
|
|
set(GROUP_VARIABLE_NETWORK_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableNetworkSetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_VARIABLE_NETWORK_SETTER ${LINE})
|
|
set(GROUP_VARIABLE_NETWORK_SETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableCopyGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_VARIABLE_COPY_GETTER ${LINE})
|
|
set(GROUP_VARIABLE_COPY_GETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*variableCopySetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_VARIABLE_COPY_SETTER ${LINE})
|
|
set(GROUP_VARIABLE_COPY_SETTER ${CMAKE_MATCH_1})
|
|
string(REGEX MATCH ".*debugGetter:+([A-Z0-9a-z_<>::\/\.\"\(\)\+\-]+)( |,)" GROUP_VARIABLE_DEBUG_GETTER ${LINE})
|
|
set(GROUP_VARIABLE_DEBUG_GETTER ${CMAKE_MATCH_1})
|
|
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY_REF")
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY_REF_ENUM")
|
|
elseif(${GROUP_PROPERTY_TYPE} IN_LIST NON_REF_TYPES)
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY")
|
|
elseif(LINE MATCHES ".*propertySetter( |,).*")
|
|
set(DEFINE_FUNC "DEFINE_PROPERTY_REF_WITH_SETTER")
|
|
endif()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_PROPS "${${CURRENT_TYPE_CAPS}_GROUP_PROPS}" "\t${DEFINE_FUNC}(${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME}, ${GROUP_PROPERTY_TYPE}, ${GROUP_PROPERTY_DEFAULT});\n")
|
|
|
|
if(GROUP_PROPERTY_GETTER)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT}" "\tCOPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_GETTER(${GROUP_PROPERTY_ENUM}, ${CURRENT_TYPE_CAPS}, ${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME});\n")
|
|
elseif(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT}" "\tCOPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_GETTER(${GROUP_PROPERTY_ENUM}, ${CURRENT_TYPE_CAPS}, ${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME}, get${GROUP_PROPERTY_NAME_CAPS}AsString);\n")
|
|
elseif(${GROUP_PROPERTY_TYPE} IN_LIST TYPED_SCRIPT_CONVERT)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT}" "\tCOPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_TYPED(${GROUP_PROPERTY_ENUM}, ${CURRENT_TYPE_CAPS}, ${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME}, ${GROUP_PROPERTY_TYPE});\n")
|
|
elseif(LINE MATCHES ".*urlPermission( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT}" "\tCOPY_GROUP_PROPERTY_TO_QSCRIPTVALUE_IF_URL_PERMISSION(${GROUP_PROPERTY_ENUM}, ${CURRENT_TYPE_CAPS}, ${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_TO_SCRIPT}" "\tCOPY_GROUP_PROPERTY_TO_QSCRIPTVALUE(${GROUP_PROPERTY_ENUM}, ${CURRENT_TYPE_CAPS}, ${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME});\n")
|
|
endif()
|
|
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_FROM_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_FROM_SCRIPT}" "\tCOPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE_ENUM(${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME}, ${GROUP_PROPERTY_NAME_CAPS});\n")
|
|
elseif(GROUP_PROPERTY_GETTER AND GROUP_PROPERTY_SETTER)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_FROM_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_FROM_SCRIPT}" "\tCOPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE_GETTER(${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME}, ${GROUP_PROPERTY_TYPE}, ${GROUP_PROPERTY_SETTER}, ${GROUP_PROPERTY_GETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_FROM_SCRIPT "${${CURRENT_TYPE_CAPS}_GROUP_COPY_FROM_SCRIPT}" "\tCOPY_GROUP_PROPERTY_FROM_QSCRIPTVALUE(${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME}, ${GROUP_PROPERTY_TYPE}, set${GROUP_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_MERGE "${${CURRENT_TYPE_CAPS}_GROUP_MERGE}" "\tCOPY_PROPERTY_IF_CHANGED(${GROUP_PROPERTY_NAME});\n")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_LIST_CHANGED "${${CURRENT_TYPE_CAPS}_GROUP_LIST_CHANGED}" "\tif (${GROUP_PROPERTY_NAME}Changed()) {\n\t\tout += \"${GROUP_PROPERTY_NAME}\";\n\t}\n")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_REQUESTED_PROPS "${${CURRENT_TYPE_CAPS}_REQUESTED_PROPS}" "\trequestedProperties += ${GROUP_PROPERTY_ENUM};\n")
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_APPEND "${${CURRENT_TYPE_CAPS}_GROUP_APPEND}" "\tAPPEND_ENTITY_PROPERTY(${GROUP_PROPERTY_ENUM}, (uint8_t)get${GROUP_PROPERTY_NAME_CAPS}());\n")
|
|
elseif(GROUP_VARIABLE_NETWORK_GETTER)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_APPEND "${${CURRENT_TYPE_CAPS}_GROUP_APPEND}" "\tAPPEND_ENTITY_PROPERTY(${GROUP_PROPERTY_ENUM}, ${GROUP_VARIABLE_NETWORK_GETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_APPEND "${${CURRENT_TYPE_CAPS}_GROUP_APPEND}" "\tAPPEND_ENTITY_PROPERTY(${GROUP_PROPERTY_ENUM}, get${GROUP_PROPERTY_NAME_CAPS}());\n")
|
|
endif()
|
|
|
|
if(NOT LINE MATCHES ".*noVariableNetworkSetter( |,).*")
|
|
if(GROUP_VARIABLE_NETWORK_SETTER)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_READ "${${CURRENT_TYPE_CAPS}_GROUP_READ}" "\tREAD_ENTITY_PROPERTY(${GROUP_PROPERTY_ENUM}, ${GROUP_PROPERTY_TYPE}, ${GROUP_VARIABLE_NETWORK_SETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_READ "${${CURRENT_TYPE_CAPS}_GROUP_READ}" "\tREAD_ENTITY_PROPERTY(${GROUP_PROPERTY_ENUM}, ${GROUP_PROPERTY_TYPE}, set${GROUP_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
endif()
|
|
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_DECODE_CHANGED "${${CURRENT_TYPE_CAPS}_GROUP_DECODE_CHANGED}" "\tDECODE_GROUP_PROPERTY_HAS_CHANGED(${GROUP_PROPERTY_ENUM}, ${GROUP_PROPERTY_NAME_CAPS});\n")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_MARK_CHANGED "${${CURRENT_TYPE_CAPS}_GROUP_MARK_CHANGED}" "\t_${GROUP_PROPERTY_NAME}Changed = true;\n")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_CHANGED_PROPERTIES "${${CURRENT_TYPE_CAPS}_GROUP_CHANGED_PROPERTIES}" "\tCHECK_PROPERTY_CHANGE(${GROUP_PROPERTY_ENUM}, ${GROUP_PROPERTY_NAME});\n")
|
|
|
|
if(GROUP_VARIABLE_COPY_GETTER)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_TO "${${CURRENT_TYPE_CAPS}_GROUP_COPY_TO}" "\tCOPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(${CURRENT_TYPE_CAPS}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_VARIABLE_COPY_GETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_COPY_TO "${${CURRENT_TYPE_CAPS}_GROUP_COPY_TO}" "\tCOPY_ENTITY_GROUP_PROPERTY_TO_PROPERTIES(${CURRENT_TYPE_CAPS}, ${GROUP_PROPERTY_NAME_CAPS}, get${GROUP_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
if(GROUP_VARIABLE_COPY_SETTER)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_SET_FROM "${${CURRENT_TYPE_CAPS}_GROUP_SET_FROM}" "\tSET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(${CURRENT_TYPE_CAPS}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME}, ${GROUP_VARIABLE_COPY_SETTER});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_SET_FROM "${${CURRENT_TYPE_CAPS}_GROUP_SET_FROM}" "\tSET_ENTITY_GROUP_PROPERTY_FROM_PROPERTIES(${CURRENT_TYPE_CAPS}, ${GROUP_PROPERTY_NAME_CAPS}, ${GROUP_PROPERTY_NAME}, set${GROUP_PROPERTY_NAME_CAPS});\n")
|
|
endif()
|
|
|
|
if(DEFINED GROUP_PROPERTY_MIN AND DEFINED GROUP_PROPERTY_MAX)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_ADD_TO_MAP "${${CURRENT_TYPE_CAPS}_GROUP_ADD_TO_MAP}" "\tADD_GROUP_PROPERTY_TO_MAP_WITH_RANGE(${GROUP_PROPERTY_ENUM}, ${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME}, ${GROUP_PROPERTY_MIN}, ${GROUP_PROPERTY_MAX});\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_ADD_TO_MAP "${${CURRENT_TYPE_CAPS}_GROUP_ADD_TO_MAP}" "\tADD_GROUP_PROPERTY_TO_MAP(${GROUP_PROPERTY_ENUM}, ${CURRENT_TYPE}, ${GROUP_PROPERTY_NAME});\n")
|
|
endif()
|
|
|
|
if(LINE MATCHES ".*enum( |,).*")
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_DEBUG_DUMP "${${CURRENT_TYPE_CAPS}_GROUP_DEBUG_DUMP}" "\tqCDebug(entities) << \" ${CURRENT_TYPE}.${GROUP_PROPERTY_NAME}:\" << (int)get${GROUP_PROPERTY_NAME_CAPS}();\n")
|
|
elseif(GROUP_VARIABLE_DEBUG_GETTER)
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_DEBUG_DUMP "${${CURRENT_TYPE_CAPS}_GROUP_DEBUG_DUMP}" "\tqCDebug(entities) << \" ${CURRENT_TYPE}.${GROUP_PROPERTY_NAME}:\" << ${GROUP_VARIABLE_DEBUG_GETTER};\n")
|
|
else()
|
|
string(CONCAT ${CURRENT_TYPE_CAPS}_GROUP_DEBUG_DUMP "${${CURRENT_TYPE_CAPS}_GROUP_DEBUG_DUMP}" "\tqCDebug(entities) << \" ${CURRENT_TYPE}.${GROUP_PROPERTY_NAME}:\" << get${GROUP_PROPERTY_NAME_CAPS}();\n")
|
|
endif()
|
|
endif()
|
|
endwhile()
|
|
|
|
# Generate the real code!
|
|
foreach(TYPE IN LISTS GROUP_TYPES)
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/${TYPE}PropertyGroup.cpp.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}PropertyGroup.cpp)
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/${TYPE}PropertyGroup.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}PropertyGroup.h)
|
|
list(APPEND GENERATE_ENTITIES_LIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}PropertyGroup.h ${CMAKE_CURRENT_BINARY_DIR}/src/${TYPE}PropertyGroup.cpp)
|
|
endforeach()
|
|
|
|
# Lastly, now that we have a big list of all of our properties in order, we build our EntityPropertyList enum.
|
|
# Shared properties are defined first, and then subclass properties are defined using PROP_DERIVED_XXXX.
|
|
set(HAS_REACHED_COMMON_PROPS false)
|
|
set(DERIVED_PROP false)
|
|
set(DERIVED_PROP_INDEX 0)
|
|
foreach(FLAG_LINE IN LISTS ENTITY_PROPERTY_FLAGS)
|
|
string(REGEX MATCH "group:+([A-Za-z]+)" FLAG_GROUP ${FLAG_LINE})
|
|
set(FLAG_GROUP ${CMAKE_MATCH_1})
|
|
|
|
if (FLAG_LINE STREQUAL "Common")
|
|
set(HAS_REACHED_COMMON_PROPS true)
|
|
elseif(NOT FLAG_GROUP AND NOT FLAG_LINE MATCHES "PROP_.*" AND HAS_REACHED_COMMON_PROPS)
|
|
set(DERIVED_PROP true)
|
|
endif()
|
|
|
|
if (DERIVED_PROP)
|
|
if (FLAG_GROUP)
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_DERIVED "${ENTITY_PROPERTY_FLAGS_DERIVED}" "\t// ${FLAG_GROUP}\n")
|
|
foreach(GROUP_FLAG IN LISTS ${FLAG_GROUP}_PROPERTY_FLAGS)
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_DERIVED "${ENTITY_PROPERTY_FLAGS_DERIVED}" "\t${GROUP_FLAG} = PROP_DERIVED_${DERIVED_PROP_INDEX},\n")
|
|
MATH(EXPR DERIVED_PROP_INDEX "${DERIVED_PROP_INDEX}+1")
|
|
endforeach()
|
|
elseif(FLAG_LINE MATCHES "PROP_.*")
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_DERIVED "${ENTITY_PROPERTY_FLAGS_DERIVED}" "\t${FLAG_LINE} = PROP_DERIVED_${DERIVED_PROP_INDEX},\n")
|
|
MATH(EXPR DERIVED_PROP_INDEX "${DERIVED_PROP_INDEX}+1")
|
|
else()
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_DERIVED "${ENTITY_PROPERTY_FLAGS_DERIVED}" "\t// ${FLAG_LINE}\n")
|
|
set(DERIVED_PROP_INDEX 0)
|
|
endif()
|
|
else()
|
|
if (FLAG_GROUP)
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_COMMON "${ENTITY_PROPERTY_FLAGS_COMMON}" "\t// ${FLAG_GROUP}\n")
|
|
foreach(GROUP_FLAG IN LISTS ${FLAG_GROUP}_PROPERTY_FLAGS)
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_COMMON "${ENTITY_PROPERTY_FLAGS_COMMON}" "\t${GROUP_FLAG},\n")
|
|
endforeach()
|
|
elseif(FLAG_LINE MATCHES "PROP_.*")
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_COMMON "${ENTITY_PROPERTY_FLAGS_COMMON}" "\t${FLAG_LINE},\n")
|
|
else()
|
|
string(CONCAT ENTITY_PROPERTY_FLAGS_COMMON "${ENTITY_PROPERTY_FLAGS_COMMON}" "\t// ${FLAG_LINE}\n")
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
|
|
# Generate the real code!
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/EntityPropertyFlags.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/EntityPropertyFlags.h)
|
|
list(APPEND GENERATE_ENTITIES_LIB_SRC ${CMAKE_CURRENT_BINARY_DIR}/src/EntityPropertyFlags.h)
|
|
|
|
message(STATUS "Entity property processing end")
|
|
endmacro()
|