diff --git a/CMakeHelpers/addBoost.cmake b/CMakeHelpers/addBoost.cmake index 616da4a..1d9085a 100644 --- a/CMakeHelpers/addBoost.cmake +++ b/CMakeHelpers/addBoost.cmake @@ -22,7 +22,7 @@ elseif(SX_BOOST_LIB_INCLUDE) else() message("SX_BOOST_LIB_INCLUDE is not set by user. Searching for boost libraries.") set(Boost_USE_MULTITHREADED ON) - find_package(Boost COMPONENTS date_time filesystem system program_options chrono thread random) + find_package(Boost COMPONENTS date_time filesystem system program_options chrono thread random unit_test_framework) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) message("Boost found.") diff --git a/CMakeHelpers/addSeadexOptions.cmake b/CMakeHelpers/addSeadexOptions.cmake new file mode 100644 index 0000000..48bd9c6 --- /dev/null +++ b/CMakeHelpers/addSeadexOptions.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +# Seadex preprocessor definitions + + +option("SX_NO_LOGGING" "Use when you want to use no logging at all (no logging code is created).") +if( "${SX_NO_LOGGING}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_LOGGING\"") + message(STATUS "No logging used.") +else() + message(STATUS "Logger is used.") +endif() + + +option("SX_NO_STD_MAKE_UNIQUE" "When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then.") +if( "${SX_NO_STD_MAKE_UNIQUE}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_STD_MAKE_UNIQUE\"") + message(STATUS "SX_NO_STD_MAKE_UNIQUE is defined.") +endif() + + +option("SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG" "Sets to use a workaround for bug in GCC with expansion of template parameter pack that appears in a lambda-expression (bug reported for GCC 4.8.4)") +if( "${SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG}" ) + set(extra_flags "${extra_flags} -D \"SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG\"") + message(STATUS "SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG is defined.") +endif() \ No newline at end of file diff --git a/CMakeHelpers/addYasmineOptions.cmake b/CMakeHelpers/addYasmineOptions.cmake index 94749d0..2c1b7ea 100644 --- a/CMakeHelpers/addYasmineOptions.cmake +++ b/CMakeHelpers/addYasmineOptions.cmake @@ -5,6 +5,8 @@ if(POLICY CMP0054) endif() +include("${CMAKE_CURRENT_LIST_DIR}/addSeadexOptions.cmake") + # yasmine's preprocessor definitions @@ -18,21 +20,6 @@ else() endif() -option("SX_NO_LOGGING" "Use when you want to use no logging at all (no logging code is created).") -if( "${SX_NO_LOGGING}" ) - set(extra_flags "${extra_flags} -D \"SX_NO_LOGGING\"") - message(STATUS "No logging used.") -else() - message(STATUS "Logger is used.") -endif() - - -option("SX_NO_STD_MAKE_UNIQUE" "When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then.") -if( "${SX_NO_STD_MAKE_UNIQUE}" ) - set(extra_flags "${extra_flags} -D \"SX_NO_STD_MAKE_UNIQUE\"") - message(STATUS "SX_NO_STD_MAKE_UNIQUE is defined.") -endif() - option("Y_LEAN_AND_MEAN" "If you compile the library with Y_LEAN_AND_MEAN being defined or if you define the macro locally before including yasmine.hpp, all the state pseudostates and the asynchronous simple state (with the asynchronous behaviour) are excluded (i.e. those headers are not included). This can reduce compile time.") if( "${Y_LEAN_AND_MEAN}" ) set(extra_flags "${extra_flags} -D \"Y_LEAN_AND_MEAN\"") @@ -45,9 +32,3 @@ if( "${Y_PROFILER}" ) message(STATUS "Y_PROFILER is defined.") endif() -option("SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG" "Sets to use a workaround for bug in GCC with expansion of template parameter pack that appears in a lambda-expression (bug reported for GCC 4.8.4)") -if( "${SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG}" ) - set(extra_flags "${extra_flags} -D \"SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG\"") - message(STATUS "SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG is defined.") -endif() - diff --git a/CMakeLists.txt b/CMakeLists.txt index ff9ec7d..0a1326f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,10 @@ include(./CMakeHelpers/functions.cmake) include(./CMakeHelpers/functionsRapidJSON.cmake) include(./CMakeHelpers/functionsAddCompilerFlags.cmake) +add_subdirectory(externals) add_subdirectory(libyasmine) add_subdirectory(yasmine_model) -add_subdirectory(genesis) add_subdirectory(libygen) add_subdirectory(ygen) diff --git a/build/rapidjson.props b/build/rapidjson.props index c4a78aa..48f47ca 100644 --- a/build/rapidjson.props +++ b/build/rapidjson.props @@ -2,7 +2,7 @@ - ..\..\..\..\..\3rd party\rapidjson\Content\rapidjson-1.0.2\rapidjson + ..\..\..\..\3rd party\libs\rapidjson\Content\rapidjson-1.1.0\rapidjson diff --git a/build/use_boost.props b/build/use_boost.props index 7ad4ecc..986fba3 100644 --- a/build/use_boost.props +++ b/build/use_boost.props @@ -2,8 +2,8 @@ - ..\..\..\..\..\3rd party\boost\Content\boost_1_65_1 - ..\..\..\..\..\3rd party\boost\Content\boost_1_65_1\stage\$(PlatformToolsetVersion)\$(Platform)\lib + ..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib diff --git a/build/use_essentials.props b/build/use_essentials.props index b08106d..17209f9 100644 --- a/build/use_essentials.props +++ b/build/use_essentials.props @@ -6,12 +6,12 @@ None - ..\externals\essentials\include;%(AdditionalIncludeDirectories) + ..\externals\essentials\source\essentials\include;%(AdditionalIncludeDirectories) $(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) - %(AdditionalDependencies) + essentials.lib;%(AdditionalDependencies) diff --git a/build/use_essentials_examples.props b/build/use_essentials_examples.props index 2c2df7b..44d6785 100644 --- a/build/use_essentials_examples.props +++ b/build/use_essentials_examples.props @@ -6,12 +6,12 @@ None - ..\..\externals\essentials\include;%(AdditionalIncludeDirectories) + ..\..\externals\essentials\source\essentials\include;%(AdditionalIncludeDirectories) $(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) - %(AdditionalDependencies) + essentials.lib;%(AdditionalDependencies) diff --git a/build/use_genesis.props b/build/use_genesis.props index bc3a1f8..03d1b1e 100644 --- a/build/use_genesis.props +++ b/build/use_genesis.props @@ -5,7 +5,7 @@ - ..\genesis\include;%(AdditionalIncludeDirectories) + ..\externals\genesis\source\genesis\include;%(AdditionalIncludeDirectories) diff --git a/build/use_hermes.props b/build/use_hermes.props index 08a894d..3a40d3b 100644 --- a/build/use_hermes.props +++ b/build/use_hermes.props @@ -5,9 +5,12 @@ - ..\externals\hermes\include;%(AdditionalIncludeDirectories) + ..\externals\hermes\source\hermes\include;%(AdditionalIncludeDirectories) + + hermes.lib;%(AdditionalDependencies) + \ No newline at end of file diff --git a/build/use_hermes_examples.props b/build/use_hermes_examples.props index 13c24de..cc1cc24 100644 --- a/build/use_hermes_examples.props +++ b/build/use_hermes_examples.props @@ -8,8 +8,11 @@ - ..\..\externals\hermes\include;%(AdditionalIncludeDirectories) + ..\..\externals\hermes\source\hermes\include;%(AdditionalIncludeDirectories) + + hermes.lib;%(AdditionalDependencies) + \ No newline at end of file diff --git a/examples/classic_farmroad/CMakeLists.txt b/examples/classic_farmroad/CMakeLists.txt index d9aa330..97535db 100644 --- a/examples/classic_farmroad/CMakeLists.txt +++ b/examples/classic_farmroad/CMakeLists.txt @@ -6,7 +6,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./*.hpp" "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/essentials/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") +set(HEADER_FILES "./*.hpp") file(GLOB classic_farmroad_SRC "./*.cpp" ${HEADER_FILES}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +19,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(classic_farmroad ${classic_farmroad_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/examples/event_collector_example/CMakeLists.txt b/examples/event_collector_example/CMakeLists.txt index 7f7ca09..a7ed99b 100644 --- a/examples/event_collector_example/CMakeLists.txt +++ b/examples/event_collector_example/CMakeLists.txt @@ -6,8 +6,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./*.hpp" "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") -file(GLOB event_collector_example_SRC "./*.cpp" ${HEADER_FILES}) +file(GLOB event_collector_example_SRC "./*.cpp" "./*.hpp") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +18,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(event_collector_example ${event_collector_example_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/examples/event_collector_example/event_collector_example.vcxproj b/examples/event_collector_example/event_collector_example.vcxproj index 4b4a2ca..f89a2f1 100644 --- a/examples/event_collector_example/event_collector_example.vcxproj +++ b/examples/event_collector_example/event_collector_example.vcxproj @@ -742,6 +742,7 @@ true true true + MachineX64 diff --git a/examples/event_collector_example/events.hpp b/examples/event_collector_example/events.hpp index acc0414..02a3ab4 100644 --- a/examples/event_collector_example/events.hpp +++ b/examples/event_collector_example/events.hpp @@ -17,11 +17,11 @@ #if defined( SX_CPP03_BOOST ) || ( defined(_MSC_VER) && _MSC_VER <=1800 ) - #define EVENT_1 1 - #define EVENT_2 2 - #define EVENT_3 3 - #define EVENT_4 4 -#else + #define EVENT_1 1 + #define EVENT_2 2 + #define EVENT_3 3 + #define EVENT_4 4 +#else constexpr sxy::event_id EVENT_1 = 1; constexpr sxy::event_id EVENT_2 = 2; constexpr sxy::event_id EVENT_3 = 3; @@ -31,16 +31,16 @@ namespace examples { - + #if defined( SX_CPP03_BOOST ) || ( defined(_MSC_VER) && _MSC_VER <=1800 ) Y_EVENT_WITH_ID( E1, EVENT_1 ) Y_EVENT_WITH_ID( E2, EVENT_2 ) - Y_EVENT_WITH_ID( E3, EVENT_3 ) + Y_EVENT_WITH_ID( E3, EVENT_3 ) Y_EVENT_1PARAM_WITH_ID( E4, std::string, get_message, EVENT_4 ) #else Y_EVENT_CREATE( E1, EVENT_1 ) - Y_EVENT_CREATE( E2, EVENT_2 ) - Y_EVENT_CREATE( E3, EVENT_3 ) + Y_EVENT_CREATE( E2, EVENT_2 ) + Y_EVENT_CREATE( E3, EVENT_3 ) Y_EVENT_CREATE( E4, EVENT_4, std::string, get_message ) #endif diff --git a/examples/events_with_parameters/CMakeLists.txt b/examples/events_with_parameters/CMakeLists.txt index 1d6fe6c..3e53000 100644 --- a/examples/events_with_parameters/CMakeLists.txt +++ b/examples/events_with_parameters/CMakeLists.txt @@ -6,8 +6,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./*.hpp" "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") -file(GLOB events_with_parameters_SRC "./*.cpp" ${HEADER_FILES}) +file(GLOB events_with_parameters_SRC "./*.cpp" "./*.hpp") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +18,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(events_with_parameters ${events_with_parameters_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/examples/forty_two/CMakeLists.txt b/examples/forty_two/CMakeLists.txt index a6c10a2..2a32c2f 100644 --- a/examples/forty_two/CMakeLists.txt +++ b/examples/forty_two/CMakeLists.txt @@ -6,8 +6,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./*.hpp" "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") -file(GLOB forty_two_SRC "./*.cpp" ${HEADER_FILES}) +file(GLOB forty_two_SRC "./*.cpp" "./*.hpp") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +18,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(forty_two ${forty_two_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/examples/generator_example/CMakeLists.txt b/examples/generator_example/CMakeLists.txt index c2e9576..906fefe 100644 --- a/examples/generator_example/CMakeLists.txt +++ b/examples/generator_example/CMakeLists.txt @@ -6,8 +6,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./*.hpp" "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") -file(GLOB generator_example_SRC "./*.cpp" ${HEADER_FILES}) +file(GLOB generator_example_SRC "./*.cpp" "./*.hpp") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +18,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(generator_example ${generator_example_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/examples/hello_yasmine/CMakeLists.txt b/examples/hello_yasmine/CMakeLists.txt index c94626f..6fab311 100644 --- a/examples/hello_yasmine/CMakeLists.txt +++ b/examples/hello_yasmine/CMakeLists.txt @@ -6,8 +6,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") -file(GLOB hello_yasmine_SRC "./*.cpp" ${HEADER_FILES}) +file(GLOB hello_yasmine_SRC "./*.cpp") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +18,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(hello_yasmine ${hello_yasmine_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/examples/substatemachines_and_variables/CMakeLists.txt b/examples/substatemachines_and_variables/CMakeLists.txt index e52d2d3..d962c8d 100644 --- a/examples/substatemachines_and_variables/CMakeLists.txt +++ b/examples/substatemachines_and_variables/CMakeLists.txt @@ -6,8 +6,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./*.hpp" "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") -file(GLOB substatemachines_and_variables_SRC "./*.cpp" ${HEADER_FILES}) +file(GLOB substatemachines_and_variables_SRC "./*.cpp" "./*.hpp") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +18,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(substatemachines_and_variables ${substatemachines_and_variables_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/examples/substatemachines_and_variables/substatemachines_and_variables.vcxproj b/examples/substatemachines_and_variables/substatemachines_and_variables.vcxproj index e07a96c..c2b8e49 100644 --- a/examples/substatemachines_and_variables/substatemachines_and_variables.vcxproj +++ b/examples/substatemachines_and_variables/substatemachines_and_variables.vcxproj @@ -733,6 +733,7 @@ true true true + MachineX64 diff --git a/examples/unhandled_event_handler_example/CMakeLists.txt b/examples/unhandled_event_handler_example/CMakeLists.txt index d124ea0..eac07f6 100644 --- a/examples/unhandled_event_handler_example/CMakeLists.txt +++ b/examples/unhandled_event_handler_example/CMakeLists.txt @@ -6,7 +6,6 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(HEADER_FILES "./../../libyasmine/include/*.hpp" "./../../externals/essentials/include/essentials/*.hpp" "./../../externals/essentials/include/compatibility/*.hpp" "./../../externals/hermes/include/hermes/*.hpp") file(GLOB unhandled_event_handler_example_SRC "./*.cpp" ${HEADER_FILES}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -19,7 +18,9 @@ include(./../../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") add_executable(unhandled_event_handler_example ${unhandled_event_handler_example_SRC}) -include_directories("./../../libyasmine/include" "./../../externals/essentials/include" "./../../externals/hermes/include") +include_directories("./../../libyasmine/include") +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../externals/hermes/source/hermes/include") set(link_libraries_list "") diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt new file mode 100644 index 0000000..4860ffd --- /dev/null +++ b/externals/CMakeLists.txt @@ -0,0 +1,37 @@ +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (NOT TARGET libessentials) + message(STATUS "essentuals was not build before. It is build now.") + add_subdirectory(essentials) + endif() +else() + if (NOT TARGET essentials) + message(STATUS "essentuals was not build before. It is build now.") + add_subdirectory(essentials) + endif() +endif() + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (NOT TARGET libhermes) + message(STATUS "hermes was not build before. It is build now.") + add_subdirectory(hermes) + endif() +else() + if (NOT TARGET hermes) + message(STATUS "hermes was not build before. It is build now.") + add_subdirectory(hermes) + endif() +endif() + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (NOT TARGET libgenesis) + message(STATUS "genesis was not build before. It is build now.") + add_subdirectory(genesis) + endif() +else() + if (NOT TARGET genesis) + message(STATUS "genesis was not build before. It is build now.") + add_subdirectory(genesis) + endif() +endif() diff --git a/externals/essentials/CMakeLists.txt b/externals/essentials/CMakeLists.txt new file mode 100644 index 0000000..097f692 --- /dev/null +++ b/externals/essentials/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) + +project(essentials) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +add_subdirectory(source) diff --git a/externals/essentials/source/CMakeHelpers/addBoost.cmake b/externals/essentials/source/CMakeHelpers/addBoost.cmake new file mode 100644 index 0000000..d833dc1 --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/addBoost.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(Y_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${Y_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${Y_BOOST_LIB_INCLUDE}) + set(SX_BOOST_LIB_PATH ${Y_BOOST_LIB_PATH}) + set(SX_BOOST_LIB_INCLUDE ${Y_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("Y_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") +elseif(SX_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${SX_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${SX_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("SX_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + +else() + message("SX_BOOST_LIB_INCLUDE is not set by user. Searching for boost libraries.") + set(Boost_USE_MULTITHREADED ON) + find_package(Boost COMPONENTS date_time filesystem system program_options chrono thread random unit_test_framework) + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + message("Boost found.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + else() + message(STATUS "Boost libraries not found!") + endif() +endif() diff --git a/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake b/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake new file mode 100644 index 0000000..48bd9c6 --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +# Seadex preprocessor definitions + + +option("SX_NO_LOGGING" "Use when you want to use no logging at all (no logging code is created).") +if( "${SX_NO_LOGGING}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_LOGGING\"") + message(STATUS "No logging used.") +else() + message(STATUS "Logger is used.") +endif() + + +option("SX_NO_STD_MAKE_UNIQUE" "When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then.") +if( "${SX_NO_STD_MAKE_UNIQUE}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_STD_MAKE_UNIQUE\"") + message(STATUS "SX_NO_STD_MAKE_UNIQUE is defined.") +endif() + + +option("SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG" "Sets to use a workaround for bug in GCC with expansion of template parameter pack that appears in a lambda-expression (bug reported for GCC 4.8.4)") +if( "${SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG}" ) + set(extra_flags "${extra_flags} -D \"SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG\"") + message(STATUS "SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG is defined.") +endif() \ No newline at end of file diff --git a/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake b/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake new file mode 100644 index 0000000..b568fbb --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +add_compiler_flag("-Wall") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +#gcc/clang compiler flags + if(NOT "SX_PEDANTIC" STREQUAL "OFF") + add_compiler_flag("-pedantic") + endif() + + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_compiler_flag("-g") + endif() + + if("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++03") + add_compiler_flag("-D \"SX_CPP03_BOOST\"") + add_compiler_flag("-D \"SX_NO_VARIADIC_MACRO\"") + elseif("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++14") + else() + add_compiler_flag("-std=c++11") + add_compiler_flag("-D \"SX_NO_STD_MAKE_UNIQUE\"") + endif() + +# platform + if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) + add_compiler_flag("-m64") + message(STATUS "setting platform x64") + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") + add_compiler_flag("-m32") + message(STATUS "setting platform x86") + endif() +endif() + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Checks buffer security. + set(extra_flags "${extra_flags} /GS") + + #Sets output warning level. + set(extra_flags "${extra_flags} /W4") + + #Disable specific Warnings. + set(extra_flags "${extra_flags} /wd\"4127\" /wd\"4250\"") + + #Defines constants and macros. + set(extra_flags "${extra_flags} /D \"_CRT_SECURE_NO_WARNINGS\"") + + #Enables function-level linking. + set(extra_flags "${extra_flags} /Gy") + + #Specifies standard behaviour under /Ze. + set(extra_flags "${extra_flags} /Zc:wchar_t /Zc:inline") + + #Disable minimal rebuild. + set(extra_flags "${extra_flags} /Gm-") + + #Enables additional security features and warnings. + set(extra_flags "${extra_flags} /sdl") + + #Specifies floating-point behaviour. + set(extra_flags "${extra_flags} /fp:precise") + + #Multibyte character sets macro. + set(extra_flags "${extra_flags} /D \"_MBCS\"") + + #Enables you to provide internal compiler error (ICE) information directly to the Visual C++ team. + set(extra_flags "${extra_flags} /errorReport:prompt") + + #Treats warnings as errors. + if( "${MSVC_VERSION}" STRGREATER "1800" ) + set(extra_flags "${extra_flags} /WX") + #else( "${MSVC_VERSION}" STRLESS "1900" ) + else() + set(extra_flags "${extra_flags} /WX-") + endif() + + + #Generates intrinsic functions. + set(extra_flags "${extra_flags} /Oi") + + #Specifies the model of exception handling. + set(extra_flags "${extra_flags} /EHsc") + + #Creates an object file. + set(extra_flags "${extra_flags} /Fo") + + #Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. + #set(extra_flags "${extra_flags} /NXCOMPAT") + + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() + +endif() \ No newline at end of file diff --git a/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake b/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake new file mode 100644 index 0000000..7964d92 --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +include("${CMAKE_CURRENT_LIST_DIR}/addSeadexOptions.cmake") + +# yasmine's preprocessor definitions + + +set(Y_OPTIMIZE "SPEED" CACHE STRING "Sets the optimize type. Supported values: SPEED and SIZE. Default value is SPEED.") +if( "${Y_OPTIMIZE}" STREQUAL "SIZE" ) + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SIZE\"") + message(STATUS "Optimizing for size.") +else() + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SPEED\"") + message(STATUS "Optimizing for speed.") +endif() + + +option("Y_LEAN_AND_MEAN" "If you compile the library with Y_LEAN_AND_MEAN being defined or if you define the macro locally before including yasmine.hpp, all the state pseudostates and the asynchronous simple state (with the asynchronous behaviour) are excluded (i.e. those headers are not included). This can reduce compile time.") +if( "${Y_LEAN_AND_MEAN}" ) + set(extra_flags "${extra_flags} -D \"Y_LEAN_AND_MEAN\"") + message(STATUS "Y_LEAN_AND_MEAN is defined.") +endif() + +option("Y_PROFILER" "If Y_PROFILER is defined, the state machine will count the number of events that were processed. The user can query the counter by calling the 'get_number_of_processed_events' method.") +if( "${Y_PROFILER}" ) + set(extra_flags "${extra_flags} -D \"Y_PROFILER\"") + message(STATUS "Y_PROFILER is defined.") +endif() + diff --git a/externals/essentials/source/CMakeHelpers/functions.cmake b/externals/essentials/source/CMakeHelpers/functions.cmake new file mode 100644 index 0000000..3a76857 --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/functions.cmake @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +function(use_pthread varName) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(${varName} ${${varName}} pthread PARENT_SCOPE) + endif() +endfunction() + + +function(use_boost_libraries varName) + set(${varName} ${${varName}} ${Boost_LIBRARIES} PARENT_SCOPE) +endfunction() + + +function(add_library_for_linking varName libraryName) + set(${varName} ${${varName}} ${libraryName} PARENT_SCOPE) +endfunction() diff --git a/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake b/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake new file mode 100644 index 0000000..105747b --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +include(CheckCXXCompilerFlag) + + +function(add_compiler_flag varFlag) + string(FIND "${CMAKE_CXX_FLAGS}" "${varFlag}" flag_already_set) + if(flag_already_set EQUAL -1) + check_cxx_compiler_flag("${varFlag}" flag_supported) + if(flag_supported) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${varFlag}" PARENT_SCOPE) + endif() + unset(flag_supported CACHE) + endif() +endfunction() diff --git a/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake b/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake new file mode 100644 index 0000000..c638987 --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +function(use_rapid_JSON) +if(SX_RAPIDJSON) + message("SX_RAPIDJSON is set by user.") +else() + message("SX_RAPIDJSON is not set by user. Setting default value.") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + find_package(RapidJSON) + if(NOT ("${RAPIDJSON_INCLUDE_DIRS}" STREQUAL "")) + set(SX_RAPIDJSON ${RAPIDJSON_INCLUDE_DIRS}) + message(STATUS "Found rapidjson on: ${RAPIDJSON_INCLUDE_DIRS}") + else() + set(SX_RAPIDJSON /usr/include) + message(STATUS "Set default value for rapidjson") + endif() + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(SX_RAPIDJSON "C:\\Program Files") + endif() +endif() + +include_directories(${SX_RAPIDJSON}) + +message(STATUS "include rapidJSON from: ${SX_RAPIDJSON}") + +endfunction() diff --git a/externals/essentials/source/CMakeHelpers/setVariables.cmake b/externals/essentials/source/CMakeHelpers/setVariables.cmake new file mode 100644 index 0000000..a6f1454 --- /dev/null +++ b/externals/essentials/source/CMakeHelpers/setVariables.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +if(("${Y_STATIC}" STREQUAL "ON") OR ("${SX_STATIC}" STREQUAL "ON")) + set(LINK_TYPE "STATIC") +else() + set(LINK_TYPE "SHARED") +endif() diff --git a/externals/essentials/source/CMakeLists.txt b/externals/essentials/source/CMakeLists.txt new file mode 100644 index 0000000..daef5a2 --- /dev/null +++ b/externals/essentials/source/CMakeLists.txt @@ -0,0 +1,16 @@ + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +include(./CMakeHelpers/setVariables.cmake) + +include(./CMakeHelpers/addBoost.cmake) +include(./CMakeHelpers/functions.cmake) +include(./CMakeHelpers/functionsAddCompilerFlags.cmake) + +add_subdirectory(essentials) + +if(EXISTS essentials_unit_tests) +add_subdirectory(essentials_unit_tests) +endif() diff --git a/externals/essentials/source/build/c++03.props b/externals/essentials/source/build/c++03.props new file mode 100644 index 0000000..d76c9b5 --- /dev/null +++ b/externals/essentials/source/build/c++03.props @@ -0,0 +1,31 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + <_PropertySheetDisplayName>c++03 + + + + SX_NO_VARIADIC_MACRO;SX_CPP03_BOOST;BOOST_SP_USE_STD_ATOMIC;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + $(BOOST_PATH);%(AdditionalIncludeDirectories) + + + + $(BOOST_LIB_PATH);$(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/essentials/source/build/debug_info.props b/externals/essentials/source/build/debug_info.props new file mode 100644 index 0000000..5dc702b --- /dev/null +++ b/externals/essentials/source/build/debug_info.props @@ -0,0 +1,18 @@ + + + + + + + + + NotSet + true + + + EditAndContinue + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + + \ No newline at end of file diff --git a/externals/essentials/source/build/essentials.props b/externals/essentials/source/build/essentials.props new file mode 100644 index 0000000..8bdf813 --- /dev/null +++ b/externals/essentials/source/build/essentials.props @@ -0,0 +1,31 @@ + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Level4 + 4127;4250 + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + None + false + true + include;%(AdditionalIncludeDirectories) + /D "_STL_WARNING_LEVEL=3" %(AdditionalOptions) + + + + + + No + Default + + + false + + + + \ No newline at end of file diff --git a/externals/essentials/source/build/use_boost.props b/externals/essentials/source/build/use_boost.props new file mode 100644 index 0000000..85fdae4 --- /dev/null +++ b/externals/essentials/source/build/use_boost.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/essentials/source/build/use_boost_as_external.props b/externals/essentials/source/build/use_boost_as_external.props new file mode 100644 index 0000000..cdd4e52 --- /dev/null +++ b/externals/essentials/source/build/use_boost_as_external.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/essentials/source/build/use_boost_externals.props b/externals/essentials/source/build/use_boost_externals.props new file mode 100644 index 0000000..27f07b7 --- /dev/null +++ b/externals/essentials/source/build/use_boost_externals.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/essentials/source/build/use_essentials.props b/externals/essentials/source/build/use_essentials.props new file mode 100644 index 0000000..9f7bfc9 --- /dev/null +++ b/externals/essentials/source/build/use_essentials.props @@ -0,0 +1,32 @@ + + + + + ..\..\..\essentials\source\essentials\include + ..\..\..\essentials\source\essentials\include\compatibility + ..\..\..\essentials\source\$(Platform)\$(Configuration) + + + + + $(ESSENTIALS_INCLUDE_PATH);$(ESSENTIALS_COMPATIBILITY_PATH);%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);$(ESSENTIALS_LIB_PATH);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + + $(ESSENTIALS_INCLUDE_PATH) + + + $(ESSENTIALS_COMPATIBILITY_PATH) + + + $(ESSENTIALS_LIB_PATH) + + + \ No newline at end of file diff --git a/externals/essentials/source/build/use_essentials_base.props b/externals/essentials/source/build/use_essentials_base.props new file mode 100644 index 0000000..7f85a09 --- /dev/null +++ b/externals/essentials/source/build/use_essentials_base.props @@ -0,0 +1,28 @@ + + + + + ..\essentials\include + ..\$(Platform)\$(Configuration) + + + + + $(ESSENTIALS_INCLUDE_PATH);$(ESSENTIALS_COMPATIBILITY_PATH);%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);$(ESSENTIALS_LIB_PATH);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + + $(ESSENTIALS_INCLUDE_PATH) + + + $(ESSENTIALS_LIB_PATH) + + + \ No newline at end of file diff --git a/externals/essentials/source/changelog.txt b/externals/essentials/source/changelog.txt new file mode 100644 index 0000000..d1a6a27 --- /dev/null +++ b/externals/essentials/source/changelog.txt @@ -0,0 +1,38 @@ +# Change log +All notable changes to this project are documented in this file. + +##[1.3.2] - 2017-12-18 + +### Added +• SX_UNUSED_VARIABLE macro for suppressing warnings for unreferenced variable. +• backward compatibility for macros Y_NO_STD_MAKE_UNIQUE, Y_CPP03_BOOST, Y_UNIQUE_PTR, Y_MAKE_UNIQUE, Y_MAKE_SHARED, Y_UNUSED_PARAMETER + +### Changed +• CMake: use external CMakeHelpers files +• CMake: refactoring of build scripts + +### Fixed +• missing boost namespace in sxprintf + + +##[1.1.0] - 2017-09-20 + +### Added +• Support for Visual Studio 2017 builds +• conversion functions: to_lower and to_upper +• added uri class + + +##[1.0.1] - 2017-04-07 + +### Changed +• macro helpers improved to count up to 15 parameters +• essentials file structure refactoring. All source files are now located in the 'source' folder, the header files for compatibility +are located in the 'include/essentials/compatibility' folder and other header files are located in the 'include/essentials' folder. + + +##[1.0.0] - 2017-03-30 + +• The very first released version of essentials + + diff --git a/externals/essentials/source/essentials.sln b/externals/essentials/source/essentials.sln new file mode 100644 index 0000000..c96fe08 --- /dev/null +++ b/externals/essentials/source/essentials.sln @@ -0,0 +1,156 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2010 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials", "essentials\essentials.vcxproj", "{132F81F8-46DA-49D0-9071-D70BC087B38C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials_unit_tests", "essentials_unit_tests\essentials_unit_tests.vcxproj", "{6F4D72B1-E418-4859-8C19-D58659041948}" + ProjectSection(ProjectDependencies) = postProject + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build_tools", "build_tools", "{77439103-0A48-4243-8D07-3223DC5CF353}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMake", "CMake", "{86310DF6-AE4D-48C6-B302-80F5091FC09B}" + ProjectSection(SolutionItems) = preProject + ..\CMakeLists.txt = ..\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{1C08A7CC-21A3-42E1-AA39-7E03F88A73F3}" + ProjectSection(SolutionItems) = preProject + CMakeLists.txt = CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "essentials", "essentials", "{968024AC-A87C-40E9-B75A-B7AE9790C73F}" + ProjectSection(SolutionItems) = preProject + essentials\CMakeLists.txt = essentials\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMakeHelpers", "CMakeHelpers", "{35E7ED3A-7DF9-4E75-B289-99B3D0050992}" + ProjectSection(SolutionItems) = preProject + CMakeHelpers\addBoost.cmake = CMakeHelpers\addBoost.cmake + CMakeHelpers\addSeadexOptions.cmake = CMakeHelpers\addSeadexOptions.cmake + CMakeHelpers\addSpecificFlags.cmake = CMakeHelpers\addSpecificFlags.cmake + CMakeHelpers\addYasmineOptions.cmake = CMakeHelpers\addYasmineOptions.cmake + CMakeHelpers\functions.cmake = CMakeHelpers\functions.cmake + CMakeHelpers\functionsAddCompilerFlags.cmake = CMakeHelpers\functionsAddCompilerFlags.cmake + CMakeHelpers\functionsRapidJSON.cmake = CMakeHelpers\functionsRapidJSON.cmake + CMakeHelpers\setVariables.cmake = CMakeHelpers\setVariables.cmake + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "essentials_unit_tests", "essentials_unit_tests", "{63218938-B7EC-4913-9B3B-CEAE1F2A925B}" + ProjectSection(SolutionItems) = preProject + essentials_unit_tests\CMakeLists.txt = essentials_unit_tests\CMakeLists.txt + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - C++ 03|Win32 = Debug - C++ 03|Win32 + Debug - C++ 03|x64 = Debug - C++ 03|x64 + Debug - C++ 03|x86 = Debug - C++ 03|x86 + Debug - VS 2015|Win32 = Debug - VS 2015|Win32 + Debug - VS 2015|x64 = Debug - VS 2015|x64 + Debug - VS 2015|x86 = Debug - VS 2015|x86 + Debug - VS 2017|Win32 = Debug - VS 2017|Win32 + Debug - VS 2017|x64 = Debug - VS 2017|x64 + Debug - VS 2017|x86 = Debug - VS 2017|x86 + Release - C++ 03|Win32 = Release - C++ 03|Win32 + Release - C++ 03|x64 = Release - C++ 03|x64 + Release - C++ 03|x86 = Release - C++ 03|x86 + Release - VS 2015|Win32 = Release - VS 2015|Win32 + Release - VS 2015|x64 = Release - VS 2015|x64 + Release - VS 2015|x86 = Release - VS 2015|x86 + Release - VS 2017|Win32 = Release - VS 2017|Win32 + Release - VS 2017|x64 = Release - VS 2017|x64 + Release - VS 2017|x86 = Release - VS 2017|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.Build.2 = Debug - VS 2013|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {86310DF6-AE4D-48C6-B302-80F5091FC09B} = {77439103-0A48-4243-8D07-3223DC5CF353} + {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} = {86310DF6-AE4D-48C6-B302-80F5091FC09B} + {968024AC-A87C-40E9-B75A-B7AE9790C73F} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + {35E7ED3A-7DF9-4E75-B289-99B3D0050992} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + {63218938-B7EC-4913-9B3B-CEAE1F2A925B} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CB028EB1-46EF-44C3-B508-97BC3E09DC4D} + EndGlobalSection +EndGlobal diff --git a/externals/essentials/source/essentials/CMakeLists.txt b/externals/essentials/source/essentials/CMakeLists.txt new file mode 100644 index 0000000..edc08df --- /dev/null +++ b/externals/essentials/source/essentials/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 2.8) + +project(essentials) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +file(GLOB essentials_SRC "include/essentials/*.hpp" "include/essentials/compatibility/*.hpp" "source/*.cpp") + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +include(./../CMakeHelpers/addSpecificFlags.cmake) +include(./../CMakeHelpers/addSeadexOptions.cmake) + +include_directories("./include") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library(libessentials ${LINK_TYPE} ${essentials_SRC}) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library(essentials STATIC ${essentials_SRC}) +endif() + + +file(GLOB essentials_hpp "include/essentials/*.hpp" "include/essentials/compatibility/*.hpp") +install(FILES ${essentials_hpp} DESTINATION include/essentials/include) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + install(TARGETS libessentials DESTINATION lib) + set_target_properties(libessentials PROPERTIES PREFIX "") +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + install(TARGETS essentials DESTINATION lib) + set_target_properties(essentials PROPERTIES PREFIX "") +endif() diff --git a/externals/essentials/source/essentials/essentials.vcxproj b/externals/essentials/source/essentials/essentials.vcxproj new file mode 100644 index 0000000..63f7f7e --- /dev/null +++ b/externals/essentials/source/essentials/essentials.vcxproj @@ -0,0 +1,545 @@ + + + + + Debug - C++ 03 + Win32 + + + Debug - C++ 03 + x64 + + + Debug - Clang + Win32 + + + Debug - Clang + x64 + + + Debug - VS 2013 + Win32 + + + Debug - VS 2013 + x64 + + + Debug - VS 2015 + Win32 + + + Debug - VS 2015 + x64 + + + Debug - VS 2017 + Win32 + + + Release - C++ 03 + Win32 + + + Release - C++ 03 + x64 + + + Release - Clang + Win32 + + + Release - Clang + x64 + + + Release - VS 2015 + Win32 + + + Release - VS 2015 + x64 + + + Release - VS 2017 + Win32 + + + Debug - VS 2017 + x64 + + + Release - VS 2017 + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {132F81F8-46DA-49D0-9071-D70BC087B38C} + essentials + 8.1 + + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141_clang_c2 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + \ No newline at end of file diff --git a/externals/essentials/source/essentials/essentials.vcxproj.filters b/externals/essentials/source/essentials/essentials.vcxproj.filters new file mode 100644 index 0000000..e68031a --- /dev/null +++ b/externals/essentials/source/essentials/essentials.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {4a8b49fc-8912-43d5-a33a-962f5e097001} + + + {13a9f023-217a-4d7a-946f-8147bce1d21a} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + + + license + + + license + + + license + + + license + + + license + + + + + Header Files\compatibility + + + Header Files\compatibility + + + Header Files\compatibility + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\compatibility + + + \ No newline at end of file diff --git a/externals/essentials/include/essentials/base.hpp b/externals/essentials/source/essentials/include/essentials/base.hpp similarity index 97% rename from externals/essentials/include/essentials/base.hpp rename to externals/essentials/source/essentials/include/essentials/base.hpp index eab624d..9ea9eb7 100644 --- a/externals/essentials/include/essentials/base.hpp +++ b/externals/essentials/source/essentials/include/essentials/base.hpp @@ -1,41 +1,41 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A -#define BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A - - -//!\def SX_ASSERT( _condition, _message ) -//!\brief Assert a given condition. Adds the message to the assert for better diagnostics when the assert is triggered. -#define SX_ASSERT( _condition, _message ) \ - do \ - { \ - assert( ( _condition ) && _message ); \ - } \ - while( 0 ) - -//!\def SX_ASSERTED( _x ) -//!\brief Suppress warnings for variables that are only used within asserts. -#define SX_ASSERTED( _x ) static_cast< void >( _x ); - -//!\def SX_UNUSED_PARAMETER( _x ) -//!\brief Suppress warnings for unreferenced parameters. -#define SX_UNUSED_PARAMETER( _x ) static_cast( _x ) - - -//!\def SX_UNUSED_VARIABLE( _x ) -//!\brief Suppress warnings for unreferenced variable. -#define SX_UNUSED_VARIABLE( _x ) static_cast( _x ) - - -#include - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A +#define BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A + + +//!\def SX_ASSERT( _condition, _message ) +//!\brief Assert a given condition. Adds the message to the assert for better diagnostics when the assert is triggered. +#define SX_ASSERT( _condition, _message ) \ + do \ + { \ + assert( ( _condition ) && _message ); \ + } \ + while( 0 ) + +//!\def SX_ASSERTED( _x ) +//!\brief Suppress warnings for variables that are only used within asserts. +#define SX_ASSERTED( _x ) static_cast< void >( _x ); + +//!\def SX_UNUSED_PARAMETER( _x ) +//!\brief Suppress warnings for unreferenced parameters. +#define SX_UNUSED_PARAMETER( _x ) static_cast( _x ) + + +//!\def SX_UNUSED_VARIABLE( _x ) +//!\brief Suppress warnings for unreferenced variable. +#define SX_UNUSED_VARIABLE( _x ) static_cast( _x ) + + +#include + + +#endif diff --git a/externals/essentials/include/essentials/build_number.hpp b/externals/essentials/source/essentials/include/essentials/build_number.hpp similarity index 93% rename from externals/essentials/include/essentials/build_number.hpp rename to externals/essentials/source/essentials/include/essentials/build_number.hpp index 0e18bab..6771ace 100644 --- a/externals/essentials/include/essentials/build_number.hpp +++ b/externals/essentials/source/essentials/include/essentials/build_number.hpp @@ -1,35 +1,35 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 -#define BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 - - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - - -namespace version -{ - - - const sxe::uint16_t BUILD_NUMBER( 60 ); - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 +#define BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + +namespace version +{ + + + const sxe::uint16_t BUILD_NUMBER( 96 ); + + +} + + +} + + +#endif diff --git a/externals/essentials/include/essentials/compatibility/chrono.hpp b/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp similarity index 96% rename from externals/essentials/include/essentials/compatibility/chrono.hpp rename to externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp index b53e1fd..1946dc4 100644 --- a/externals/essentials/include/essentials/compatibility/chrono.hpp +++ b/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp @@ -1,59 +1,59 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 -#define CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 - - -#ifdef SX_CPP03_BOOST - -#include - -#else - -#include - -#endif - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST // C++03 compatibility - - using boost::chrono::time_point; - using boost::chrono::system_clock; - using boost::chrono::steady_clock; - using boost::chrono::seconds; - using boost::chrono::milliseconds; - using boost::chrono::duration_cast; - using boost::chrono::time_point; - - -#else // C++11 compatibility - - - using std::chrono::time_point; - using std::chrono::system_clock; - using std::chrono::steady_clock; - using std::chrono::milliseconds; - using std::chrono::seconds; - using std::chrono::duration_cast; - using std::chrono::time_point; - - -#endif - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 +#define CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 + + +#ifdef SX_CPP03_BOOST + +#include + +#else + +#include + +#endif + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + using boost::chrono::time_point; + using boost::chrono::system_clock; + using boost::chrono::steady_clock; + using boost::chrono::seconds; + using boost::chrono::milliseconds; + using boost::chrono::duration_cast; + using boost::chrono::time_point; + + +#else // C++11 compatibility + + + using std::chrono::time_point; + using std::chrono::system_clock; + using std::chrono::steady_clock; + using std::chrono::milliseconds; + using std::chrono::seconds; + using std::chrono::duration_cast; + using std::chrono::time_point; + + +#endif + + +} + + +#endif diff --git a/externals/essentials/include/essentials/compatibility/compatibility.hpp b/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp similarity index 95% rename from externals/essentials/include/essentials/compatibility/compatibility.hpp rename to externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp index 9116631..4d5e764 100644 --- a/externals/essentials/include/essentials/compatibility/compatibility.hpp +++ b/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp @@ -1,184 +1,184 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 -#define COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 - - -#include "essentials_backward_compatibility.hpp" - - -#ifdef SX_CPP03_BOOST -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4456 ) -#pragma warning( disable : 4996 ) -#endif - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - -#else -#include -#include -#include -#include -#include -#endif - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST // C++03 compatibility - - #define SX_OVERRIDE - #define SX_FINAL - #define SX_DELETE - #define SX_NULLPTR NULL - - #define SX_FOR(_variable, _container) BOOST_FOREACH( _variable, _container ) - - #define SX_CONSTEXPR const - - #define SX_NOEXCEPT throw() - - - using boost::shared_ptr; - #define SX_UNIQUE_PTR shared_ptr - - #define SX_MAKE_SHARED boost::make_shared - #define SX_MAKE_UNIQUE boost::make_shared - - template - _type& move(_type& _t) - { - return( _t ); - } - - using boost::int8_t; - using boost::int16_t; - using boost::int32_t; - using boost::int64_t; - using boost::uint8_t; - using boost::uint16_t; - using boost::uint32_t; - using boost::uint64_t; - - using boost::bind; - using boost::ref; - using boost::cref; - using boost::placeholders::_1; - using boost::placeholders::_2; - - using boost::function; - - using boost::remove_reference; - using boost::remove_const; - - using boost::random_device; - - -#else // C++11 compatibility - - #ifdef SX_NO_STD_MAKE_UNIQUE - - template< typename t, typename ... args > - std::unique_ptr< t > make_unique(args&& ... _args) - { - return( std::unique_ptr< t >(new t(std::forward< args >(_args)...)) ); - } - - #else - - using std::make_unique; - - #endif - - #define SX_OVERRIDE override - #define SX_FINAL final - #define SX_DELETE = delete - #define SX_NULLPTR nullptr - - #define SX_FOR(_variable, _container) for( _variable : _container ) - - #ifdef _MSC_VER - #if _MSC_VER <= 1800 - #define SX_CONSTEXPR const - #endif - #endif - - #ifndef SX_CONSTEXPR - #define SX_CONSTEXPR constexpr - #endif - -#ifdef _MSC_VER - #if _MSC_VER <= 1800 - #define SX_NOEXCEPT throw() - #else - #define SX_NOEXCEPT noexcept - #endif -#else - #define SX_NOEXCEPT noexcept -#endif - - using std::shared_ptr; - template - using SX_UNIQUE_PTR = std::unique_ptr<_pointee>; - - #define SX_MAKE_SHARED std::make_shared - #define SX_MAKE_UNIQUE sxe::make_unique - - using std::move; - - - using std::int8_t; - using std::int16_t; - using std::int32_t; - using std::int64_t; - using std::uint8_t; - using std::uint16_t; - using std::uint32_t; - using std::uint64_t; - - using std::bind; - using std::ref; - using std::cref; - using std::placeholders::_1; - using std::placeholders::_2; - - using std::function; - - using std::remove_reference; - using std::remove_const; - - using std::random_device; - - -#endif - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 +#define COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 + + +#include "essentials_backward_compatibility.hpp" + + +#ifdef SX_CPP03_BOOST +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4456 ) +#pragma warning( disable : 4996 ) +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + +#else +#include +#include +#include +#include +#include +#endif + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + #define SX_OVERRIDE + #define SX_FINAL + #define SX_DELETE + #define SX_NULLPTR NULL + + #define SX_FOR(_variable, _container) BOOST_FOREACH( _variable, _container ) + + #define SX_CONSTEXPR const + + #define SX_NOEXCEPT throw() + + + using boost::shared_ptr; + #define SX_UNIQUE_PTR shared_ptr + + #define SX_MAKE_SHARED boost::make_shared + #define SX_MAKE_UNIQUE boost::make_shared + + template + _type& move(_type& _t) + { + return( _t ); + } + + using boost::int8_t; + using boost::int16_t; + using boost::int32_t; + using boost::int64_t; + using boost::uint8_t; + using boost::uint16_t; + using boost::uint32_t; + using boost::uint64_t; + + using boost::bind; + using boost::ref; + using boost::cref; + using boost::placeholders::_1; + using boost::placeholders::_2; + + using boost::function; + + using boost::remove_reference; + using boost::remove_const; + + using boost::random_device; + + +#else // C++11 compatibility + + #ifdef SX_NO_STD_MAKE_UNIQUE + + template< typename t, typename ... args > + std::unique_ptr< t > make_unique(args&& ... _args) + { + return( std::unique_ptr< t >(new t(std::forward< args >(_args)...)) ); + } + + #else + + using std::make_unique; + + #endif + + #define SX_OVERRIDE override + #define SX_FINAL final + #define SX_DELETE = delete + #define SX_NULLPTR nullptr + + #define SX_FOR(_variable, _container) for( _variable : _container ) + + #ifdef _MSC_VER + #if _MSC_VER <= 1800 + #define SX_CONSTEXPR const + #endif + #endif + + #ifndef SX_CONSTEXPR + #define SX_CONSTEXPR constexpr + #endif + +#ifdef _MSC_VER + #if _MSC_VER <= 1800 + #define SX_NOEXCEPT throw() + #else + #define SX_NOEXCEPT noexcept + #endif +#else + #define SX_NOEXCEPT noexcept +#endif + + using std::shared_ptr; + template + using SX_UNIQUE_PTR = std::unique_ptr<_pointee>; + + #define SX_MAKE_SHARED std::make_shared + #define SX_MAKE_UNIQUE sxe::make_unique + + using std::move; + + + using std::int8_t; + using std::int16_t; + using std::int32_t; + using std::int64_t; + using std::uint8_t; + using std::uint16_t; + using std::uint32_t; + using std::uint64_t; + + using std::bind; + using std::ref; + using std::cref; + using std::placeholders::_1; + using std::placeholders::_2; + + using std::function; + + using std::remove_reference; + using std::remove_const; + + using std::random_device; + + +#endif + + +} + + +#endif diff --git a/externals/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp b/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp similarity index 97% rename from externals/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp rename to externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp index 077dbb4..c0b2d60 100644 --- a/externals/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp +++ b/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp @@ -1,31 +1,31 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 -#define ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 - - -#ifdef Y_NO_STD_MAKE_UNIQUE -#define SX_NO_STD_MAKE_UNIQUE -#endif - - -#ifdef Y_CPP03_BOOST -#define SX_CPP03_BOOST -#endif - - -#define Y_UNIQUE_PTR SX_UNIQUE_PTR -#define Y_MAKE_UNIQUE SX_MAKE_UNIQUE -#define Y_MAKE_SHARED SX_MAKE_SHARED -#define Y_UNUSED_PARAMETER SX_UNUSED_PARAMETER - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 +#define ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 + + +#ifdef Y_NO_STD_MAKE_UNIQUE +#define SX_NO_STD_MAKE_UNIQUE +#endif + + +#ifdef Y_CPP03_BOOST +#define SX_CPP03_BOOST +#endif + + +#define Y_UNIQUE_PTR SX_UNIQUE_PTR +#define Y_MAKE_UNIQUE SX_MAKE_UNIQUE +#define Y_MAKE_SHARED SX_MAKE_SHARED +#define Y_UNUSED_PARAMETER SX_UNUSED_PARAMETER + + +#endif diff --git a/externals/essentials/include/essentials/compatibility/thread.hpp b/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp similarity index 96% rename from externals/essentials/include/essentials/compatibility/thread.hpp rename to externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp index 3cdb3c3..2381481 100644 --- a/externals/essentials/include/essentials/compatibility/thread.hpp +++ b/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp @@ -1,63 +1,63 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF -#define THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF - - -#ifdef SX_CPP03_BOOST - -#include -#include - -#else - -#include -#include -#include -#include - -#endif - - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST // C++03 compatibility - - using boost::thread; - using boost::unique_lock; - using boost::mutex; - using boost::lock_guard; - using boost::condition_variable; - using boost::this_thread::sleep_for; - using boost::atomic; - - -#else // C++11 compatibility - - - using std::thread; - using std::unique_lock; - using std::mutex; - using std::lock_guard; - using std::condition_variable; - using std::this_thread::sleep_for; - using std::atomic; - - -#endif - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF +#define THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF + + +#ifdef SX_CPP03_BOOST + +#include +#include + +#else + +#include +#include +#include +#include + +#endif + + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + using boost::thread; + using boost::unique_lock; + using boost::mutex; + using boost::lock_guard; + using boost::condition_variable; + using boost::this_thread::sleep_for; + using boost::atomic; + + +#else // C++11 compatibility + + + using std::thread; + using std::unique_lock; + using std::mutex; + using std::lock_guard; + using std::condition_variable; + using std::this_thread::sleep_for; + using std::atomic; + + +#endif + + +} + + +#endif diff --git a/externals/essentials/include/essentials/conversion.hpp b/externals/essentials/source/essentials/include/essentials/conversion.hpp similarity index 97% rename from externals/essentials/include/essentials/conversion.hpp rename to externals/essentials/source/essentials/include/essentials/conversion.hpp index 8d73274..c46dd99 100644 --- a/externals/essentials/include/essentials/conversion.hpp +++ b/externals/essentials/source/essentials/include/essentials/conversion.hpp @@ -1,53 +1,53 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 -#define CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 - - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - - - //!\brief Converts a number from string to int. - //!\param _int_as_string Number in string format. - //!\param _result Variable where the result will be stored. - //!\return True on success, false otherwise. - bool string_to_int( const char* const _int_as_string, int& _result ); - - //!\brief Converts a number from unsigned int 32 to string. - //!\param _value Number to be converted. - //!\return Number as string. - std::string to_string( const sxe::uint32_t _value ); - - //!\brief Converts a number from int to string. - //!\param _value Number to be converted. - //!\return Number as string. - std::string to_string( const int _value ); - - //!\brief Converts a string to uppercase. - //!\param _value String to be converted. - //!\return String in uppercase format. - //!\sa to_lower - std::string to_upper( const std::string& _value ); - - //!\brief Converts a string to lowercase. - //!\param _value String to be converted. - //!\return String in lowercase format. - //!\sa to_upper - std::string to_lower( const std::string& _value ); - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 +#define CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + + //!\brief Converts a number from string to int. + //!\param _int_as_string Number in string format. + //!\param _result Variable where the result will be stored. + //!\return True on success, false otherwise. + bool string_to_int( const char* const _int_as_string, int& _result ); + + //!\brief Converts a number from unsigned int 32 to string. + //!\param _value Number to be converted. + //!\return Number as string. + std::string to_string( const sxe::uint32_t _value ); + + //!\brief Converts a number from int to string. + //!\param _value Number to be converted. + //!\return Number as string. + std::string to_string( const int _value ); + + //!\brief Converts a string to uppercase. + //!\param _value String to be converted. + //!\return String in uppercase format. + //!\sa to_lower + std::string to_upper( const std::string& _value ); + + //!\brief Converts a string to lowercase. + //!\param _value String to be converted. + //!\return String in lowercase format. + //!\sa to_upper + std::string to_lower( const std::string& _value ); + +} + + +#endif diff --git a/externals/essentials/include/essentials/essentials_version.hpp b/externals/essentials/source/essentials/include/essentials/essentials_version.hpp similarity index 96% rename from externals/essentials/include/essentials/essentials_version.hpp rename to externals/essentials/source/essentials/include/essentials/essentials_version.hpp index b652986..96d967f 100644 --- a/externals/essentials/include/essentials/essentials_version.hpp +++ b/externals/essentials/source/essentials/include/essentials/essentials_version.hpp @@ -1,41 +1,41 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E -#define VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E - - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - - -namespace version -{ - - -void log_version(); - - -sxe::uint16_t get_major_version(); -sxe::uint16_t get_minor_version(); -sxe::uint16_t get_patch_version(); -sxe::uint16_t get_build_number(); - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E +#define VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + +namespace version +{ + + +void log_version(); + + +sxe::uint16_t get_major_version(); +sxe::uint16_t get_minor_version(); +sxe::uint16_t get_patch_version(); +sxe::uint16_t get_build_number(); + + +} + + +} + + +#endif diff --git a/externals/essentials/include/essentials/exception.hpp b/externals/essentials/source/essentials/include/essentials/exception.hpp similarity index 97% rename from externals/essentials/include/essentials/exception.hpp rename to externals/essentials/source/essentials/include/essentials/exception.hpp index 2e357f8..76ad4b8 100644 --- a/externals/essentials/include/essentials/exception.hpp +++ b/externals/essentials/source/essentials/include/essentials/exception.hpp @@ -1,30 +1,30 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 -#define EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 - - -#include "exception_template.hpp" - - -namespace sxe -{ - - -//!\def SX_EXCEPTION( exception ) -//!\brief The Seadex essentials exception class. -SX_EXCEPTION( exception ) - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 +#define EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 + + +#include "exception_template.hpp" + + +namespace sxe +{ + + +//!\def SX_EXCEPTION( exception ) +//!\brief The Seadex essentials exception class. +SX_EXCEPTION( exception ) + + +} + + +#endif diff --git a/externals/essentials/include/essentials/exception_template.hpp b/externals/essentials/source/essentials/include/essentials/exception_template.hpp similarity index 97% rename from externals/essentials/include/essentials/exception_template.hpp rename to externals/essentials/source/essentials/include/essentials/exception_template.hpp index 749894f..2415a7d 100644 --- a/externals/essentials/include/essentials/exception_template.hpp +++ b/externals/essentials/source/essentials/include/essentials/exception_template.hpp @@ -1,160 +1,160 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D -#define EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/sxprintf.hpp" - - -#ifndef SX_CPP03_BOOST - - -//!\def SX_EXCEPTION( _name ) -//!\brief Create an exception class inheriting std::exception with the given name. It also supports -//! creating messages with placeholders by calling sxprintf. -//!\sa sxprintf -#define SX_EXCEPTION( _name ) \ -class _name: public std::exception \ -{ \ -public: \ - template< typename ... args > \ - _name(const std::string & _what, args ... _args ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _args ... ) ) \ - { \ - } \ -\ -\ - virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ -\ -\ - virtual const char* what() const throw () SX_OVERRIDE \ - { \ - return ( what_.c_str() ); \ - } \ -\ -\ -private: \ - std::string what_; \ -\ -\ -}; - - -#else - - -#define SX_EXCEPTION( _name ) \ -class _name: public std::exception \ -{ \ -public: \ - explicit _name(const std::string & _what ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str() ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6 ) ) \ - { \ - } \ -\ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ) \ - { \ - } \ -\ -\ - explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ):\ - std::exception(), \ - what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ) \ - { \ - } \ -\ -\ - virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ -\ -\ - virtual const char* what() const throw () SX_OVERRIDE \ - { \ - return ( what_.c_str() ); \ - } \ -\ -\ -private: \ - std::string what_; \ -\ -\ -}; - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D +#define EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D + + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/sxprintf.hpp" + + +#ifndef SX_CPP03_BOOST + + +//!\def SX_EXCEPTION( _name ) +//!\brief Create an exception class inheriting std::exception with the given name. It also supports +//! creating messages with placeholders by calling sxprintf. +//!\sa sxprintf +#define SX_EXCEPTION( _name ) \ +class _name: public std::exception \ +{ \ +public: \ + template< typename ... args > \ + _name(const std::string & _what, args ... _args ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _args ... ) ) \ + { \ + } \ +\ +\ + virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ +\ +\ + virtual const char* what() const throw () SX_OVERRIDE \ + { \ + return ( what_.c_str() ); \ + } \ +\ +\ +private: \ + std::string what_; \ +\ +\ +}; + + +#else + + +#define SX_EXCEPTION( _name ) \ +class _name: public std::exception \ +{ \ +public: \ + explicit _name(const std::string & _what ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str() ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6 ) ) \ + { \ + } \ +\ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ) \ + { \ + } \ +\ +\ + virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ +\ +\ + virtual const char* what() const throw () SX_OVERRIDE \ + { \ + return ( what_.c_str() ); \ + } \ +\ +\ +private: \ + std::string what_; \ +\ +\ +}; + + +#endif + + +#endif diff --git a/externals/essentials/include/essentials/format_settings.hpp b/externals/essentials/source/essentials/include/essentials/format_settings.hpp similarity index 96% rename from externals/essentials/include/essentials/format_settings.hpp rename to externals/essentials/source/essentials/include/essentials/format_settings.hpp index 798c83e..757c60a 100644 --- a/externals/essentials/include/essentials/format_settings.hpp +++ b/externals/essentials/source/essentials/include/essentials/format_settings.hpp @@ -1,45 +1,45 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB -#define FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB - - -#include - -#include "compatibility/compatibility.hpp" - - -namespace sxe -{ - -//!\struct format_settings -//!\brief Structure containing information for formatting the output of sxprintf. -struct format_settings SX_FINAL -{ - //!\brief Constructor. - format_settings(); - - - std::string format_string_; - bool missing_closing_bracket_; - bool correct_; - bool hex_; - bool pad_zeros_; - bool places_set_; - int places_; - bool decimal_places_set_; - int decimal_places_; -}; - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB +#define FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB + + +#include + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + +//!\struct format_settings +//!\brief Structure containing information for formatting the output of sxprintf. +struct format_settings SX_FINAL +{ + //!\brief Constructor. + format_settings(); + + + std::string format_string_; + bool missing_closing_bracket_; + bool correct_; + bool hex_; + bool pad_zeros_; + bool places_set_; + int places_; + bool decimal_places_set_; + int decimal_places_; +}; + +} + + +#endif diff --git a/externals/essentials/include/essentials/macro_helpers.hpp b/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp similarity index 97% rename from externals/essentials/include/essentials/macro_helpers.hpp rename to externals/essentials/source/essentials/include/essentials/macro_helpers.hpp index 46609e4..b0777eb 100644 --- a/externals/essentials/include/essentials/macro_helpers.hpp +++ b/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp @@ -1,46 +1,46 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 -#define MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 - - -#ifndef SX_NO_VARIADIC_MACRO - - -//!\def EXPAND( x ) -//!\brief Helper to work around some Visual C++ compiler quirk dealing with variadic macros. -#define EXPAND( x ) x - -//!\def CAT( A, B ) -//!\brief Concatenate two tokens. -#define CAT( A, B ) A ## B - -//!\def SELECT( NAME, NUM ) -//!\brief Creating a name from a base name and a number with underscore between them. -#define SELECT( NAME, NUM ) CAT( NAME ## _, NUM ) - -//!\def GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) -//!\brief Helper for counting the number of parameters of a macro. -#define GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) COUNT - -//!\def VA_SIZE( ... ) -//!\brief Count the number of parameters of a macro. -#define VA_SIZE( ... ) EXPAND( GET_COUNT( __VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1 ) ) - -//!\def VA_SELECT( NAME, ... ) -//!\brief Selects the correct overloaded macro based on the number of parameters. -#define VA_SELECT( NAME, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )(__VA_ARGS__) ) - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 +#define MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 + + +#ifndef SX_NO_VARIADIC_MACRO + + +//!\def EXPAND( x ) +//!\brief Helper to work around some Visual C++ compiler quirk dealing with variadic macros. +#define EXPAND( x ) x + +//!\def CAT( A, B ) +//!\brief Concatenate two tokens. +#define CAT( A, B ) A ## B + +//!\def SELECT( NAME, NUM ) +//!\brief Creating a name from a base name and a number with underscore between them. +#define SELECT( NAME, NUM ) CAT( NAME ## _, NUM ) + +//!\def GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) +//!\brief Helper for counting the number of parameters of a macro. +#define GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) COUNT + +//!\def VA_SIZE( ... ) +//!\brief Count the number of parameters of a macro. +#define VA_SIZE( ... ) EXPAND( GET_COUNT( __VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1 ) ) + +//!\def VA_SELECT( NAME, ... ) +//!\brief Selects the correct overloaded macro based on the number of parameters. +#define VA_SELECT( NAME, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )(__VA_ARGS__) ) + + +#endif + + +#endif diff --git a/externals/essentials/include/essentials/non_copyable.hpp b/externals/essentials/source/essentials/include/essentials/non_copyable.hpp similarity index 96% rename from externals/essentials/include/essentials/non_copyable.hpp rename to externals/essentials/source/essentials/include/essentials/non_copyable.hpp index d9f85b4..b93fff3 100644 --- a/externals/essentials/include/essentials/non_copyable.hpp +++ b/externals/essentials/source/essentials/include/essentials/non_copyable.hpp @@ -1,68 +1,68 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 -#define NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST - - -//!\def SX_NO_COPY(_class_name) -//!\brief Delete the copy constructor and assignment operator of the given class. -#define SX_NO_COPY(_class_name)\ -private:\ - _class_name(const _class_name&) SX_DELETE;\ - _class_name& operator=(const _class_name&) SX_DELETE;\ -public:\ -\ - - -//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) -//!\brief Delete the assignment operator of the given class. -#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ -private:\ - _class_name& operator=( const _class_name& ) SX_DELETE;\ -public:\ -\ - - -#else - - -//!\def SX_NO_COPY(_class_name) -//!\brief Delete the copy constructor and assignment operator of the given class. -#define SX_NO_COPY(_class_name)\ - _class_name(const _class_name&) SX_DELETE;\ - _class_name& operator=(const _class_name&) SX_DELETE;\ -\ - - -//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) -//!\brief Delete the assignment operator of the given class. -#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ - _class_name& operator=( const _class_name& ) SX_DELETE;\ -\ - - -#endif - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 +#define NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 + + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST + + +//!\def SX_NO_COPY(_class_name) +//!\brief Delete the copy constructor and assignment operator of the given class. +#define SX_NO_COPY(_class_name)\ +private:\ + _class_name(const _class_name&) SX_DELETE;\ + _class_name& operator=(const _class_name&) SX_DELETE;\ +public:\ +\ + + +//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) +//!\brief Delete the assignment operator of the given class. +#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ +private:\ + _class_name& operator=( const _class_name& ) SX_DELETE;\ +public:\ +\ + + +#else + + +//!\def SX_NO_COPY(_class_name) +//!\brief Delete the copy constructor and assignment operator of the given class. +#define SX_NO_COPY(_class_name)\ + _class_name(const _class_name&) SX_DELETE;\ + _class_name& operator=(const _class_name&) SX_DELETE;\ +\ + + +//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) +//!\brief Delete the assignment operator of the given class. +#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ + _class_name& operator=( const _class_name& ) SX_DELETE;\ +\ + + +#endif + + +} + + +#endif diff --git a/externals/essentials/include/essentials/sxprintf.hpp b/externals/essentials/source/essentials/include/essentials/sxprintf.hpp similarity index 97% rename from externals/essentials/include/essentials/sxprintf.hpp rename to externals/essentials/source/essentials/include/essentials/sxprintf.hpp index 7cab8ca..0d9a863 100644 --- a/externals/essentials/include/essentials/sxprintf.hpp +++ b/externals/essentials/source/essentials/include/essentials/sxprintf.hpp @@ -1,242 +1,242 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 -#define PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 - - -#include -#include - - -#ifdef SX_CPP03_BOOST - #include - #include -#endif - -#include "compatibility/compatibility.hpp" -#include "format_settings.hpp" - - -namespace sxe -{ - - -#ifdef SX_CPP03_BOOST - typedef boost::variant< bool, int, unsigned int, sxe::int8_t, sxe::uint8_t, sxe::uint16_t, sxe::uint32_t, - std::string, std::size_t, const char*, boost::int_least64_t, double > value_type; - typedef std::vector< value_type > value_types; -#endif - - -extern const char PLACE_HOLDER; -extern const char* const SUPERFLUOUS_PARAMETER_START; -extern const char SUPERFLUOUS_PARAMETER_END; -extern const char OPENING_SQUARE_BRACKET; -extern const char CLOSING_SQUARE_BRACKET; - - -template< typename value > -struct stream_writer -{ - static void print( std::ostream& _os, const value& _value ) - { - _os << _value; - } -}; - - -template< > -struct stream_writer< sxe::uint8_t > -{ - static void print(std::ostream& _os, const sxe::uint8_t& _value) - { - _os << static_cast( _value ); - } -}; - - -// cppcheck-suppress unusedFunction -std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ); -sxe::format_settings parse_format_string( const char** const _format ); - - -#ifdef SX_CPP03_BOOST - -void print_value_type_value( std::ostream& _os, const value_type& _value ); - - -#endif - - -template< typename value > -void print_superfluous_parameters( std::ostream& _os, const value& _value ) -{ - _os << SUPERFLUOUS_PARAMETER_START; -#ifndef SX_CPP03_BOOST - stream_writer< value >::print( _os, _value ); -#else - print_value_type_value( _os, _value ); -#endif - _os << SUPERFLUOUS_PARAMETER_END; -} - - -#ifndef SX_CPP03_BOOST - - -template< typename value, typename ... args > -void print_superfluous_parameters( std::ostream& _os, - const value& _value, args ... _args ) -{ - _os << SUPERFLUOUS_PARAMETER_START; - stream_writer< value >::print( _os, _value ); - _os << SUPERFLUOUS_PARAMETER_END; - print_superfluous_parameters( _os, _args ... ); -} - - -#else - - -#endif - - -void sxprintf( std::ostream& _os, const char* _format ); - -#ifndef SX_CPP03_BOOST -template< typename value, typename ... args > -void sxprintf( std::ostream& _os, const char* _format, const value& _value, args ... _args ) -{ - while( *_format ) - { - if( PLACE_HOLDER == *_format ) - { - if( PLACE_HOLDER == *( _format + 1 ) ) - { - ++_format; // skip first place holder - _os << *_format++; // output of the second place holder - } - else - { - if( OPENING_SQUARE_BRACKET == *( _format + 1 ) ) - { - ++_format; - const sxe::format_settings format_settings = sxe::parse_format_string( &_format ); - const std::ios_base::fmtflags stream_flags = _os.flags(); - const char streafill_ = _os.fill(); - if( format_settings.correct_ ) - { - _os << format_settings; - stream_writer< value >::print( _os, _value ); - } - else - { - while( CLOSING_SQUARE_BRACKET != *( _format ) ) - { - ++_format; - } - stream_writer< value >::print( _os, _value ); - _os << format_settings; - } - _os.flags( stream_flags ); - _os.fill( streafill_ ); - } - else - { - stream_writer< value >::print( _os, _value ); - } - - sxprintf( _os, _format + 1, _args ... ); - return; - } - } - else - { - _os << *_format++; - } - } - - print_superfluous_parameters( _os, _value, _args ... ); -} - - -//!\brief Creates a formatted message. The format string can contain placeholders ('%'s) that will be replaced with -//!the parameters by this function. To emit a '%' use two percent signs ("%%"). -//!\param _format The format string in which will the placeholders will be replaced (if there are any). -//!\param _args The arguments that will replace the placeholders in the format string. The number of parameters in -//!_args has to be equal to the number of placeholders in the format string. If you pass too few or too many -//!arguments, the resulting string will contain diagnostics in the resulting string -//!([Missing parameter!] or [Superfluous parameter: x]). -//!\return String containing the complete formatted message. -template< typename ... args > -std::string sxprintf(const char* const _format, args ... _args) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _args ...); - return( target_string_stream.str() ); -} - -#else - -std::string sxprintf(const char* const _format); -std::string sxprintf(const char* const _format, const value_type& _value1); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9); -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9, const value_type& _value10); - - -void sxprintf(std::ostream& _os, const char* const _format); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9); -void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10); - - void sxprintf(std::ostream& _os, const char* const _format, const value_types& _values); - -#endif - - -} - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 +#define PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 + + +#include +#include + + +#ifdef SX_CPP03_BOOST + #include + #include +#endif + +#include "compatibility/compatibility.hpp" +#include "format_settings.hpp" + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST + typedef boost::variant< bool, int, unsigned int, sxe::int8_t, sxe::uint8_t, sxe::uint16_t, sxe::uint32_t, + std::string, std::size_t, const char*, boost::int_least64_t, double > value_type; + typedef std::vector< value_type > value_types; +#endif + + +extern const char PLACE_HOLDER; +extern const char* const SUPERFLUOUS_PARAMETER_START; +extern const char SUPERFLUOUS_PARAMETER_END; +extern const char OPENING_SQUARE_BRACKET; +extern const char CLOSING_SQUARE_BRACKET; + + +template< typename value > +struct stream_writer +{ + static void print( std::ostream& _os, const value& _value ) + { + _os << _value; + } +}; + + +template< > +struct stream_writer< sxe::uint8_t > +{ + static void print(std::ostream& _os, const sxe::uint8_t& _value) + { + _os << static_cast( _value ); + } +}; + + +// cppcheck-suppress unusedFunction +std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ); +sxe::format_settings parse_format_string( const char** const _format ); + + +#ifdef SX_CPP03_BOOST + +void print_value_type_value( std::ostream& _os, const value_type& _value ); + + +#endif + + +template< typename value > +void print_superfluous_parameters( std::ostream& _os, const value& _value ) +{ + _os << SUPERFLUOUS_PARAMETER_START; +#ifndef SX_CPP03_BOOST + stream_writer< value >::print( _os, _value ); +#else + print_value_type_value( _os, _value ); +#endif + _os << SUPERFLUOUS_PARAMETER_END; +} + + +#ifndef SX_CPP03_BOOST + + +template< typename value, typename ... args > +void print_superfluous_parameters( std::ostream& _os, + const value& _value, args ... _args ) +{ + _os << SUPERFLUOUS_PARAMETER_START; + stream_writer< value >::print( _os, _value ); + _os << SUPERFLUOUS_PARAMETER_END; + print_superfluous_parameters( _os, _args ... ); +} + + +#else + + +#endif + + +void sxprintf( std::ostream& _os, const char* _format ); + +#ifndef SX_CPP03_BOOST +template< typename value, typename ... args > +void sxprintf( std::ostream& _os, const char* _format, const value& _value, args ... _args ) +{ + while( *_format ) + { + if( PLACE_HOLDER == *_format ) + { + if( PLACE_HOLDER == *( _format + 1 ) ) + { + ++_format; // skip first place holder + _os << *_format++; // output of the second place holder + } + else + { + if( OPENING_SQUARE_BRACKET == *( _format + 1 ) ) + { + ++_format; + const sxe::format_settings format_settings = sxe::parse_format_string( &_format ); + const std::ios_base::fmtflags stream_flags = _os.flags(); + const char streafill_ = _os.fill(); + if( format_settings.correct_ ) + { + _os << format_settings; + stream_writer< value >::print( _os, _value ); + } + else + { + while( CLOSING_SQUARE_BRACKET != *( _format ) ) + { + ++_format; + } + stream_writer< value >::print( _os, _value ); + _os << format_settings; + } + _os.flags( stream_flags ); + _os.fill( streafill_ ); + } + else + { + stream_writer< value >::print( _os, _value ); + } + + sxprintf( _os, _format + 1, _args ... ); + return; + } + } + else + { + _os << *_format++; + } + } + + print_superfluous_parameters( _os, _value, _args ... ); +} + + +//!\brief Creates a formatted message. The format string can contain placeholders ('%'s) that will be replaced with +//!the parameters by this function. To emit a '%' use two percent signs ("%%"). +//!\param _format The format string in which will the placeholders will be replaced (if there are any). +//!\param _args The arguments that will replace the placeholders in the format string. The number of parameters in +//!_args has to be equal to the number of placeholders in the format string. If you pass too few or too many +//!arguments, the resulting string will contain diagnostics in the resulting string +//!([Missing parameter!] or [Superfluous parameter: x]). +//!\return String containing the complete formatted message. +template< typename ... args > +std::string sxprintf(const char* const _format, args ... _args) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _args ...); + return( target_string_stream.str() ); +} + +#else + +std::string sxprintf(const char* const _format); +std::string sxprintf(const char* const _format, const value_type& _value1); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9, const value_type& _value10); + + +void sxprintf(std::ostream& _os, const char* const _format); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10); + + void sxprintf(std::ostream& _os, const char* const _format, const value_types& _values); + +#endif + + +} + +#endif diff --git a/externals/essentials/include/essentials/uri.hpp b/externals/essentials/source/essentials/include/essentials/uri.hpp similarity index 96% rename from externals/essentials/include/essentials/uri.hpp rename to externals/essentials/source/essentials/include/essentials/uri.hpp index 5a0a0bb..0499a44 100644 --- a/externals/essentials/include/essentials/uri.hpp +++ b/externals/essentials/source/essentials/include/essentials/uri.hpp @@ -1,55 +1,55 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D -#define URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D - - -#include - -#include "essentials/compatibility/compatibility.hpp" - - -namespace sxe -{ - - -const char URI_DELIMITER = '/'; - - -class uri SX_FINAL -{ -public: - explicit uri( const std::string& _uri = "" ); - ~uri() SX_NOEXCEPT; - bool is_empty() const; - const std::string to_string() const; - const std::string& get_front() const; - const std::string& get_back(); - void push_front( const std::string& _segment ); - void push_back( const std::string& _segment ); - void pop_front(); - void pop_back(); - size_t size() const; - - -private: - const std::string build_uri() const; - void split_string_to_uri_segments( const std::string& _uri ); - - - std::deque< std::string > uri_; -}; - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D +#define URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D + + +#include + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sxe +{ + + +const char URI_DELIMITER = '/'; + + +class uri SX_FINAL +{ +public: + explicit uri( const std::string& _uri = "" ); + ~uri() SX_NOEXCEPT; + bool is_empty() const; + const std::string to_string() const; + const std::string& get_front() const; + const std::string& get_back(); + void push_front( const std::string& _segment ); + void push_back( const std::string& _segment ); + void pop_front(); + void pop_back(); + size_t size() const; + + +private: + const std::string build_uri() const; + void split_string_to_uri_segments( const std::string& _uri ); + + + std::deque< std::string > uri_; +}; + + +} + + +#endif diff --git a/externals/essentials/source/conversion.cpp b/externals/essentials/source/essentials/source/conversion.cpp similarity index 95% rename from externals/essentials/source/conversion.cpp rename to externals/essentials/source/essentials/source/conversion.cpp index 4e0ff74..ed91544 100644 --- a/externals/essentials/source/conversion.cpp +++ b/externals/essentials/source/essentials/source/conversion.cpp @@ -1,103 +1,103 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "essentials/conversion.hpp" - -#include -#include -#include - -#ifndef SX_CPP03_BOOST - #include -#else - #include -#endif - - -namespace sxe -{ - - -bool string_to_int( const char* const _int_as_string, int& _result ) -{ - bool success = false; - try - { -#ifndef SX_CPP03_BOOST - _result = std::stoi( std::string( _int_as_string ) ); - success = true; -#else - std::istringstream is( _int_as_string ); - if (is >> _result) - { - success = true; - } - else - { - success = false; - } -#endif - - } - catch ( const std::invalid_argument& ) - { - success = false; - } - catch ( const std::out_of_range& ) - { - success = false; - } - return( success ); -} - - -std::string to_string( const sxe::uint32_t _value ) -{ -#ifndef SX_CPP03_BOOST - return( std::to_string( _value ) ); -#else - std::ostringstream ostr; - ostr << _value; - return( ostr.str() ); -#endif -} - - -std::string to_string( const int _value ) -{ -#ifndef SX_CPP03_BOOST - return( std::to_string( _value ) ); -#else - std::ostringstream ostr; - ostr << _value; - return( ostr.str() ); -#endif -} - - -// cppcheck-suppress unusedFunction -std::string to_upper( const std::string& _value ) -{ - std::string value_caps = _value; - std::transform( value_caps.begin(), value_caps.end(), value_caps.begin(), static_cast< int( *)( int ) >( ::std::toupper ) ); - return( value_caps ); -} - - -// cppcheck-suppress unusedFunction -std::string to_lower( const std::string& _value ) -{ - std::string value_to_lower = _value; - std::transform( value_to_lower.begin(), value_to_lower.end(), value_to_lower.begin(), static_cast< int( *)( int ) >( ::std::tolower ) ); - return( value_to_lower ); -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/conversion.hpp" + +#include +#include +#include + +#ifndef SX_CPP03_BOOST + #include +#else + #include +#endif + + +namespace sxe +{ + + +bool string_to_int( const char* const _int_as_string, int& _result ) +{ + bool success = false; + try + { +#ifndef SX_CPP03_BOOST + _result = std::stoi( std::string( _int_as_string ) ); + success = true; +#else + std::istringstream is( _int_as_string ); + if (is >> _result) + { + success = true; + } + else + { + success = false; + } +#endif + + } + catch ( const std::invalid_argument& ) + { + success = false; + } + catch ( const std::out_of_range& ) + { + success = false; + } + return( success ); +} + + +std::string to_string( const sxe::uint32_t _value ) +{ +#ifndef SX_CPP03_BOOST + return( std::to_string( _value ) ); +#else + std::ostringstream ostr; + ostr << _value; + return( ostr.str() ); +#endif +} + + +std::string to_string( const int _value ) +{ +#ifndef SX_CPP03_BOOST + return( std::to_string( _value ) ); +#else + std::ostringstream ostr; + ostr << _value; + return( ostr.str() ); +#endif +} + + +// cppcheck-suppress unusedFunction +std::string to_upper( const std::string& _value ) +{ + std::string value_caps = _value; + std::transform( value_caps.begin(), value_caps.end(), value_caps.begin(), static_cast< int( *)( int ) >( ::std::toupper ) ); + return( value_caps ); +} + + +// cppcheck-suppress unusedFunction +std::string to_lower( const std::string& _value ) +{ + std::string value_to_lower = _value; + std::transform( value_to_lower.begin(), value_to_lower.end(), value_to_lower.begin(), static_cast< int( *)( int ) >( ::std::tolower ) ); + return( value_to_lower ); +} + + +} diff --git a/externals/essentials/source/essentials_version.cpp b/externals/essentials/source/essentials/source/essentials_version.cpp similarity index 93% rename from externals/essentials/source/essentials_version.cpp rename to externals/essentials/source/essentials/source/essentials_version.cpp index ad5323b..7279071 100644 --- a/externals/essentials/source/essentials_version.cpp +++ b/externals/essentials/source/essentials/source/essentials_version.cpp @@ -1,74 +1,74 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "essentials/essentials_version.hpp" - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/build_number.hpp" -#include "essentials/sxprintf.hpp" - - -namespace sxe -{ - - -namespace version -{ - - -namespace -{ - - -const sxe::uint16_t VERSION_MAJOR( 1 ); -const sxe::uint16_t VERSION_MINOR( 3 ); -const sxe::uint16_t VERSION_PATCH( 1 ); - - -} - - -// cppcheck-suppress unusedFunction -void log_version() -{ - std::cout << sxe::sxprintf( "essentials library version %.%.%.%.", get_major_version(), - get_minor_version(), get_patch_version(), get_build_number() ) << std::endl; -} - - -sxe::uint16_t get_major_version() -{ - return( VERSION_MAJOR ); -} - - -sxe::uint16_t get_minor_version() -{ - return( VERSION_MINOR ); -} - - -sxe::uint16_t get_patch_version() -{ - return( VERSION_PATCH ); -} - - -sxe::uint16_t get_build_number() -{ - return( BUILD_NUMBER ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "essentials/essentials_version.hpp" + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/build_number.hpp" +#include "essentials/sxprintf.hpp" + + +namespace sxe +{ + + +namespace version +{ + + +namespace +{ + + +const sxe::uint16_t VERSION_MAJOR( 1 ); +const sxe::uint16_t VERSION_MINOR( 3 ); +const sxe::uint16_t VERSION_PATCH( 2 ); + + +} + + +// cppcheck-suppress unusedFunction +void log_version() +{ + std::cout << sxe::sxprintf( "essentials library version %.%.%.%.", get_major_version(), + get_minor_version(), get_patch_version(), get_build_number() ) << std::endl; +} + + +sxe::uint16_t get_major_version() +{ + return( VERSION_MAJOR ); +} + + +sxe::uint16_t get_minor_version() +{ + return( VERSION_MINOR ); +} + + +sxe::uint16_t get_patch_version() +{ + return( VERSION_PATCH ); +} + + +sxe::uint16_t get_build_number() +{ + return( BUILD_NUMBER ); +} + + +} + + +} diff --git a/externals/essentials/source/format_settings.cpp b/externals/essentials/source/essentials/source/format_settings.cpp similarity index 97% rename from externals/essentials/source/format_settings.cpp rename to externals/essentials/source/essentials/source/format_settings.cpp index 768379a..0417c8a 100644 --- a/externals/essentials/source/format_settings.cpp +++ b/externals/essentials/source/essentials/source/format_settings.cpp @@ -1,32 +1,32 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "essentials/format_settings.hpp" - - -namespace sxe -{ - - -format_settings::format_settings(): - format_string_(), - missing_closing_bracket_( false ), - correct_( false ), - hex_( false ), - pad_zeros_( false ), - places_set_( false ), - places_( 0 ), - decimal_places_set_( false ), - decimal_places_( 0 ) -{ - // Nothing to do... -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "essentials/format_settings.hpp" + + +namespace sxe +{ + + +format_settings::format_settings(): + format_string_(), + missing_closing_bracket_( false ), + correct_( false ), + hex_( false ), + pad_zeros_( false ), + places_set_( false ), + places_( 0 ), + decimal_places_set_( false ), + decimal_places_( 0 ) +{ + // Nothing to do... +} + + +} diff --git a/externals/essentials/source/sxprintf.cpp b/externals/essentials/source/essentials/source/sxprintf.cpp similarity index 96% rename from externals/essentials/source/sxprintf.cpp rename to externals/essentials/source/essentials/source/sxprintf.cpp index f3794a1..99844aa 100644 --- a/externals/essentials/source/sxprintf.cpp +++ b/externals/essentials/source/essentials/source/sxprintf.cpp @@ -1,628 +1,628 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "essentials/sxprintf.hpp" - -#include - -#include "essentials/base.hpp" -#include "essentials/conversion.hpp" - - -namespace sxe -{ - - -namespace -{ - - - const char MISSING_PARAMETERS_MESSAGE[] = "[Missing parameter!]"; - const char MISSING_TERMINATOR[] = "[Missing output modifier terminator!]"; - const char ILLEGAL_MODIFIER[] = "[Illegal output modifier!]"; - const char POINT = '.'; - const char ZERO = '0'; - const char X = 'x'; - const char CAPS_X = 'X'; - - -} - - -const char PLACE_HOLDER = '%'; -const char* const SUPERFLUOUS_PARAMETER_START = "[Superfluous parameter: "; -const char SUPERFLUOUS_PARAMETER_END = ']'; -const char OPENING_SQUARE_BRACKET = '['; -const char CLOSING_SQUARE_BRACKET = ']'; - - -// cppcheck-suppress unusedFunction -std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ) -{ - if( !_format.correct_ ) - { - _os << ILLEGAL_MODIFIER; - } - else if( _format.missing_closing_bracket_ ) - { - _os << MISSING_TERMINATOR; - } - else - { - if( _format.hex_ ) - { - _os << std::hex; - _os << std::showbase; - _os.fill( '0' ); - } - else - { - if( _format.pad_zeros_ ) - { - _os.fill( '0' ); - } - - if( _format.places_set_ ) - { - _os.width( _format.places_ ); - } - - if( _format.decimal_places_set_ ) - { - _os.precision( _format.decimal_places_ ); - } - } - } - - return( _os ); -} - - -bool is_allowed_char( const char _char ) -{ - const bool success = ( std::isdigit( _char ) || ( X == _char ) || ( CAPS_X == _char ) ); - return( success ); -} - - -sxe::format_settings parse_format_string( const char** const _format ) -{ - sxe::format_settings format_settings; - format_settings.correct_ = true; - SX_ASSERT( ( OPENING_SQUARE_BRACKET == **_format ), "Format string to parse doesn't start with [." ); - ++*_format; - format_settings.missing_closing_bracket_ = true; - bool point_found = false; - const char* text_before_point = *_format; - std::size_t text_before_point_size = 0; - const char* text_after_point = SX_NULLPTR; - std::size_t text_after_point_size = 0; - while( **_format ) - { - if( CLOSING_SQUARE_BRACKET == **_format ) - { - format_settings.missing_closing_bracket_ = false; - break; - } - else - if( POINT == **_format ) - { - if( point_found ) - { - format_settings.correct_ = false; - break; - } - else - { - point_found = true; - text_after_point = ( *_format ) + 1; - text_after_point_size = 0; - } - } - else - { - const char _text_char = **_format; - if( is_allowed_char( _text_char ) ) - { - if( point_found ) - { - ++text_after_point_size; - } - else - { - ++text_before_point_size; - } - } - else - { - format_settings.correct_ = false; - break; - } - } - - ++( *_format ); - } - - SX_ASSERT( text_before_point, "Logic error parsing format string!" ); - if( ( 0 == text_before_point_size ) && ( 0 == text_after_point_size ) ) - { - format_settings.correct_ = false; - } - - if( ( !format_settings.missing_closing_bracket_ ) && format_settings.correct_ ) - { - if( ( 0 < text_before_point_size ) && ( ( X == text_before_point[ 0 ] ) || ( CAPS_X == text_before_point[ 0 ] ) ) ) - { - format_settings.hex_ = true; - ++text_before_point; - --text_before_point_size; - } - - if( ( 0 < text_before_point_size ) && ( ZERO == text_before_point[ 0 ] ) ) - { - format_settings.pad_zeros_ = true; - ++text_before_point; - --text_before_point_size; - } - - if( 0 < text_before_point_size ) - { - format_settings.places_set_ = true; - if( !string_to_int( text_before_point, format_settings.places_ ) ) - { - format_settings.correct_ = false; - } - } - - if( 0 < text_after_point_size ) - { - SX_ASSERT( text_after_point, "Logic error parsing format string!" ); - format_settings.decimal_places_set_ = true; - if( !string_to_int( text_after_point, format_settings.decimal_places_ ) ) - { - format_settings.correct_ = false; - } - } - } - - return( format_settings ); -} - - -#ifdef SX_CPP03_BOOST - - -void print_superfluous_parameters( std::ostream& _os, const value_types& _values, value_types::const_iterator& _position ) -{ - while( _position != _values.end() ) - { - print_superfluous_parameters( _os, *_position ); - ++_position; - } -} - - -#endif - - -void sxprintf( std::ostream& _os, const char* _format ) -{ - while( *_format ) - { - if( PLACE_HOLDER == *_format ) - { - if( PLACE_HOLDER == *( _format + 1 ) ) - { - ++_format; - } - else - { - _os << MISSING_PARAMETERS_MESSAGE; - } - } - _os << *_format++; - } -} - - -#ifdef SX_CPP03_BOOST - - -std::string sxprintf(const char* const _format) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9); - return( target_string_stream.str() ); -} - - -std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, - const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, - const value_type& _value9, const value_type& _value10) -{ - std::stringstream target_string_stream; - sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10); - return( target_string_stream.str() ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1 ) -{ - value_types values; - values.push_back( _value1 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - values.push_back( _value8 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - values.push_back( _value8 ); - values.push_back( _value9 ); - sxprintf( _os, _format, values ); -} - - -void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, - const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, - const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10 ) -{ - value_types values; - values.push_back( _value1 ); - values.push_back( _value2 ); - values.push_back( _value3 ); - values.push_back( _value4 ); - values.push_back( _value5 ); - values.push_back( _value6 ); - values.push_back( _value7 ); - values.push_back( _value8 ); - values.push_back( _value9 ); - values.push_back( _value10 ); - sxprintf( _os, _format, values ); -} - - -const char* sxprintf_impl( std::ostream& _os, const char* _format, value_types::const_iterator& _position, - const value_types::const_iterator _end, bool& printed ) -{ - while (*_format) - { - if (PLACE_HOLDER == *_format) - { - if (PLACE_HOLDER == *( _format + 1 )) - { - ++_format; // skip first place holder - _os << *_format++; // output of the second place holder - } - else - { - if (OPENING_SQUARE_BRACKET == *( _format + 1 )) - { - ++_format; - const sxe::format_settings format_settings = sxe::parse_format_string(&_format); - const std::ios_base::fmtflags stream_flags = _os.flags(); - const char streafill_ = _os.fill(); - _os << format_settings; - print_value_type_value( _os, *_position ); - _os.flags(stream_flags); - _os.fill(streafill_); - printed = true; - if( !format_settings.missing_closing_bracket_ ) - { - if( CLOSING_SQUARE_BRACKET == *( _format ) ) - { - ++_format; - } - } - else - { - if( !format_settings.correct_ ) - { - ++_format; - } - } - } - else - { - print_value_type_value( _os, *_position ); - printed = true; - ++_format; - break; - } - - if( _position + 1 != _end ) - { - if( *_format != '\0' ) - { - ++_position; - _format = sxprintf_impl( _os, _format, _position, _end, printed ); - } - } - return( _format ); - } - } - else - { - _os << *_format++; - } - } - return ( _format ); -} - - -void sxprintf( std::ostream& _os, const char * const _format, const value_types& _values ) -{ - SX_ASSERT( _format, "No format string to parse was passed!" ); - const char* current_position = _format; - - value_types::const_iterator _end = _values.end(); - value_types::const_iterator _position = _values.begin(); - while( _position != _end ) - { - bool printed = false; - current_position = sxprintf_impl( _os, current_position, _position, _end, printed ); - if( printed ) - { - ++_position; - } - if( current_position[0] == '\0' ) - { - break; - } - } - - sxprintf( _os, current_position ); - - if( _position != _end ) - { - print_superfluous_parameters( _os, _values, _position ); - } -} - - -void print_value_type_value( std::ostream& _os, const value_type& _value ) -{ - const std::type_info& type_info = _value.type(); - - if( type_info == typeid ( bool ) ) - { - stream_writer< bool >::print( _os, boost::get< bool >( _value ) ); - } - else if( type_info == typeid ( int ) ) - { - stream_writer< int >::print( _os, boost::get< int >( _value ) ); - } - else if( type_info == typeid ( unsigned int ) ) - { - stream_writer< unsigned int >::print( _os, boost::get< unsigned int >( _value ) ); - } - else if( type_info == typeid ( sxe::int8_t ) ) - { - stream_writer< sxe::int8_t >::print( _os, boost::get< sxe::int8_t >( _value ) ); - } - else if (type_info == typeid ( sxe::uint8_t )) - { - stream_writer< sxe::uint8_t >::print(_os, boost::get< sxe::uint8_t >(_value)); - } - else if( type_info == typeid ( sxe::uint16_t ) ) - { - stream_writer< sxe::uint16_t >::print( _os, boost::get< sxe::uint16_t >( _value ) ); - } - else if( type_info == typeid ( sxe::uint32_t ) ) - { - stream_writer< sxe::uint32_t >::print( _os, boost::get< sxe::uint32_t >( _value ) ); - } - else if( type_info == typeid ( std::string ) ) - { - stream_writer< std::string >::print( _os, boost::get< std::string >( _value ) ); - } - else if( type_info == typeid ( std::size_t ) ) - { - stream_writer< std::size_t >::print( _os, boost::get< std::size_t >( _value ) ); - } - else if( type_info == typeid ( const char* ) ) - { - stream_writer< const char* >::print( _os, boost::get< const char* >( _value ) ); - } - else if( type_info == typeid ( boost::int_least64_t ) ) - { - stream_writer< boost::int_least64_t >::print( _os, boost::get< boost::int_least64_t >( _value ) ); - } - else if( type_info == typeid ( double ) ) - { - stream_writer< double >::print( _os, boost::get< double >( _value ) ); - } -} - - -#endif - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/sxprintf.hpp" + +#include + +#include "essentials/base.hpp" +#include "essentials/conversion.hpp" + + +namespace sxe +{ + + +namespace +{ + + + const char MISSING_PARAMETERS_MESSAGE[] = "[Missing parameter!]"; + const char MISSING_TERMINATOR[] = "[Missing output modifier terminator!]"; + const char ILLEGAL_MODIFIER[] = "[Illegal output modifier!]"; + const char POINT = '.'; + const char ZERO = '0'; + const char X = 'x'; + const char CAPS_X = 'X'; + + +} + + +const char PLACE_HOLDER = '%'; +const char* const SUPERFLUOUS_PARAMETER_START = "[Superfluous parameter: "; +const char SUPERFLUOUS_PARAMETER_END = ']'; +const char OPENING_SQUARE_BRACKET = '['; +const char CLOSING_SQUARE_BRACKET = ']'; + + +// cppcheck-suppress unusedFunction +std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ) +{ + if( !_format.correct_ ) + { + _os << ILLEGAL_MODIFIER; + } + else if( _format.missing_closing_bracket_ ) + { + _os << MISSING_TERMINATOR; + } + else + { + if( _format.hex_ ) + { + _os << std::hex; + _os << std::showbase; + _os.fill( '0' ); + } + else + { + if( _format.pad_zeros_ ) + { + _os.fill( '0' ); + } + + if( _format.places_set_ ) + { + _os.width( _format.places_ ); + } + + if( _format.decimal_places_set_ ) + { + _os.precision( _format.decimal_places_ ); + } + } + } + + return( _os ); +} + + +bool is_allowed_char( const char _char ) +{ + const bool success = ( std::isdigit( _char ) || ( X == _char ) || ( CAPS_X == _char ) ); + return( success ); +} + + +sxe::format_settings parse_format_string( const char** const _format ) +{ + sxe::format_settings format_settings; + format_settings.correct_ = true; + SX_ASSERT( ( OPENING_SQUARE_BRACKET == **_format ), "Format string to parse doesn't start with [." ); + ++*_format; + format_settings.missing_closing_bracket_ = true; + bool point_found = false; + const char* text_before_point = *_format; + std::size_t text_before_point_size = 0; + const char* text_after_point = SX_NULLPTR; + std::size_t text_after_point_size = 0; + while( **_format ) + { + if( CLOSING_SQUARE_BRACKET == **_format ) + { + format_settings.missing_closing_bracket_ = false; + break; + } + else + if( POINT == **_format ) + { + if( point_found ) + { + format_settings.correct_ = false; + break; + } + else + { + point_found = true; + text_after_point = ( *_format ) + 1; + text_after_point_size = 0; + } + } + else + { + const char _text_char = **_format; + if( is_allowed_char( _text_char ) ) + { + if( point_found ) + { + ++text_after_point_size; + } + else + { + ++text_before_point_size; + } + } + else + { + format_settings.correct_ = false; + break; + } + } + + ++( *_format ); + } + + SX_ASSERT( text_before_point, "Logic error parsing format string!" ); + if( ( 0 == text_before_point_size ) && ( 0 == text_after_point_size ) ) + { + format_settings.correct_ = false; + } + + if( ( !format_settings.missing_closing_bracket_ ) && format_settings.correct_ ) + { + if( ( 0 < text_before_point_size ) && ( ( X == text_before_point[ 0 ] ) || ( CAPS_X == text_before_point[ 0 ] ) ) ) + { + format_settings.hex_ = true; + ++text_before_point; + --text_before_point_size; + } + + if( ( 0 < text_before_point_size ) && ( ZERO == text_before_point[ 0 ] ) ) + { + format_settings.pad_zeros_ = true; + ++text_before_point; + --text_before_point_size; + } + + if( 0 < text_before_point_size ) + { + format_settings.places_set_ = true; + if( !string_to_int( text_before_point, format_settings.places_ ) ) + { + format_settings.correct_ = false; + } + } + + if( 0 < text_after_point_size ) + { + SX_ASSERT( text_after_point, "Logic error parsing format string!" ); + format_settings.decimal_places_set_ = true; + if( !string_to_int( text_after_point, format_settings.decimal_places_ ) ) + { + format_settings.correct_ = false; + } + } + } + + return( format_settings ); +} + + +#ifdef SX_CPP03_BOOST + + +void print_superfluous_parameters( std::ostream& _os, const value_types& _values, value_types::const_iterator& _position ) +{ + while( _position != _values.end() ) + { + print_superfluous_parameters( _os, *_position ); + ++_position; + } +} + + +#endif + + +void sxprintf( std::ostream& _os, const char* _format ) +{ + while( *_format ) + { + if( PLACE_HOLDER == *_format ) + { + if( PLACE_HOLDER == *( _format + 1 ) ) + { + ++_format; + } + else + { + _os << MISSING_PARAMETERS_MESSAGE; + } + } + _os << *_format++; + } +} + + +#ifdef SX_CPP03_BOOST + + +std::string sxprintf(const char* const _format) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9, const value_type& _value10) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10); + return( target_string_stream.str() ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1 ) +{ + value_types values; + values.push_back( _value1 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + values.push_back( _value9 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + values.push_back( _value9 ); + values.push_back( _value10 ); + sxprintf( _os, _format, values ); +} + + +const char* sxprintf_impl( std::ostream& _os, const char* _format, value_types::const_iterator& _position, + const value_types::const_iterator _end, bool& printed ) +{ + while (*_format) + { + if (PLACE_HOLDER == *_format) + { + if (PLACE_HOLDER == *( _format + 1 )) + { + ++_format; // skip first place holder + _os << *_format++; // output of the second place holder + } + else + { + if (OPENING_SQUARE_BRACKET == *( _format + 1 )) + { + ++_format; + const sxe::format_settings format_settings = sxe::parse_format_string(&_format); + const std::ios_base::fmtflags stream_flags = _os.flags(); + const char streafill_ = _os.fill(); + _os << format_settings; + print_value_type_value( _os, *_position ); + _os.flags(stream_flags); + _os.fill(streafill_); + printed = true; + if( !format_settings.missing_closing_bracket_ ) + { + if( CLOSING_SQUARE_BRACKET == *( _format ) ) + { + ++_format; + } + } + else + { + if( !format_settings.correct_ ) + { + ++_format; + } + } + } + else + { + print_value_type_value( _os, *_position ); + printed = true; + ++_format; + break; + } + + if( _position + 1 != _end ) + { + if( *_format != '\0' ) + { + ++_position; + _format = sxprintf_impl( _os, _format, _position, _end, printed ); + } + } + return( _format ); + } + } + else + { + _os << *_format++; + } + } + return ( _format ); +} + + +void sxprintf( std::ostream& _os, const char * const _format, const value_types& _values ) +{ + SX_ASSERT( _format, "No format string to parse was passed!" ); + const char* current_position = _format; + + value_types::const_iterator _end = _values.end(); + value_types::const_iterator _position = _values.begin(); + while( _position != _end ) + { + bool printed = false; + current_position = sxprintf_impl( _os, current_position, _position, _end, printed ); + if( printed ) + { + ++_position; + } + if( current_position[0] == '\0' ) + { + break; + } + } + + sxprintf( _os, current_position ); + + if( _position != _end ) + { + print_superfluous_parameters( _os, _values, _position ); + } +} + + +void print_value_type_value( std::ostream& _os, const value_type& _value ) +{ + const std::type_info& type_info = _value.type(); + + if( type_info == typeid ( bool ) ) + { + stream_writer< bool >::print( _os, boost::get< bool >( _value ) ); + } + else if( type_info == typeid ( int ) ) + { + stream_writer< int >::print( _os, boost::get< int >( _value ) ); + } + else if( type_info == typeid ( unsigned int ) ) + { + stream_writer< unsigned int >::print( _os, boost::get< unsigned int >( _value ) ); + } + else if( type_info == typeid ( sxe::int8_t ) ) + { + stream_writer< sxe::int8_t >::print( _os, boost::get< sxe::int8_t >( _value ) ); + } + else if (type_info == typeid ( sxe::uint8_t )) + { + stream_writer< sxe::uint8_t >::print(_os, boost::get< sxe::uint8_t >(_value)); + } + else if( type_info == typeid ( sxe::uint16_t ) ) + { + stream_writer< sxe::uint16_t >::print( _os, boost::get< sxe::uint16_t >( _value ) ); + } + else if( type_info == typeid ( sxe::uint32_t ) ) + { + stream_writer< sxe::uint32_t >::print( _os, boost::get< sxe::uint32_t >( _value ) ); + } + else if( type_info == typeid ( std::string ) ) + { + stream_writer< std::string >::print( _os, boost::get< std::string >( _value ) ); + } + else if( type_info == typeid ( std::size_t ) ) + { + stream_writer< std::size_t >::print( _os, boost::get< std::size_t >( _value ) ); + } + else if( type_info == typeid ( const char* ) ) + { + stream_writer< const char* >::print( _os, boost::get< const char* >( _value ) ); + } + else if( type_info == typeid ( boost::int_least64_t ) ) + { + stream_writer< boost::int_least64_t >::print( _os, boost::get< boost::int_least64_t >( _value ) ); + } + else if( type_info == typeid ( double ) ) + { + stream_writer< double >::print( _os, boost::get< double >( _value ) ); + } +} + + +#endif + + +} diff --git a/externals/essentials/source/uri.cpp b/externals/essentials/source/essentials/source/uri.cpp similarity index 95% rename from externals/essentials/source/uri.cpp rename to externals/essentials/source/essentials/source/uri.cpp index 9926a9a..1460efb 100644 --- a/externals/essentials/source/uri.cpp +++ b/externals/essentials/source/essentials/source/uri.cpp @@ -1,136 +1,136 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex essentials library (http://essentials.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://essentials.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "essentials/uri.hpp" - -#include -#include - -#include "essentials/base.hpp" - - -namespace sxe -{ - - -uri::uri( const std::string& _uri ) - : uri_() -{ - split_string_to_uri_segments( _uri ); -} - - -uri::~uri() SX_NOEXCEPT -{ - // Nothing to do... -} - - -bool uri::is_empty() const -{ - return( uri_.empty() ); -} - - -const std::string uri::to_string() const -{ - return( build_uri() ); -} - - -const std::string& uri::get_front() const -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - return( uri_.front() ); -} - - -const std::string& uri::get_back() -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - return( uri_.back() ); -} - - -void uri::push_front( const std::string& _segment ) -{ - uri_.push_front( _segment ); -} - - -void uri::push_back( const std::string& _segment ) -{ - uri_.push_back( _segment ); -} - - -void uri::pop_front() -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - uri_.pop_front(); -} - - -void uri::pop_back() -{ - SX_ASSERT( !uri_.empty(), "Uri is empty!" ); - uri_.pop_back(); -} - - -size_t uri::size() const -{ - return( uri_.size() ); -} - - -const std::string uri::build_uri() const -{ - std::stringstream uri; - - SX_FOR( const std::string& uri_element, uri_ ) - { - uri << URI_DELIMITER << uri_element; - } - - return( uri.str() ); -} - - -void uri::split_string_to_uri_segments( const std::string& _uri ) -{ - std::string uri = _uri; - if( !_uri.empty() ) - { - if( URI_DELIMITER == _uri[ 0 ] ) - { - uri = _uri.substr( 1 ); - } - - std::string::size_type start = 0; - std::string::size_type end = uri.find( URI_DELIMITER ); - while( end != std::string::npos ) - { - const std::string& segment = uri.substr( start, end - start ); - uri_.push_back( segment ); - start = ++end; - end = uri.find( URI_DELIMITER, end ); - } - - const std::string& last_segment = uri.substr( start ); - if( last_segment[ 0 ] != URI_DELIMITER ) - { - uri_.push_back( last_segment ); - } - } -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/uri.hpp" + +#include +#include + +#include "essentials/base.hpp" + + +namespace sxe +{ + + +uri::uri( const std::string& _uri ) + : uri_() +{ + split_string_to_uri_segments( _uri ); +} + + +uri::~uri() SX_NOEXCEPT +{ + // Nothing to do... +} + + +bool uri::is_empty() const +{ + return( uri_.empty() ); +} + + +const std::string uri::to_string() const +{ + return( build_uri() ); +} + + +const std::string& uri::get_front() const +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + return( uri_.front() ); +} + + +const std::string& uri::get_back() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + return( uri_.back() ); +} + + +void uri::push_front( const std::string& _segment ) +{ + uri_.push_front( _segment ); +} + + +void uri::push_back( const std::string& _segment ) +{ + uri_.push_back( _segment ); +} + + +void uri::pop_front() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + uri_.pop_front(); +} + + +void uri::pop_back() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + uri_.pop_back(); +} + + +size_t uri::size() const +{ + return( uri_.size() ); +} + + +const std::string uri::build_uri() const +{ + std::stringstream uri; + + SX_FOR( const std::string& uri_element, uri_ ) + { + uri << URI_DELIMITER << uri_element; + } + + return( uri.str() ); +} + + +void uri::split_string_to_uri_segments( const std::string& _uri ) +{ + std::string uri = _uri; + if( !_uri.empty() ) + { + if( URI_DELIMITER == _uri[ 0 ] ) + { + uri = _uri.substr( 1 ); + } + + std::string::size_type start = 0; + std::string::size_type end = uri.find( URI_DELIMITER ); + while( end != std::string::npos ) + { + const std::string& segment = uri.substr( start, end - start ); + uri_.push_back( segment ); + start = ++end; + end = uri.find( URI_DELIMITER, end ); + } + + const std::string& last_segment = uri.substr( start ); + if( last_segment[ 0 ] != URI_DELIMITER ) + { + uri_.push_back( last_segment ); + } + } +} + + +} diff --git a/externals/genesis/CMakeLists.txt b/externals/genesis/CMakeLists.txt new file mode 100644 index 0000000..22e3cd6 --- /dev/null +++ b/externals/genesis/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) + +project(genesis) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +add_subdirectory(source) diff --git a/externals/genesis/changelog.txt b/externals/genesis/changelog.txt new file mode 100644 index 0000000..8a07204 --- /dev/null +++ b/externals/genesis/changelog.txt @@ -0,0 +1,16 @@ +# Change log +All notable changes to this project are documented in this file. + +##[0.2.0] - 2017-09-20 + +### Added +• Support for Visual Studio 2017 builds + +### Changed +• rename: condition_block's private method check_modifier to apply_modifier +• method create_child of the class recipe_block is now pro + + +##[0.1.0] - 2017-04-21 + +• The very first release version of genesis diff --git a/genesis/license/genesis_Anhang_Appendix_20170406.pdf b/externals/genesis/license/genesis_Anhang_Appendix_20170406.pdf similarity index 100% rename from genesis/license/genesis_Anhang_Appendix_20170406.pdf rename to externals/genesis/license/genesis_Anhang_Appendix_20170406.pdf diff --git a/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf b/externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf similarity index 100% rename from genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf rename to externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf diff --git a/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf b/externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf similarity index 100% rename from genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf rename to externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf diff --git a/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf b/externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf similarity index 100% rename from genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf rename to externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf diff --git a/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf b/externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf similarity index 100% rename from genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf rename to externals/genesis/license/genesis_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf diff --git a/externals/genesis/source/CMakeHelpers/addBoost.cmake b/externals/genesis/source/CMakeHelpers/addBoost.cmake new file mode 100644 index 0000000..d833dc1 --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/addBoost.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(Y_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${Y_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${Y_BOOST_LIB_INCLUDE}) + set(SX_BOOST_LIB_PATH ${Y_BOOST_LIB_PATH}) + set(SX_BOOST_LIB_INCLUDE ${Y_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("Y_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") +elseif(SX_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${SX_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${SX_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("SX_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + +else() + message("SX_BOOST_LIB_INCLUDE is not set by user. Searching for boost libraries.") + set(Boost_USE_MULTITHREADED ON) + find_package(Boost COMPONENTS date_time filesystem system program_options chrono thread random unit_test_framework) + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + message("Boost found.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + else() + message(STATUS "Boost libraries not found!") + endif() +endif() diff --git a/externals/genesis/source/CMakeHelpers/addSeadexOptions.cmake b/externals/genesis/source/CMakeHelpers/addSeadexOptions.cmake new file mode 100644 index 0000000..48bd9c6 --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/addSeadexOptions.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +# Seadex preprocessor definitions + + +option("SX_NO_LOGGING" "Use when you want to use no logging at all (no logging code is created).") +if( "${SX_NO_LOGGING}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_LOGGING\"") + message(STATUS "No logging used.") +else() + message(STATUS "Logger is used.") +endif() + + +option("SX_NO_STD_MAKE_UNIQUE" "When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then.") +if( "${SX_NO_STD_MAKE_UNIQUE}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_STD_MAKE_UNIQUE\"") + message(STATUS "SX_NO_STD_MAKE_UNIQUE is defined.") +endif() + + +option("SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG" "Sets to use a workaround for bug in GCC with expansion of template parameter pack that appears in a lambda-expression (bug reported for GCC 4.8.4)") +if( "${SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG}" ) + set(extra_flags "${extra_flags} -D \"SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG\"") + message(STATUS "SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG is defined.") +endif() \ No newline at end of file diff --git a/externals/genesis/source/CMakeHelpers/addSpecificFlags.cmake b/externals/genesis/source/CMakeHelpers/addSpecificFlags.cmake new file mode 100644 index 0000000..b568fbb --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/addSpecificFlags.cmake @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +add_compiler_flag("-Wall") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +#gcc/clang compiler flags + if(NOT "SX_PEDANTIC" STREQUAL "OFF") + add_compiler_flag("-pedantic") + endif() + + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_compiler_flag("-g") + endif() + + if("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++03") + add_compiler_flag("-D \"SX_CPP03_BOOST\"") + add_compiler_flag("-D \"SX_NO_VARIADIC_MACRO\"") + elseif("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++14") + else() + add_compiler_flag("-std=c++11") + add_compiler_flag("-D \"SX_NO_STD_MAKE_UNIQUE\"") + endif() + +# platform + if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) + add_compiler_flag("-m64") + message(STATUS "setting platform x64") + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") + add_compiler_flag("-m32") + message(STATUS "setting platform x86") + endif() +endif() + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Checks buffer security. + set(extra_flags "${extra_flags} /GS") + + #Sets output warning level. + set(extra_flags "${extra_flags} /W4") + + #Disable specific Warnings. + set(extra_flags "${extra_flags} /wd\"4127\" /wd\"4250\"") + + #Defines constants and macros. + set(extra_flags "${extra_flags} /D \"_CRT_SECURE_NO_WARNINGS\"") + + #Enables function-level linking. + set(extra_flags "${extra_flags} /Gy") + + #Specifies standard behaviour under /Ze. + set(extra_flags "${extra_flags} /Zc:wchar_t /Zc:inline") + + #Disable minimal rebuild. + set(extra_flags "${extra_flags} /Gm-") + + #Enables additional security features and warnings. + set(extra_flags "${extra_flags} /sdl") + + #Specifies floating-point behaviour. + set(extra_flags "${extra_flags} /fp:precise") + + #Multibyte character sets macro. + set(extra_flags "${extra_flags} /D \"_MBCS\"") + + #Enables you to provide internal compiler error (ICE) information directly to the Visual C++ team. + set(extra_flags "${extra_flags} /errorReport:prompt") + + #Treats warnings as errors. + if( "${MSVC_VERSION}" STRGREATER "1800" ) + set(extra_flags "${extra_flags} /WX") + #else( "${MSVC_VERSION}" STRLESS "1900" ) + else() + set(extra_flags "${extra_flags} /WX-") + endif() + + + #Generates intrinsic functions. + set(extra_flags "${extra_flags} /Oi") + + #Specifies the model of exception handling. + set(extra_flags "${extra_flags} /EHsc") + + #Creates an object file. + set(extra_flags "${extra_flags} /Fo") + + #Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. + #set(extra_flags "${extra_flags} /NXCOMPAT") + + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() + +endif() \ No newline at end of file diff --git a/externals/genesis/source/CMakeHelpers/addYasmineOptions.cmake b/externals/genesis/source/CMakeHelpers/addYasmineOptions.cmake new file mode 100644 index 0000000..7964d92 --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/addYasmineOptions.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +include("${CMAKE_CURRENT_LIST_DIR}/addSeadexOptions.cmake") + +# yasmine's preprocessor definitions + + +set(Y_OPTIMIZE "SPEED" CACHE STRING "Sets the optimize type. Supported values: SPEED and SIZE. Default value is SPEED.") +if( "${Y_OPTIMIZE}" STREQUAL "SIZE" ) + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SIZE\"") + message(STATUS "Optimizing for size.") +else() + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SPEED\"") + message(STATUS "Optimizing for speed.") +endif() + + +option("Y_LEAN_AND_MEAN" "If you compile the library with Y_LEAN_AND_MEAN being defined or if you define the macro locally before including yasmine.hpp, all the state pseudostates and the asynchronous simple state (with the asynchronous behaviour) are excluded (i.e. those headers are not included). This can reduce compile time.") +if( "${Y_LEAN_AND_MEAN}" ) + set(extra_flags "${extra_flags} -D \"Y_LEAN_AND_MEAN\"") + message(STATUS "Y_LEAN_AND_MEAN is defined.") +endif() + +option("Y_PROFILER" "If Y_PROFILER is defined, the state machine will count the number of events that were processed. The user can query the counter by calling the 'get_number_of_processed_events' method.") +if( "${Y_PROFILER}" ) + set(extra_flags "${extra_flags} -D \"Y_PROFILER\"") + message(STATUS "Y_PROFILER is defined.") +endif() + diff --git a/externals/genesis/source/CMakeHelpers/functions.cmake b/externals/genesis/source/CMakeHelpers/functions.cmake new file mode 100644 index 0000000..3a76857 --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/functions.cmake @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +function(use_pthread varName) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(${varName} ${${varName}} pthread PARENT_SCOPE) + endif() +endfunction() + + +function(use_boost_libraries varName) + set(${varName} ${${varName}} ${Boost_LIBRARIES} PARENT_SCOPE) +endfunction() + + +function(add_library_for_linking varName libraryName) + set(${varName} ${${varName}} ${libraryName} PARENT_SCOPE) +endfunction() diff --git a/externals/genesis/source/CMakeHelpers/functionsAddCompilerFlags.cmake b/externals/genesis/source/CMakeHelpers/functionsAddCompilerFlags.cmake new file mode 100644 index 0000000..105747b --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/functionsAddCompilerFlags.cmake @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +include(CheckCXXCompilerFlag) + + +function(add_compiler_flag varFlag) + string(FIND "${CMAKE_CXX_FLAGS}" "${varFlag}" flag_already_set) + if(flag_already_set EQUAL -1) + check_cxx_compiler_flag("${varFlag}" flag_supported) + if(flag_supported) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${varFlag}" PARENT_SCOPE) + endif() + unset(flag_supported CACHE) + endif() +endfunction() diff --git a/externals/genesis/source/CMakeHelpers/functionsRapidJSON.cmake b/externals/genesis/source/CMakeHelpers/functionsRapidJSON.cmake new file mode 100644 index 0000000..c638987 --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/functionsRapidJSON.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +function(use_rapid_JSON) +if(SX_RAPIDJSON) + message("SX_RAPIDJSON is set by user.") +else() + message("SX_RAPIDJSON is not set by user. Setting default value.") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + find_package(RapidJSON) + if(NOT ("${RAPIDJSON_INCLUDE_DIRS}" STREQUAL "")) + set(SX_RAPIDJSON ${RAPIDJSON_INCLUDE_DIRS}) + message(STATUS "Found rapidjson on: ${RAPIDJSON_INCLUDE_DIRS}") + else() + set(SX_RAPIDJSON /usr/include) + message(STATUS "Set default value for rapidjson") + endif() + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(SX_RAPIDJSON "C:\\Program Files") + endif() +endif() + +include_directories(${SX_RAPIDJSON}) + +message(STATUS "include rapidJSON from: ${SX_RAPIDJSON}") + +endfunction() diff --git a/externals/genesis/source/CMakeHelpers/setVariables.cmake b/externals/genesis/source/CMakeHelpers/setVariables.cmake new file mode 100644 index 0000000..a6f1454 --- /dev/null +++ b/externals/genesis/source/CMakeHelpers/setVariables.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +if(("${Y_STATIC}" STREQUAL "ON") OR ("${SX_STATIC}" STREQUAL "ON")) + set(LINK_TYPE "STATIC") +else() + set(LINK_TYPE "SHARED") +endif() diff --git a/externals/genesis/source/CMakeLists.txt b/externals/genesis/source/CMakeLists.txt new file mode 100644 index 0000000..dfea8c3 --- /dev/null +++ b/externals/genesis/source/CMakeLists.txt @@ -0,0 +1,14 @@ + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +include(./CMakeHelpers/setVariables.cmake) + +include(./CMakeHelpers/addBoost.cmake) +include(./CMakeHelpers/functions.cmake) +include(./CMakeHelpers/functionsAddCompilerFlags.cmake) + +add_subdirectory(externals) +add_subdirectory(genesis) +add_subdirectory(examples) \ No newline at end of file diff --git a/externals/genesis/source/build/debug_info.props b/externals/genesis/source/build/debug_info.props new file mode 100644 index 0000000..5dc702b --- /dev/null +++ b/externals/genesis/source/build/debug_info.props @@ -0,0 +1,18 @@ + + + + + + + + + NotSet + true + + + EditAndContinue + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + + \ No newline at end of file diff --git a/externals/genesis/source/build/genesis.props b/externals/genesis/source/build/genesis.props new file mode 100644 index 0000000..8bdf813 --- /dev/null +++ b/externals/genesis/source/build/genesis.props @@ -0,0 +1,31 @@ + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Level4 + 4127;4250 + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + None + false + true + include;%(AdditionalIncludeDirectories) + /D "_STL_WARNING_LEVEL=3" %(AdditionalOptions) + + + + + + No + Default + + + false + + + + \ No newline at end of file diff --git a/externals/genesis/source/build/use_boost.props b/externals/genesis/source/build/use_boost.props new file mode 100644 index 0000000..5ed78c1 --- /dev/null +++ b/externals/genesis/source/build/use_boost.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/genesis/source/build/use_boost_externals.props b/externals/genesis/source/build/use_boost_externals.props new file mode 100644 index 0000000..984d966 --- /dev/null +++ b/externals/genesis/source/build/use_boost_externals.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\..\..\..\..\3rd party\boost\Content\boost_1_65_1 + ..\..\..\..\..\..\..\3rd party\boost\Content\boost_1_65_1\stage\$(PlatformToolsetVersion)\$(Platform)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/genesis/source/build/use_essentials.props b/externals/genesis/source/build/use_essentials.props new file mode 100644 index 0000000..3d7318c --- /dev/null +++ b/externals/genesis/source/build/use_essentials.props @@ -0,0 +1,18 @@ + + + + + + + + ..\externals\essentials\source\essentials\include;%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/externals/genesis/source/build/use_essentials_examples.props b/externals/genesis/source/build/use_essentials_examples.props new file mode 100644 index 0000000..79e9790 --- /dev/null +++ b/externals/genesis/source/build/use_essentials_examples.props @@ -0,0 +1,18 @@ + + + + + + + + None + ..\..\externals\essentials\source\essentials\include;%(AdditionalIncludeDirectories) + + + + $(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/externals/genesis/source/build/use_genesis.props b/externals/genesis/source/build/use_genesis.props new file mode 100644 index 0000000..28d1639 --- /dev/null +++ b/externals/genesis/source/build/use_genesis.props @@ -0,0 +1,18 @@ + + + + + + + + ..\genesis\include;%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + genesis.lib;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/externals/genesis/source/build/use_genesis_examples.props b/externals/genesis/source/build/use_genesis_examples.props new file mode 100644 index 0000000..f6c5405 --- /dev/null +++ b/externals/genesis/source/build/use_genesis_examples.props @@ -0,0 +1,18 @@ + + + + + + + + ..\..\genesis\include;%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + genesis.lib;%(AdditionalDependencies) + + + + \ No newline at end of file diff --git a/externals/genesis/source/build/vs2013.props b/externals/genesis/source/build/vs2013.props new file mode 100644 index 0000000..493cc29 --- /dev/null +++ b/externals/genesis/source/build/vs2013.props @@ -0,0 +1,16 @@ + + + + + + + + false + SX_CPP03_BOOST;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + true + + + + \ No newline at end of file diff --git a/externals/genesis/source/build/yasmine_clang.props b/externals/genesis/source/build/yasmine_clang.props new file mode 100644 index 0000000..00c3f9d --- /dev/null +++ b/externals/genesis/source/build/yasmine_clang.props @@ -0,0 +1,26 @@ + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + c11 + + + + + c++1y + true + Enabled + true + NDEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableAllWarnings + FullDebug + + + + + \ No newline at end of file diff --git a/externals/genesis/source/examples/CMakeLists.txt b/externals/genesis/source/examples/CMakeLists.txt new file mode 100644 index 0000000..259403a --- /dev/null +++ b/externals/genesis/source/examples/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(html_page_generator) \ No newline at end of file diff --git a/externals/genesis/source/examples/html_page_generator/CMakeLists.txt b/externals/genesis/source/examples/html_page_generator/CMakeLists.txt new file mode 100644 index 0000000..e8d9dfe --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 2.8) + +project(html_page_generator) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +file(GLOB html_page_generator_SRC "./*.hpp" "./*.cpp") + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +include(./../../CMakeHelpers/addSpecificFlags.cmake) +include(./../../CMakeHelpers/addSeadexOptions.cmake) + +include_directories("./../../externals/essentials/source/essentials/include") +include_directories("./../../genesis/include") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") + +add_executable(html_page_generator ${html_page_generator_SRC}) + +set(link_libraries_list "") +use_boost_libraries(link_libraries_list) +add_library_for_linking(link_libraries_list libgenesis) +use_pthread(link_libraries_list) +message(STATUS "html_page_generator linking to libraries: ${link_libraries_list}" ) + +target_link_libraries(html_page_generator LINK_PUBLIC ${link_libraries_list}) + +install(TARGETS html_page_generator DESTINATION bin) diff --git a/externals/genesis/source/examples/html_page_generator/city.hpp b/externals/genesis/source/examples/html_page_generator/city.hpp new file mode 100644 index 0000000..efabb34 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/city.hpp @@ -0,0 +1,32 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef CITY_0D8BFBB1_EA3F_46E9_B683_1E6FA5233166 +#define CITY_0D8BFBB1_EA3F_46E9_B683_1E6FA5233166 + + +#include + +// DONE remove cpp +namespace examples +{ + + +struct city +{ + std::string name_; + int population_; +}; + + + +} + + +#endif diff --git a/externals/genesis/source/examples/html_page_generator/config.cpp b/externals/genesis/source/examples/html_page_generator/config.cpp new file mode 100644 index 0000000..6b51789 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/config.cpp @@ -0,0 +1,146 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "config.hpp" + + +namespace examples +{ + + +// DONE variable names lower case +config::config() : + template_path_( "./templates" ), + source_template_file_ ("countries.gtpl"), + output_file_( "countries.html"), + countries_() +{ + city berlin; + berlin.name_ = "Berlin"; + berlin.population_ = 3275000; + + city hamburg; + hamburg.name_ = "Hamburg"; + hamburg.population_ = 1686100; + + city stuttgart; + stuttgart.name_ = "Stuttgart"; + stuttgart.population_ = 581100; + + city munich; + munich.name_ = "Munich"; + munich.population_ = 1185400; + + city frankfurt; + frankfurt.name_ = "Frankfurt"; + frankfurt.population_ = 648000; + + city dresden; + dresden.name_ = "Dresden"; + dresden.population_ = 473300; + + country germany; + germany.name_ = "Germany"; + germany.cities_.push_back( berlin ); + germany.cities_.push_back( hamburg ); + germany.cities_.push_back( stuttgart ); + germany.cities_.push_back( munich ); + germany.cities_.push_back( frankfurt ); + germany.cities_.push_back( dresden ); + germany.capital_index_ = 0; + + + city new_york; + new_york.name_ = "New York"; + new_york.population_ = 8550405; + + city los_angeles; + los_angeles.name_ = "Los Angeles"; + los_angeles.population_ = 3971883; + + city chicago; + chicago.name_ = "Chicago"; + chicago.population_ = 2720546; + + city houston; + houston.name_ = "Houston"; + houston.population_ = 2296224; + + city phoenix; + phoenix.name_ = "Phoenix"; + phoenix.population_ = 1563025; + + city austin; + austin.name_ = "Austin"; + austin.population_ = 931830; + + city san_francisco; + san_francisco.name_ = "San Francisco"; + san_francisco.population_ = 864816; + + city honolulu; + honolulu.name_ = "Honolulu"; + honolulu.population_ = 352769; + + city washington; + washington.name_ = "Washington"; + washington.population_ = 672228; + + country usa; + usa.name_ = "United States of America"; + usa.cities_.push_back( new_york ); + usa.cities_.push_back( los_angeles ); + usa.cities_.push_back( chicago ); + usa.cities_.push_back( washington ); + usa.cities_.push_back( houston ); + usa.cities_.push_back( phoenix ); + usa.cities_.push_back( austin ); + usa.cities_.push_back( san_francisco ); + usa.cities_.push_back( honolulu ); + usa.capital_index_ = 3; + + + city tokyo; + tokyo.name_ = "Tokyo"; + tokyo.population_ = 8637098; + + city yokohama; + yokohama.name_ = "Yokohama"; + yokohama.population_ = 3697894; + + city osaka; + osaka.name_ = "Osaka"; + osaka.population_ = 2668586; + + city sapporo; + sapporo.name_ = "Sapporo"; + sapporo.population_ = 1918096; + + city hiroshima; + hiroshima.name_ = "Hiroshima"; + hiroshima.population_ = 1163806; + + country japan; + japan.name_ = "Japan"; + japan.cities_.push_back( hiroshima ); + japan.cities_.push_back( sapporo ); + japan.cities_.push_back( osaka ); + japan.cities_.push_back( yokohama ); + japan.cities_.push_back( tokyo ); + japan.capital_index_ = 4; + + + countries_.push_back( germany ); + countries_.push_back( usa ); + countries_.push_back( japan ); +} + + +} diff --git a/externals/genesis/source/examples/html_page_generator/config.hpp b/externals/genesis/source/examples/html_page_generator/config.hpp new file mode 100644 index 0000000..5a9e4cd --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/config.hpp @@ -0,0 +1,36 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef CONFIG_F0DF6484_1AB7_48AC_9471_42C853B24430 +#define CONFIG_F0DF6484_1AB7_48AC_9471_42C853B24430 + + +#include "country.hpp" + + +namespace examples +{ + + +struct config +{ + config(); + + std::string template_path_; + std::string source_template_file_; + std::string output_file_; + std::vector countries_; +}; + + +} + + +#endif diff --git a/externals/genesis/source/examples/html_page_generator/country.hpp b/externals/genesis/source/examples/html_page_generator/country.hpp new file mode 100644 index 0000000..9b9fab0 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/country.hpp @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef COUNTRY_8520C99E_118A_4693_A3BB_D1268053EFEE +#define COUNTRY_8520C99E_118A_4693_A3BB_D1268053EFEE + +#include + +#include "city.hpp" + + +// DONE remove cpp +namespace examples +{ + + +struct country +{ + std::string name_; + std::vector cities_; + std::vector::size_type capital_index_; +}; + + + +} + + +#endif diff --git a/externals/genesis/source/examples/html_page_generator/html_generator_grammar.cpp b/externals/genesis/source/examples/html_page_generator/html_generator_grammar.cpp new file mode 100644 index 0000000..307cfeb --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/html_generator_grammar.cpp @@ -0,0 +1,25 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "html_generator_grammar.hpp" + + +namespace examples +{ + + +const std::string CITY_NAME = "city_name"; +const std::string CITY_POPULATION = "city_population"; +const std::string COUNTRY_NAME = "country_name"; +const std::string LOOP_COUNTRIES = "countries"; +const std::string LOOP_CITIES = "cities"; +const std::string CONDITION_IS_CAPITAL = "is_capital"; + + +} diff --git a/externals/genesis/source/examples/html_page_generator/html_generator_grammar.hpp b/externals/genesis/source/examples/html_page_generator/html_generator_grammar.hpp new file mode 100644 index 0000000..de0ca8e --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/html_generator_grammar.hpp @@ -0,0 +1,34 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef HTML_GRAMMAR_C967B713_6A36_4E0E_92A7_DA61983141BC +#define HTML_GRAMMAR_C967B713_6A36_4E0E_92A7_DA61983141BC + + +// DONE html_grammar -> html_generator_grammar +#include + + +namespace examples +{ + + +extern const std::string CITY_NAME; +extern const std::string CITY_POPULATION; +extern const std::string COUNTRY_NAME; +extern const std::string LOOP_COUNTRIES; +extern const std::string LOOP_CITIES; +extern const std::string CONDITION_IS_CAPITAL; + + + +} + + +#endif diff --git a/externals/genesis/source/examples/html_page_generator/html_page_generator.vcxproj b/externals/genesis/source/examples/html_page_generator/html_page_generator.vcxproj new file mode 100644 index 0000000..abed0ba --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/html_page_generator.vcxproj @@ -0,0 +1,266 @@ + + + + + Debug - VS 2015 + Win32 + + + Debug - VS 2015 + x64 + + + Debug - VS 2017 + Win32 + + + Release - VS 2015 + Win32 + + + Release - VS 2015 + x64 + + + Release - VS 2017 + Win32 + + + Debug - VS 2017 + x64 + + + Release - VS 2017 + x64 + + + + {A4401298-EBE7-4861-AC15-E23071C4FCE5} + html_page_generator + 8.1 + + + + Application + true + v141 + MultiByte + + + Application + true + v140 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + false + v140 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + true + v140 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + false + v140 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + MaxSpeed + true + true + true + + + true + true + true + + + + + MaxSpeed + true + true + true + + + true + true + true + + + + + MaxSpeed + true + true + true + + + true + true + true + MachineX64 + + + + + MaxSpeed + true + true + true + + + true + true + true + MachineX64 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/externals/genesis/source/examples/html_page_generator/html_page_generator.vcxproj.filters b/externals/genesis/source/examples/html_page_generator/html_page_generator.vcxproj.filters new file mode 100644 index 0000000..25ffa48 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/html_page_generator.vcxproj.filters @@ -0,0 +1,48 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/externals/genesis/source/examples/html_page_generator/main.cpp b/externals/genesis/source/examples/html_page_generator/main.cpp new file mode 100644 index 0000000..e47fb64 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/main.cpp @@ -0,0 +1,51 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include + +#include "recipe.hpp" +#include "genesis_exception.hpp" +#include "recipe_callback_impl.hpp" + + +int main() +{ + int error = 0; + + try + { + examples::config configuration; + examples::recipe_callback_impl recipe_callback( configuration ); + std::cout << "Generating source file from the template '" << configuration.source_template_file_ << "'..." << std::endl; + sx::genesis::recipe source_recipe( configuration.source_template_file_, recipe_callback, configuration.template_path_ ); + source_recipe.generate(); + source_recipe.write_to_file( configuration.output_file_ ); + std::cout << "Finished. Output file '" << configuration.output_file_ << "'." << std::endl; + } + catch( const sx::genesis::genesis_exception& exception ) + { + error = 1; + // DONE add "Unhandled std::exception: " + std::cout << "Unhandled std::exception: " << exception.what() << std::endl; + } + catch( const std::exception& exception ) + { + error = 2; + // DONE add "Unhandled unknown exception: " + std::cout << "Unhandled unknown exception: " << exception.what() << std::endl; + } + catch( ... ) + { + error = 3; + std::cout << "Unknown error!" << std::endl; + } + + return ( error ); +} diff --git a/externals/genesis/source/examples/html_page_generator/recipe_callback_impl.cpp b/externals/genesis/source/examples/html_page_generator/recipe_callback_impl.cpp new file mode 100644 index 0000000..391bd64 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/recipe_callback_impl.cpp @@ -0,0 +1,186 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "recipe_callback_impl.hpp" + +#include "essentials/base.hpp" +#include "essentials/conversion.hpp" +#include "essentials/exception.hpp" + +#include "html_generator_grammar.hpp" + + +namespace examples +{ + recipe_callback_impl::recipe_callback_impl( const config& _config ) : + recipe_callback(), + config_( _config ), + country_index_( 0 ), + city_index_( 0 ) + // DONE odd indent + { + // Nothing to do... + } + + // DONE odd indent + recipe_callback_impl::~recipe_callback_impl() SX_NOEXCEPT + { + // Nothing to do... + } + + + std::string recipe_callback_impl::get_variable_content( const std::string& _variable_name ) + { + std::string result( "" ); + if( _variable_name == CITY_NAME ) + { + result = config_.countries_[country_index_].cities_[city_index_].name_; + } + else if( _variable_name == CITY_POPULATION ) + { + result = sxe::to_string( config_.countries_[country_index_].cities_[city_index_].population_ ); + } + else if( _variable_name == COUNTRY_NAME ) + { + result = config_.countries_[country_index_].name_; + } + return( result ); + } + + + // cppcheck-suppress unusedFunction + void recipe_callback_impl::before_loop( const std::string& _loop_name ) + { + if( _loop_name == LOOP_COUNTRIES ) + { + country_index_ = 0; + } + else if( _loop_name == LOOP_CITIES ) + { + city_index_ = 0; + } + } + + + // cppcheck-suppress unusedFunction + void recipe_callback_impl::before_loop_iteration( const std::string& _loop_name ) + { + SX_UNUSED_PARAMETER( _loop_name ); + } + + + // cppcheck-suppress unusedFunction + void recipe_callback_impl::after_loop_iteration( const std::string& _loop_name ) + { + if( _loop_name == LOOP_COUNTRIES ) + { + ++country_index_; + } + else if( _loop_name == LOOP_CITIES ) + { + ++city_index_; + } + } + + + // cppcheck-suppress unusedFunction + void recipe_callback_impl::after_loop( const std::string& _loop_name ) + { + SX_UNUSED_PARAMETER( _loop_name ); + } + + + // cppcheck-suppress unusedFunction + bool recipe_callback_impl::check_loop_condition( const std::string& _loop_name ) const + { + bool result = false; + + if( _loop_name == LOOP_COUNTRIES ) + { + result = country_index_ < config_.countries_.size(); + } + else if( _loop_name == LOOP_CITIES ) + { + result = city_index_ < config_.countries_[country_index_].cities_.size(); + } + + return( result ); + } + + + // cppcheck-suppress unusedFunction + bool recipe_callback_impl::check_condition( const std::string& _condition_name ) const + { + bool result = true; + + if( _condition_name == CONDITION_IS_CAPITAL ) + { + result = config_.countries_[country_index_].capital_index_ == city_index_; + } + + return( result ); + } + + + // cppcheck-suppress unusedFunction + void recipe_callback_impl::condition_begin( const std::string& _condition_name ) + { + SX_UNUSED_PARAMETER( _condition_name ); + } + + + // cppcheck-suppress unusedFunction + void recipe_callback_impl::condition_end( const std::string& _condition_name ) + { + SX_UNUSED_PARAMETER( _condition_name ); + } + + + int recipe_callback_impl::get_switch_case( const std::string& _switch_name ) + { + int switch_case = -1; + if( _switch_name == "town_name" ) + { + const int population = config_.countries_[country_index_].cities_[city_index_].population_; + if( population > 10000000 ) + { + switch_case = 0; + } + else if(population > 3000000 ) + { + switch_case = 1; + } + else if( population > 1000000 ) + { + switch_case = 2; + } + else if( population > 300000 ) + { + switch_case = 3; + } + else if( population > 20000 ) + { + switch_case = 4; + } + else if( population > 1000 ) + { + switch_case = 5; + } + else if( population > 100 ) + { + switch_case = 6; + } + } + + return( switch_case ); + } + + +} diff --git a/externals/genesis/source/examples/html_page_generator/recipe_callback_impl.hpp b/externals/genesis/source/examples/html_page_generator/recipe_callback_impl.hpp new file mode 100644 index 0000000..3169a5a --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/recipe_callback_impl.hpp @@ -0,0 +1,52 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef RECIPE_CALLBACK_IMPL_D1209279_561E_435D_B6DC_68F2A50937C2 +#define RECIPE_CALLBACK_IMPL_D1209279_561E_435D_B6DC_68F2A50937C2 + + +#include "recipe_callback.hpp" + +#include "config.hpp" + + +namespace examples +{ + + +class recipe_callback_impl SX_FINAL + : public sx::genesis::recipe_callback +{ +public: + explicit recipe_callback_impl( const config& _config ); + virtual ~recipe_callback_impl() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( recipe_callback_impl ) + virtual std::string get_variable_content( const std::string& _variable_name ) SX_OVERRIDE; + virtual void before_loop( const std::string& _loop_name ) SX_OVERRIDE; + virtual void before_loop_iteration( const std::string& _loop_name ) SX_OVERRIDE; + virtual void after_loop_iteration( const std::string& _loop_name ) SX_OVERRIDE; + virtual bool check_loop_condition( const std::string& _loop_name ) const SX_OVERRIDE; + virtual void after_loop( const std::string& _loop_name ) SX_OVERRIDE; + virtual bool check_condition( const std::string& _condition_name ) const SX_OVERRIDE; + virtual void condition_begin( const std::string& _condition_name ) SX_OVERRIDE; + virtual void condition_end( const std::string& _condition_name ) SX_OVERRIDE; + virtual int get_switch_case( const std::string& _switch_name ) SX_OVERRIDE; + + +private: + const config& config_; + std::size_t country_index_; + std::size_t city_index_; +}; + + +} + + +#endif diff --git a/externals/genesis/source/examples/html_page_generator/templates/city_type.gtpl b/externals/genesis/source/examples/html_page_generator/templates/city_type.gtpl new file mode 100644 index 0000000..33a320e --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/templates/city_type.gtpl @@ -0,0 +1,10 @@ +$switch(town_name) +$case(0)

Megalopolis - a group of conurbations, consisting of more than ten million people each.

$esac +$case(1)

Conurbation - a group of large cities and their suburbs, consisting of three to ten million people.

$esac +$case(2)

Metropolis - a large city and its suburbs consisting of multiple cities and towns. The population is usually one to three million.

$esac +$case(3)

Large city - a city with a large population and many services. The population is <1 million people but over 300,000 people.

$esac +$case(4)

Large town - a large town has a population of 20,000 to 100,000.

$esac +$case(5)

Town - a town has a population of 1,000 to 20,000.

$esac +$case(6)

Village - a village is a human settlement or community smaller than a town. The population of a village varies however, the average population can range from hundreds to thousands.

$esac +$default()

Undefined.

$tluafed +$hctiws diff --git a/externals/genesis/source/examples/html_page_generator/templates/countries.gtpl b/externals/genesis/source/examples/html_page_generator/templates/countries.gtpl new file mode 100644 index 0000000..281efb2 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/templates/countries.gtpl @@ -0,0 +1,47 @@ + + + + + +Population of big cities + + + + +

Population of big cities.

+

List of countries:

+

*The capital is marked bold and blue

+$loop(countries) +

$var(country_name)

+$template(country_table.gtpl) +
+$pool + + + \ No newline at end of file diff --git a/externals/genesis/source/examples/html_page_generator/templates/country_table.gtpl b/externals/genesis/source/examples/html_page_generator/templates/country_table.gtpl new file mode 100644 index 0000000..8f092f4 --- /dev/null +++ b/externals/genesis/source/examples/html_page_generator/templates/country_table.gtpl @@ -0,0 +1,14 @@ + + + + + + + $loop(cities) + + + + + + $pool +
CityPopulation
$if(is_capital)

$fi$var(city_name)$if(is_capital)

$fi
$if(is_capital)

$fi$var(city_population)$if(is_capital)

$fi
$if(is_capital)

$fi$template(city_type.gtpl)$if(is_capital)

$fi
\ No newline at end of file diff --git a/externals/genesis/source/externals/CMakeLists.txt b/externals/genesis/source/externals/CMakeLists.txt new file mode 100644 index 0000000..e095099 --- /dev/null +++ b/externals/genesis/source/externals/CMakeLists.txt @@ -0,0 +1,11 @@ +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (NOT TARGET libessentials) + message(STATUS "essentuals was not build before. It is build now.") + add_subdirectory(essentials) + endif() +else() + if (NOT TARGET essentials) + message(STATUS "essentuals was not build before. It is build now.") + add_subdirectory(essentials) + endif() +endif() diff --git a/externals/genesis/source/externals/essentials/CMakeLists.txt b/externals/genesis/source/externals/essentials/CMakeLists.txt new file mode 100644 index 0000000..097f692 --- /dev/null +++ b/externals/genesis/source/externals/essentials/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) + +project(essentials) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +add_subdirectory(source) diff --git a/externals/genesis/source/externals/essentials/license/essentials_Anhang_Appendix_20170406.pdf b/externals/genesis/source/externals/essentials/license/essentials_Anhang_Appendix_20170406.pdf new file mode 100644 index 0000000..e6c6650 Binary files /dev/null and b/externals/genesis/source/externals/essentials/license/essentials_Anhang_Appendix_20170406.pdf differ diff --git a/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf new file mode 100644 index 0000000..1cdf2ed Binary files /dev/null and b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf differ diff --git a/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf new file mode 100644 index 0000000..037bf28 Binary files /dev/null and b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf differ diff --git a/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf new file mode 100644 index 0000000..0ba7c9e Binary files /dev/null and b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf differ diff --git a/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf new file mode 100644 index 0000000..90989c4 Binary files /dev/null and b/externals/genesis/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf differ diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/addBoost.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addBoost.cmake new file mode 100644 index 0000000..d833dc1 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addBoost.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(Y_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${Y_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${Y_BOOST_LIB_INCLUDE}) + set(SX_BOOST_LIB_PATH ${Y_BOOST_LIB_PATH}) + set(SX_BOOST_LIB_INCLUDE ${Y_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("Y_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") +elseif(SX_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${SX_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${SX_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("SX_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + +else() + message("SX_BOOST_LIB_INCLUDE is not set by user. Searching for boost libraries.") + set(Boost_USE_MULTITHREADED ON) + find_package(Boost COMPONENTS date_time filesystem system program_options chrono thread random unit_test_framework) + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + message("Boost found.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + else() + message(STATUS "Boost libraries not found!") + endif() +endif() diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake new file mode 100644 index 0000000..48bd9c6 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +# Seadex preprocessor definitions + + +option("SX_NO_LOGGING" "Use when you want to use no logging at all (no logging code is created).") +if( "${SX_NO_LOGGING}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_LOGGING\"") + message(STATUS "No logging used.") +else() + message(STATUS "Logger is used.") +endif() + + +option("SX_NO_STD_MAKE_UNIQUE" "When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then.") +if( "${SX_NO_STD_MAKE_UNIQUE}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_STD_MAKE_UNIQUE\"") + message(STATUS "SX_NO_STD_MAKE_UNIQUE is defined.") +endif() + + +option("SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG" "Sets to use a workaround for bug in GCC with expansion of template parameter pack that appears in a lambda-expression (bug reported for GCC 4.8.4)") +if( "${SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG}" ) + set(extra_flags "${extra_flags} -D \"SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG\"") + message(STATUS "SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG is defined.") +endif() \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake new file mode 100644 index 0000000..b568fbb --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +add_compiler_flag("-Wall") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +#gcc/clang compiler flags + if(NOT "SX_PEDANTIC" STREQUAL "OFF") + add_compiler_flag("-pedantic") + endif() + + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_compiler_flag("-g") + endif() + + if("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++03") + add_compiler_flag("-D \"SX_CPP03_BOOST\"") + add_compiler_flag("-D \"SX_NO_VARIADIC_MACRO\"") + elseif("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++14") + else() + add_compiler_flag("-std=c++11") + add_compiler_flag("-D \"SX_NO_STD_MAKE_UNIQUE\"") + endif() + +# platform + if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) + add_compiler_flag("-m64") + message(STATUS "setting platform x64") + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") + add_compiler_flag("-m32") + message(STATUS "setting platform x86") + endif() +endif() + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Checks buffer security. + set(extra_flags "${extra_flags} /GS") + + #Sets output warning level. + set(extra_flags "${extra_flags} /W4") + + #Disable specific Warnings. + set(extra_flags "${extra_flags} /wd\"4127\" /wd\"4250\"") + + #Defines constants and macros. + set(extra_flags "${extra_flags} /D \"_CRT_SECURE_NO_WARNINGS\"") + + #Enables function-level linking. + set(extra_flags "${extra_flags} /Gy") + + #Specifies standard behaviour under /Ze. + set(extra_flags "${extra_flags} /Zc:wchar_t /Zc:inline") + + #Disable minimal rebuild. + set(extra_flags "${extra_flags} /Gm-") + + #Enables additional security features and warnings. + set(extra_flags "${extra_flags} /sdl") + + #Specifies floating-point behaviour. + set(extra_flags "${extra_flags} /fp:precise") + + #Multibyte character sets macro. + set(extra_flags "${extra_flags} /D \"_MBCS\"") + + #Enables you to provide internal compiler error (ICE) information directly to the Visual C++ team. + set(extra_flags "${extra_flags} /errorReport:prompt") + + #Treats warnings as errors. + if( "${MSVC_VERSION}" STRGREATER "1800" ) + set(extra_flags "${extra_flags} /WX") + #else( "${MSVC_VERSION}" STRLESS "1900" ) + else() + set(extra_flags "${extra_flags} /WX-") + endif() + + + #Generates intrinsic functions. + set(extra_flags "${extra_flags} /Oi") + + #Specifies the model of exception handling. + set(extra_flags "${extra_flags} /EHsc") + + #Creates an object file. + set(extra_flags "${extra_flags} /Fo") + + #Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. + #set(extra_flags "${extra_flags} /NXCOMPAT") + + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() + +endif() \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake new file mode 100644 index 0000000..7964d92 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +include("${CMAKE_CURRENT_LIST_DIR}/addSeadexOptions.cmake") + +# yasmine's preprocessor definitions + + +set(Y_OPTIMIZE "SPEED" CACHE STRING "Sets the optimize type. Supported values: SPEED and SIZE. Default value is SPEED.") +if( "${Y_OPTIMIZE}" STREQUAL "SIZE" ) + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SIZE\"") + message(STATUS "Optimizing for size.") +else() + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SPEED\"") + message(STATUS "Optimizing for speed.") +endif() + + +option("Y_LEAN_AND_MEAN" "If you compile the library with Y_LEAN_AND_MEAN being defined or if you define the macro locally before including yasmine.hpp, all the state pseudostates and the asynchronous simple state (with the asynchronous behaviour) are excluded (i.e. those headers are not included). This can reduce compile time.") +if( "${Y_LEAN_AND_MEAN}" ) + set(extra_flags "${extra_flags} -D \"Y_LEAN_AND_MEAN\"") + message(STATUS "Y_LEAN_AND_MEAN is defined.") +endif() + +option("Y_PROFILER" "If Y_PROFILER is defined, the state machine will count the number of events that were processed. The user can query the counter by calling the 'get_number_of_processed_events' method.") +if( "${Y_PROFILER}" ) + set(extra_flags "${extra_flags} -D \"Y_PROFILER\"") + message(STATUS "Y_PROFILER is defined.") +endif() + diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/functions.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/functions.cmake new file mode 100644 index 0000000..3a76857 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/functions.cmake @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +function(use_pthread varName) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(${varName} ${${varName}} pthread PARENT_SCOPE) + endif() +endfunction() + + +function(use_boost_libraries varName) + set(${varName} ${${varName}} ${Boost_LIBRARIES} PARENT_SCOPE) +endfunction() + + +function(add_library_for_linking varName libraryName) + set(${varName} ${${varName}} ${libraryName} PARENT_SCOPE) +endfunction() diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake new file mode 100644 index 0000000..105747b --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +include(CheckCXXCompilerFlag) + + +function(add_compiler_flag varFlag) + string(FIND "${CMAKE_CXX_FLAGS}" "${varFlag}" flag_already_set) + if(flag_already_set EQUAL -1) + check_cxx_compiler_flag("${varFlag}" flag_supported) + if(flag_supported) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${varFlag}" PARENT_SCOPE) + endif() + unset(flag_supported CACHE) + endif() +endfunction() diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake new file mode 100644 index 0000000..c638987 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +function(use_rapid_JSON) +if(SX_RAPIDJSON) + message("SX_RAPIDJSON is set by user.") +else() + message("SX_RAPIDJSON is not set by user. Setting default value.") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + find_package(RapidJSON) + if(NOT ("${RAPIDJSON_INCLUDE_DIRS}" STREQUAL "")) + set(SX_RAPIDJSON ${RAPIDJSON_INCLUDE_DIRS}) + message(STATUS "Found rapidjson on: ${RAPIDJSON_INCLUDE_DIRS}") + else() + set(SX_RAPIDJSON /usr/include) + message(STATUS "Set default value for rapidjson") + endif() + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(SX_RAPIDJSON "C:\\Program Files") + endif() +endif() + +include_directories(${SX_RAPIDJSON}) + +message(STATUS "include rapidJSON from: ${SX_RAPIDJSON}") + +endfunction() diff --git a/externals/genesis/source/externals/essentials/source/CMakeHelpers/setVariables.cmake b/externals/genesis/source/externals/essentials/source/CMakeHelpers/setVariables.cmake new file mode 100644 index 0000000..a6f1454 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeHelpers/setVariables.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +if(("${Y_STATIC}" STREQUAL "ON") OR ("${SX_STATIC}" STREQUAL "ON")) + set(LINK_TYPE "STATIC") +else() + set(LINK_TYPE "SHARED") +endif() diff --git a/externals/genesis/source/externals/essentials/source/CMakeLists.txt b/externals/genesis/source/externals/essentials/source/CMakeLists.txt new file mode 100644 index 0000000..daef5a2 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/CMakeLists.txt @@ -0,0 +1,16 @@ + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +include(./CMakeHelpers/setVariables.cmake) + +include(./CMakeHelpers/addBoost.cmake) +include(./CMakeHelpers/functions.cmake) +include(./CMakeHelpers/functionsAddCompilerFlags.cmake) + +add_subdirectory(essentials) + +if(EXISTS essentials_unit_tests) +add_subdirectory(essentials_unit_tests) +endif() diff --git a/externals/genesis/source/externals/essentials/source/build/c++03.props b/externals/genesis/source/externals/essentials/source/build/c++03.props new file mode 100644 index 0000000..d76c9b5 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/c++03.props @@ -0,0 +1,31 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + <_PropertySheetDisplayName>c++03 + + + + SX_NO_VARIADIC_MACRO;SX_CPP03_BOOST;BOOST_SP_USE_STD_ATOMIC;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + $(BOOST_PATH);%(AdditionalIncludeDirectories) + + + + $(BOOST_LIB_PATH);$(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/build/debug_info.props b/externals/genesis/source/externals/essentials/source/build/debug_info.props new file mode 100644 index 0000000..5dc702b --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/debug_info.props @@ -0,0 +1,18 @@ + + + + + + + + + NotSet + true + + + EditAndContinue + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/build/essentials.props b/externals/genesis/source/externals/essentials/source/build/essentials.props new file mode 100644 index 0000000..8bdf813 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/essentials.props @@ -0,0 +1,31 @@ + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Level4 + 4127;4250 + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + None + false + true + include;%(AdditionalIncludeDirectories) + /D "_STL_WARNING_LEVEL=3" %(AdditionalOptions) + + + + + + No + Default + + + false + + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/build/use_boost.props b/externals/genesis/source/externals/essentials/source/build/use_boost.props new file mode 100644 index 0000000..85fdae4 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/use_boost.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/build/use_boost_as_external.props b/externals/genesis/source/externals/essentials/source/build/use_boost_as_external.props new file mode 100644 index 0000000..cdd4e52 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/use_boost_as_external.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/build/use_boost_externals.props b/externals/genesis/source/externals/essentials/source/build/use_boost_externals.props new file mode 100644 index 0000000..27f07b7 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/use_boost_externals.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/build/use_essentials.props b/externals/genesis/source/externals/essentials/source/build/use_essentials.props new file mode 100644 index 0000000..9f7bfc9 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/use_essentials.props @@ -0,0 +1,32 @@ + + + + + ..\..\..\essentials\source\essentials\include + ..\..\..\essentials\source\essentials\include\compatibility + ..\..\..\essentials\source\$(Platform)\$(Configuration) + + + + + $(ESSENTIALS_INCLUDE_PATH);$(ESSENTIALS_COMPATIBILITY_PATH);%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);$(ESSENTIALS_LIB_PATH);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + + $(ESSENTIALS_INCLUDE_PATH) + + + $(ESSENTIALS_COMPATIBILITY_PATH) + + + $(ESSENTIALS_LIB_PATH) + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/build/use_essentials_base.props b/externals/genesis/source/externals/essentials/source/build/use_essentials_base.props new file mode 100644 index 0000000..7f85a09 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/build/use_essentials_base.props @@ -0,0 +1,28 @@ + + + + + ..\essentials\include + ..\$(Platform)\$(Configuration) + + + + + $(ESSENTIALS_INCLUDE_PATH);$(ESSENTIALS_COMPATIBILITY_PATH);%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);$(ESSENTIALS_LIB_PATH);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + + $(ESSENTIALS_INCLUDE_PATH) + + + $(ESSENTIALS_LIB_PATH) + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/changelog.txt b/externals/genesis/source/externals/essentials/source/changelog.txt new file mode 100644 index 0000000..d1a6a27 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/changelog.txt @@ -0,0 +1,38 @@ +# Change log +All notable changes to this project are documented in this file. + +##[1.3.2] - 2017-12-18 + +### Added +• SX_UNUSED_VARIABLE macro for suppressing warnings for unreferenced variable. +• backward compatibility for macros Y_NO_STD_MAKE_UNIQUE, Y_CPP03_BOOST, Y_UNIQUE_PTR, Y_MAKE_UNIQUE, Y_MAKE_SHARED, Y_UNUSED_PARAMETER + +### Changed +• CMake: use external CMakeHelpers files +• CMake: refactoring of build scripts + +### Fixed +• missing boost namespace in sxprintf + + +##[1.1.0] - 2017-09-20 + +### Added +• Support for Visual Studio 2017 builds +• conversion functions: to_lower and to_upper +• added uri class + + +##[1.0.1] - 2017-04-07 + +### Changed +• macro helpers improved to count up to 15 parameters +• essentials file structure refactoring. All source files are now located in the 'source' folder, the header files for compatibility +are located in the 'include/essentials/compatibility' folder and other header files are located in the 'include/essentials' folder. + + +##[1.0.0] - 2017-03-30 + +• The very first released version of essentials + + diff --git a/externals/genesis/source/externals/essentials/source/essentials.sln b/externals/genesis/source/externals/essentials/source/essentials.sln new file mode 100644 index 0000000..c96fe08 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials.sln @@ -0,0 +1,156 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2010 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials", "essentials\essentials.vcxproj", "{132F81F8-46DA-49D0-9071-D70BC087B38C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials_unit_tests", "essentials_unit_tests\essentials_unit_tests.vcxproj", "{6F4D72B1-E418-4859-8C19-D58659041948}" + ProjectSection(ProjectDependencies) = postProject + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build_tools", "build_tools", "{77439103-0A48-4243-8D07-3223DC5CF353}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMake", "CMake", "{86310DF6-AE4D-48C6-B302-80F5091FC09B}" + ProjectSection(SolutionItems) = preProject + ..\CMakeLists.txt = ..\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{1C08A7CC-21A3-42E1-AA39-7E03F88A73F3}" + ProjectSection(SolutionItems) = preProject + CMakeLists.txt = CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "essentials", "essentials", "{968024AC-A87C-40E9-B75A-B7AE9790C73F}" + ProjectSection(SolutionItems) = preProject + essentials\CMakeLists.txt = essentials\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMakeHelpers", "CMakeHelpers", "{35E7ED3A-7DF9-4E75-B289-99B3D0050992}" + ProjectSection(SolutionItems) = preProject + CMakeHelpers\addBoost.cmake = CMakeHelpers\addBoost.cmake + CMakeHelpers\addSeadexOptions.cmake = CMakeHelpers\addSeadexOptions.cmake + CMakeHelpers\addSpecificFlags.cmake = CMakeHelpers\addSpecificFlags.cmake + CMakeHelpers\addYasmineOptions.cmake = CMakeHelpers\addYasmineOptions.cmake + CMakeHelpers\functions.cmake = CMakeHelpers\functions.cmake + CMakeHelpers\functionsAddCompilerFlags.cmake = CMakeHelpers\functionsAddCompilerFlags.cmake + CMakeHelpers\functionsRapidJSON.cmake = CMakeHelpers\functionsRapidJSON.cmake + CMakeHelpers\setVariables.cmake = CMakeHelpers\setVariables.cmake + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "essentials_unit_tests", "essentials_unit_tests", "{63218938-B7EC-4913-9B3B-CEAE1F2A925B}" + ProjectSection(SolutionItems) = preProject + essentials_unit_tests\CMakeLists.txt = essentials_unit_tests\CMakeLists.txt + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - C++ 03|Win32 = Debug - C++ 03|Win32 + Debug - C++ 03|x64 = Debug - C++ 03|x64 + Debug - C++ 03|x86 = Debug - C++ 03|x86 + Debug - VS 2015|Win32 = Debug - VS 2015|Win32 + Debug - VS 2015|x64 = Debug - VS 2015|x64 + Debug - VS 2015|x86 = Debug - VS 2015|x86 + Debug - VS 2017|Win32 = Debug - VS 2017|Win32 + Debug - VS 2017|x64 = Debug - VS 2017|x64 + Debug - VS 2017|x86 = Debug - VS 2017|x86 + Release - C++ 03|Win32 = Release - C++ 03|Win32 + Release - C++ 03|x64 = Release - C++ 03|x64 + Release - C++ 03|x86 = Release - C++ 03|x86 + Release - VS 2015|Win32 = Release - VS 2015|Win32 + Release - VS 2015|x64 = Release - VS 2015|x64 + Release - VS 2015|x86 = Release - VS 2015|x86 + Release - VS 2017|Win32 = Release - VS 2017|Win32 + Release - VS 2017|x64 = Release - VS 2017|x64 + Release - VS 2017|x86 = Release - VS 2017|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.Build.2 = Debug - VS 2013|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {86310DF6-AE4D-48C6-B302-80F5091FC09B} = {77439103-0A48-4243-8D07-3223DC5CF353} + {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} = {86310DF6-AE4D-48C6-B302-80F5091FC09B} + {968024AC-A87C-40E9-B75A-B7AE9790C73F} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + {35E7ED3A-7DF9-4E75-B289-99B3D0050992} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + {63218938-B7EC-4913-9B3B-CEAE1F2A925B} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CB028EB1-46EF-44C3-B508-97BC3E09DC4D} + EndGlobalSection +EndGlobal diff --git a/externals/genesis/source/externals/essentials/source/essentials/CMakeLists.txt b/externals/genesis/source/externals/essentials/source/essentials/CMakeLists.txt new file mode 100644 index 0000000..edc08df --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 2.8) + +project(essentials) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +file(GLOB essentials_SRC "include/essentials/*.hpp" "include/essentials/compatibility/*.hpp" "source/*.cpp") + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +include(./../CMakeHelpers/addSpecificFlags.cmake) +include(./../CMakeHelpers/addSeadexOptions.cmake) + +include_directories("./include") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library(libessentials ${LINK_TYPE} ${essentials_SRC}) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library(essentials STATIC ${essentials_SRC}) +endif() + + +file(GLOB essentials_hpp "include/essentials/*.hpp" "include/essentials/compatibility/*.hpp") +install(FILES ${essentials_hpp} DESTINATION include/essentials/include) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + install(TARGETS libessentials DESTINATION lib) + set_target_properties(libessentials PROPERTIES PREFIX "") +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + install(TARGETS essentials DESTINATION lib) + set_target_properties(essentials PROPERTIES PREFIX "") +endif() diff --git a/externals/genesis/source/externals/essentials/source/essentials/essentials.vcxproj b/externals/genesis/source/externals/essentials/source/essentials/essentials.vcxproj new file mode 100644 index 0000000..63f7f7e --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/essentials.vcxproj @@ -0,0 +1,545 @@ + + + + + Debug - C++ 03 + Win32 + + + Debug - C++ 03 + x64 + + + Debug - Clang + Win32 + + + Debug - Clang + x64 + + + Debug - VS 2013 + Win32 + + + Debug - VS 2013 + x64 + + + Debug - VS 2015 + Win32 + + + Debug - VS 2015 + x64 + + + Debug - VS 2017 + Win32 + + + Release - C++ 03 + Win32 + + + Release - C++ 03 + x64 + + + Release - Clang + Win32 + + + Release - Clang + x64 + + + Release - VS 2015 + Win32 + + + Release - VS 2015 + x64 + + + Release - VS 2017 + Win32 + + + Debug - VS 2017 + x64 + + + Release - VS 2017 + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {132F81F8-46DA-49D0-9071-D70BC087B38C} + essentials + 8.1 + + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141_clang_c2 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/essentials/essentials.vcxproj.filters b/externals/genesis/source/externals/essentials/source/essentials/essentials.vcxproj.filters new file mode 100644 index 0000000..e68031a --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/essentials.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {4a8b49fc-8912-43d5-a33a-962f5e097001} + + + {13a9f023-217a-4d7a-946f-8147bce1d21a} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + + + license + + + license + + + license + + + license + + + license + + + + + Header Files\compatibility + + + Header Files\compatibility + + + Header Files\compatibility + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\compatibility + + + \ No newline at end of file diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/base.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/base.hpp new file mode 100644 index 0000000..9ea9eb7 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/base.hpp @@ -0,0 +1,41 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A +#define BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A + + +//!\def SX_ASSERT( _condition, _message ) +//!\brief Assert a given condition. Adds the message to the assert for better diagnostics when the assert is triggered. +#define SX_ASSERT( _condition, _message ) \ + do \ + { \ + assert( ( _condition ) && _message ); \ + } \ + while( 0 ) + +//!\def SX_ASSERTED( _x ) +//!\brief Suppress warnings for variables that are only used within asserts. +#define SX_ASSERTED( _x ) static_cast< void >( _x ); + +//!\def SX_UNUSED_PARAMETER( _x ) +//!\brief Suppress warnings for unreferenced parameters. +#define SX_UNUSED_PARAMETER( _x ) static_cast( _x ) + + +//!\def SX_UNUSED_VARIABLE( _x ) +//!\brief Suppress warnings for unreferenced variable. +#define SX_UNUSED_VARIABLE( _x ) static_cast( _x ) + + +#include + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/build_number.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/build_number.hpp new file mode 100644 index 0000000..6771ace --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/build_number.hpp @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 +#define BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + +namespace version +{ + + + const sxe::uint16_t BUILD_NUMBER( 96 ); + + +} + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp new file mode 100644 index 0000000..1946dc4 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp @@ -0,0 +1,59 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 +#define CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 + + +#ifdef SX_CPP03_BOOST + +#include + +#else + +#include + +#endif + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + using boost::chrono::time_point; + using boost::chrono::system_clock; + using boost::chrono::steady_clock; + using boost::chrono::seconds; + using boost::chrono::milliseconds; + using boost::chrono::duration_cast; + using boost::chrono::time_point; + + +#else // C++11 compatibility + + + using std::chrono::time_point; + using std::chrono::system_clock; + using std::chrono::steady_clock; + using std::chrono::milliseconds; + using std::chrono::seconds; + using std::chrono::duration_cast; + using std::chrono::time_point; + + +#endif + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp new file mode 100644 index 0000000..4d5e764 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp @@ -0,0 +1,184 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 +#define COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 + + +#include "essentials_backward_compatibility.hpp" + + +#ifdef SX_CPP03_BOOST +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4456 ) +#pragma warning( disable : 4996 ) +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + +#else +#include +#include +#include +#include +#include +#endif + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + #define SX_OVERRIDE + #define SX_FINAL + #define SX_DELETE + #define SX_NULLPTR NULL + + #define SX_FOR(_variable, _container) BOOST_FOREACH( _variable, _container ) + + #define SX_CONSTEXPR const + + #define SX_NOEXCEPT throw() + + + using boost::shared_ptr; + #define SX_UNIQUE_PTR shared_ptr + + #define SX_MAKE_SHARED boost::make_shared + #define SX_MAKE_UNIQUE boost::make_shared + + template + _type& move(_type& _t) + { + return( _t ); + } + + using boost::int8_t; + using boost::int16_t; + using boost::int32_t; + using boost::int64_t; + using boost::uint8_t; + using boost::uint16_t; + using boost::uint32_t; + using boost::uint64_t; + + using boost::bind; + using boost::ref; + using boost::cref; + using boost::placeholders::_1; + using boost::placeholders::_2; + + using boost::function; + + using boost::remove_reference; + using boost::remove_const; + + using boost::random_device; + + +#else // C++11 compatibility + + #ifdef SX_NO_STD_MAKE_UNIQUE + + template< typename t, typename ... args > + std::unique_ptr< t > make_unique(args&& ... _args) + { + return( std::unique_ptr< t >(new t(std::forward< args >(_args)...)) ); + } + + #else + + using std::make_unique; + + #endif + + #define SX_OVERRIDE override + #define SX_FINAL final + #define SX_DELETE = delete + #define SX_NULLPTR nullptr + + #define SX_FOR(_variable, _container) for( _variable : _container ) + + #ifdef _MSC_VER + #if _MSC_VER <= 1800 + #define SX_CONSTEXPR const + #endif + #endif + + #ifndef SX_CONSTEXPR + #define SX_CONSTEXPR constexpr + #endif + +#ifdef _MSC_VER + #if _MSC_VER <= 1800 + #define SX_NOEXCEPT throw() + #else + #define SX_NOEXCEPT noexcept + #endif +#else + #define SX_NOEXCEPT noexcept +#endif + + using std::shared_ptr; + template + using SX_UNIQUE_PTR = std::unique_ptr<_pointee>; + + #define SX_MAKE_SHARED std::make_shared + #define SX_MAKE_UNIQUE sxe::make_unique + + using std::move; + + + using std::int8_t; + using std::int16_t; + using std::int32_t; + using std::int64_t; + using std::uint8_t; + using std::uint16_t; + using std::uint32_t; + using std::uint64_t; + + using std::bind; + using std::ref; + using std::cref; + using std::placeholders::_1; + using std::placeholders::_2; + + using std::function; + + using std::remove_reference; + using std::remove_const; + + using std::random_device; + + +#endif + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp new file mode 100644 index 0000000..c0b2d60 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp @@ -0,0 +1,31 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 +#define ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 + + +#ifdef Y_NO_STD_MAKE_UNIQUE +#define SX_NO_STD_MAKE_UNIQUE +#endif + + +#ifdef Y_CPP03_BOOST +#define SX_CPP03_BOOST +#endif + + +#define Y_UNIQUE_PTR SX_UNIQUE_PTR +#define Y_MAKE_UNIQUE SX_MAKE_UNIQUE +#define Y_MAKE_SHARED SX_MAKE_SHARED +#define Y_UNUSED_PARAMETER SX_UNUSED_PARAMETER + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp new file mode 100644 index 0000000..2381481 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp @@ -0,0 +1,63 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF +#define THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF + + +#ifdef SX_CPP03_BOOST + +#include +#include + +#else + +#include +#include +#include +#include + +#endif + + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + using boost::thread; + using boost::unique_lock; + using boost::mutex; + using boost::lock_guard; + using boost::condition_variable; + using boost::this_thread::sleep_for; + using boost::atomic; + + +#else // C++11 compatibility + + + using std::thread; + using std::unique_lock; + using std::mutex; + using std::lock_guard; + using std::condition_variable; + using std::this_thread::sleep_for; + using std::atomic; + + +#endif + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/conversion.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/conversion.hpp new file mode 100644 index 0000000..c46dd99 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/conversion.hpp @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 +#define CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + + //!\brief Converts a number from string to int. + //!\param _int_as_string Number in string format. + //!\param _result Variable where the result will be stored. + //!\return True on success, false otherwise. + bool string_to_int( const char* const _int_as_string, int& _result ); + + //!\brief Converts a number from unsigned int 32 to string. + //!\param _value Number to be converted. + //!\return Number as string. + std::string to_string( const sxe::uint32_t _value ); + + //!\brief Converts a number from int to string. + //!\param _value Number to be converted. + //!\return Number as string. + std::string to_string( const int _value ); + + //!\brief Converts a string to uppercase. + //!\param _value String to be converted. + //!\return String in uppercase format. + //!\sa to_lower + std::string to_upper( const std::string& _value ); + + //!\brief Converts a string to lowercase. + //!\param _value String to be converted. + //!\return String in lowercase format. + //!\sa to_upper + std::string to_lower( const std::string& _value ); + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/essentials_version.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/essentials_version.hpp new file mode 100644 index 0000000..96d967f --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/essentials_version.hpp @@ -0,0 +1,41 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E +#define VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + +namespace version +{ + + +void log_version(); + + +sxe::uint16_t get_major_version(); +sxe::uint16_t get_minor_version(); +sxe::uint16_t get_patch_version(); +sxe::uint16_t get_build_number(); + + +} + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/exception.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/exception.hpp new file mode 100644 index 0000000..76ad4b8 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/exception.hpp @@ -0,0 +1,30 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 +#define EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 + + +#include "exception_template.hpp" + + +namespace sxe +{ + + +//!\def SX_EXCEPTION( exception ) +//!\brief The Seadex essentials exception class. +SX_EXCEPTION( exception ) + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/exception_template.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/exception_template.hpp new file mode 100644 index 0000000..2415a7d --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/exception_template.hpp @@ -0,0 +1,160 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D +#define EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D + + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/sxprintf.hpp" + + +#ifndef SX_CPP03_BOOST + + +//!\def SX_EXCEPTION( _name ) +//!\brief Create an exception class inheriting std::exception with the given name. It also supports +//! creating messages with placeholders by calling sxprintf. +//!\sa sxprintf +#define SX_EXCEPTION( _name ) \ +class _name: public std::exception \ +{ \ +public: \ + template< typename ... args > \ + _name(const std::string & _what, args ... _args ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _args ... ) ) \ + { \ + } \ +\ +\ + virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ +\ +\ + virtual const char* what() const throw () SX_OVERRIDE \ + { \ + return ( what_.c_str() ); \ + } \ +\ +\ +private: \ + std::string what_; \ +\ +\ +}; + + +#else + + +#define SX_EXCEPTION( _name ) \ +class _name: public std::exception \ +{ \ +public: \ + explicit _name(const std::string & _what ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str() ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6 ) ) \ + { \ + } \ +\ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ) \ + { \ + } \ +\ +\ + virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ +\ +\ + virtual const char* what() const throw () SX_OVERRIDE \ + { \ + return ( what_.c_str() ); \ + } \ +\ +\ +private: \ + std::string what_; \ +\ +\ +}; + + +#endif + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/format_settings.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/format_settings.hpp new file mode 100644 index 0000000..757c60a --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/format_settings.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB +#define FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB + + +#include + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + +//!\struct format_settings +//!\brief Structure containing information for formatting the output of sxprintf. +struct format_settings SX_FINAL +{ + //!\brief Constructor. + format_settings(); + + + std::string format_string_; + bool missing_closing_bracket_; + bool correct_; + bool hex_; + bool pad_zeros_; + bool places_set_; + int places_; + bool decimal_places_set_; + int decimal_places_; +}; + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp new file mode 100644 index 0000000..b0777eb --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp @@ -0,0 +1,46 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 +#define MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 + + +#ifndef SX_NO_VARIADIC_MACRO + + +//!\def EXPAND( x ) +//!\brief Helper to work around some Visual C++ compiler quirk dealing with variadic macros. +#define EXPAND( x ) x + +//!\def CAT( A, B ) +//!\brief Concatenate two tokens. +#define CAT( A, B ) A ## B + +//!\def SELECT( NAME, NUM ) +//!\brief Creating a name from a base name and a number with underscore between them. +#define SELECT( NAME, NUM ) CAT( NAME ## _, NUM ) + +//!\def GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) +//!\brief Helper for counting the number of parameters of a macro. +#define GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) COUNT + +//!\def VA_SIZE( ... ) +//!\brief Count the number of parameters of a macro. +#define VA_SIZE( ... ) EXPAND( GET_COUNT( __VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1 ) ) + +//!\def VA_SELECT( NAME, ... ) +//!\brief Selects the correct overloaded macro based on the number of parameters. +#define VA_SELECT( NAME, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )(__VA_ARGS__) ) + + +#endif + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/non_copyable.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/non_copyable.hpp new file mode 100644 index 0000000..b93fff3 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/non_copyable.hpp @@ -0,0 +1,68 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 +#define NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 + + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST + + +//!\def SX_NO_COPY(_class_name) +//!\brief Delete the copy constructor and assignment operator of the given class. +#define SX_NO_COPY(_class_name)\ +private:\ + _class_name(const _class_name&) SX_DELETE;\ + _class_name& operator=(const _class_name&) SX_DELETE;\ +public:\ +\ + + +//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) +//!\brief Delete the assignment operator of the given class. +#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ +private:\ + _class_name& operator=( const _class_name& ) SX_DELETE;\ +public:\ +\ + + +#else + + +//!\def SX_NO_COPY(_class_name) +//!\brief Delete the copy constructor and assignment operator of the given class. +#define SX_NO_COPY(_class_name)\ + _class_name(const _class_name&) SX_DELETE;\ + _class_name& operator=(const _class_name&) SX_DELETE;\ +\ + + +//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) +//!\brief Delete the assignment operator of the given class. +#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ + _class_name& operator=( const _class_name& ) SX_DELETE;\ +\ + + +#endif + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/sxprintf.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/sxprintf.hpp new file mode 100644 index 0000000..0d9a863 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/sxprintf.hpp @@ -0,0 +1,242 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 +#define PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 + + +#include +#include + + +#ifdef SX_CPP03_BOOST + #include + #include +#endif + +#include "compatibility/compatibility.hpp" +#include "format_settings.hpp" + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST + typedef boost::variant< bool, int, unsigned int, sxe::int8_t, sxe::uint8_t, sxe::uint16_t, sxe::uint32_t, + std::string, std::size_t, const char*, boost::int_least64_t, double > value_type; + typedef std::vector< value_type > value_types; +#endif + + +extern const char PLACE_HOLDER; +extern const char* const SUPERFLUOUS_PARAMETER_START; +extern const char SUPERFLUOUS_PARAMETER_END; +extern const char OPENING_SQUARE_BRACKET; +extern const char CLOSING_SQUARE_BRACKET; + + +template< typename value > +struct stream_writer +{ + static void print( std::ostream& _os, const value& _value ) + { + _os << _value; + } +}; + + +template< > +struct stream_writer< sxe::uint8_t > +{ + static void print(std::ostream& _os, const sxe::uint8_t& _value) + { + _os << static_cast( _value ); + } +}; + + +// cppcheck-suppress unusedFunction +std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ); +sxe::format_settings parse_format_string( const char** const _format ); + + +#ifdef SX_CPP03_BOOST + +void print_value_type_value( std::ostream& _os, const value_type& _value ); + + +#endif + + +template< typename value > +void print_superfluous_parameters( std::ostream& _os, const value& _value ) +{ + _os << SUPERFLUOUS_PARAMETER_START; +#ifndef SX_CPP03_BOOST + stream_writer< value >::print( _os, _value ); +#else + print_value_type_value( _os, _value ); +#endif + _os << SUPERFLUOUS_PARAMETER_END; +} + + +#ifndef SX_CPP03_BOOST + + +template< typename value, typename ... args > +void print_superfluous_parameters( std::ostream& _os, + const value& _value, args ... _args ) +{ + _os << SUPERFLUOUS_PARAMETER_START; + stream_writer< value >::print( _os, _value ); + _os << SUPERFLUOUS_PARAMETER_END; + print_superfluous_parameters( _os, _args ... ); +} + + +#else + + +#endif + + +void sxprintf( std::ostream& _os, const char* _format ); + +#ifndef SX_CPP03_BOOST +template< typename value, typename ... args > +void sxprintf( std::ostream& _os, const char* _format, const value& _value, args ... _args ) +{ + while( *_format ) + { + if( PLACE_HOLDER == *_format ) + { + if( PLACE_HOLDER == *( _format + 1 ) ) + { + ++_format; // skip first place holder + _os << *_format++; // output of the second place holder + } + else + { + if( OPENING_SQUARE_BRACKET == *( _format + 1 ) ) + { + ++_format; + const sxe::format_settings format_settings = sxe::parse_format_string( &_format ); + const std::ios_base::fmtflags stream_flags = _os.flags(); + const char streafill_ = _os.fill(); + if( format_settings.correct_ ) + { + _os << format_settings; + stream_writer< value >::print( _os, _value ); + } + else + { + while( CLOSING_SQUARE_BRACKET != *( _format ) ) + { + ++_format; + } + stream_writer< value >::print( _os, _value ); + _os << format_settings; + } + _os.flags( stream_flags ); + _os.fill( streafill_ ); + } + else + { + stream_writer< value >::print( _os, _value ); + } + + sxprintf( _os, _format + 1, _args ... ); + return; + } + } + else + { + _os << *_format++; + } + } + + print_superfluous_parameters( _os, _value, _args ... ); +} + + +//!\brief Creates a formatted message. The format string can contain placeholders ('%'s) that will be replaced with +//!the parameters by this function. To emit a '%' use two percent signs ("%%"). +//!\param _format The format string in which will the placeholders will be replaced (if there are any). +//!\param _args The arguments that will replace the placeholders in the format string. The number of parameters in +//!_args has to be equal to the number of placeholders in the format string. If you pass too few or too many +//!arguments, the resulting string will contain diagnostics in the resulting string +//!([Missing parameter!] or [Superfluous parameter: x]). +//!\return String containing the complete formatted message. +template< typename ... args > +std::string sxprintf(const char* const _format, args ... _args) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _args ...); + return( target_string_stream.str() ); +} + +#else + +std::string sxprintf(const char* const _format); +std::string sxprintf(const char* const _format, const value_type& _value1); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9, const value_type& _value10); + + +void sxprintf(std::ostream& _os, const char* const _format); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10); + + void sxprintf(std::ostream& _os, const char* const _format, const value_types& _values); + +#endif + + +} + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/include/essentials/uri.hpp b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/uri.hpp new file mode 100644 index 0000000..0499a44 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/include/essentials/uri.hpp @@ -0,0 +1,55 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D +#define URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D + + +#include + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sxe +{ + + +const char URI_DELIMITER = '/'; + + +class uri SX_FINAL +{ +public: + explicit uri( const std::string& _uri = "" ); + ~uri() SX_NOEXCEPT; + bool is_empty() const; + const std::string to_string() const; + const std::string& get_front() const; + const std::string& get_back(); + void push_front( const std::string& _segment ); + void push_back( const std::string& _segment ); + void pop_front(); + void pop_back(); + size_t size() const; + + +private: + const std::string build_uri() const; + void split_string_to_uri_segments( const std::string& _uri ); + + + std::deque< std::string > uri_; +}; + + +} + + +#endif diff --git a/externals/genesis/source/externals/essentials/source/essentials/source/conversion.cpp b/externals/genesis/source/externals/essentials/source/essentials/source/conversion.cpp new file mode 100644 index 0000000..ed91544 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/source/conversion.cpp @@ -0,0 +1,103 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/conversion.hpp" + +#include +#include +#include + +#ifndef SX_CPP03_BOOST + #include +#else + #include +#endif + + +namespace sxe +{ + + +bool string_to_int( const char* const _int_as_string, int& _result ) +{ + bool success = false; + try + { +#ifndef SX_CPP03_BOOST + _result = std::stoi( std::string( _int_as_string ) ); + success = true; +#else + std::istringstream is( _int_as_string ); + if (is >> _result) + { + success = true; + } + else + { + success = false; + } +#endif + + } + catch ( const std::invalid_argument& ) + { + success = false; + } + catch ( const std::out_of_range& ) + { + success = false; + } + return( success ); +} + + +std::string to_string( const sxe::uint32_t _value ) +{ +#ifndef SX_CPP03_BOOST + return( std::to_string( _value ) ); +#else + std::ostringstream ostr; + ostr << _value; + return( ostr.str() ); +#endif +} + + +std::string to_string( const int _value ) +{ +#ifndef SX_CPP03_BOOST + return( std::to_string( _value ) ); +#else + std::ostringstream ostr; + ostr << _value; + return( ostr.str() ); +#endif +} + + +// cppcheck-suppress unusedFunction +std::string to_upper( const std::string& _value ) +{ + std::string value_caps = _value; + std::transform( value_caps.begin(), value_caps.end(), value_caps.begin(), static_cast< int( *)( int ) >( ::std::toupper ) ); + return( value_caps ); +} + + +// cppcheck-suppress unusedFunction +std::string to_lower( const std::string& _value ) +{ + std::string value_to_lower = _value; + std::transform( value_to_lower.begin(), value_to_lower.end(), value_to_lower.begin(), static_cast< int( *)( int ) >( ::std::tolower ) ); + return( value_to_lower ); +} + + +} diff --git a/externals/genesis/source/externals/essentials/source/essentials/source/essentials_version.cpp b/externals/genesis/source/externals/essentials/source/essentials/source/essentials_version.cpp new file mode 100644 index 0000000..7279071 --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/source/essentials_version.cpp @@ -0,0 +1,74 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "essentials/essentials_version.hpp" + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/build_number.hpp" +#include "essentials/sxprintf.hpp" + + +namespace sxe +{ + + +namespace version +{ + + +namespace +{ + + +const sxe::uint16_t VERSION_MAJOR( 1 ); +const sxe::uint16_t VERSION_MINOR( 3 ); +const sxe::uint16_t VERSION_PATCH( 2 ); + + +} + + +// cppcheck-suppress unusedFunction +void log_version() +{ + std::cout << sxe::sxprintf( "essentials library version %.%.%.%.", get_major_version(), + get_minor_version(), get_patch_version(), get_build_number() ) << std::endl; +} + + +sxe::uint16_t get_major_version() +{ + return( VERSION_MAJOR ); +} + + +sxe::uint16_t get_minor_version() +{ + return( VERSION_MINOR ); +} + + +sxe::uint16_t get_patch_version() +{ + return( VERSION_PATCH ); +} + + +sxe::uint16_t get_build_number() +{ + return( BUILD_NUMBER ); +} + + +} + + +} diff --git a/externals/genesis/source/externals/essentials/source/essentials/source/format_settings.cpp b/externals/genesis/source/externals/essentials/source/essentials/source/format_settings.cpp new file mode 100644 index 0000000..0417c8a --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/source/format_settings.cpp @@ -0,0 +1,32 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "essentials/format_settings.hpp" + + +namespace sxe +{ + + +format_settings::format_settings(): + format_string_(), + missing_closing_bracket_( false ), + correct_( false ), + hex_( false ), + pad_zeros_( false ), + places_set_( false ), + places_( 0 ), + decimal_places_set_( false ), + decimal_places_( 0 ) +{ + // Nothing to do... +} + + +} diff --git a/externals/genesis/source/externals/essentials/source/essentials/source/sxprintf.cpp b/externals/genesis/source/externals/essentials/source/essentials/source/sxprintf.cpp new file mode 100644 index 0000000..99844aa --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/source/sxprintf.cpp @@ -0,0 +1,628 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/sxprintf.hpp" + +#include + +#include "essentials/base.hpp" +#include "essentials/conversion.hpp" + + +namespace sxe +{ + + +namespace +{ + + + const char MISSING_PARAMETERS_MESSAGE[] = "[Missing parameter!]"; + const char MISSING_TERMINATOR[] = "[Missing output modifier terminator!]"; + const char ILLEGAL_MODIFIER[] = "[Illegal output modifier!]"; + const char POINT = '.'; + const char ZERO = '0'; + const char X = 'x'; + const char CAPS_X = 'X'; + + +} + + +const char PLACE_HOLDER = '%'; +const char* const SUPERFLUOUS_PARAMETER_START = "[Superfluous parameter: "; +const char SUPERFLUOUS_PARAMETER_END = ']'; +const char OPENING_SQUARE_BRACKET = '['; +const char CLOSING_SQUARE_BRACKET = ']'; + + +// cppcheck-suppress unusedFunction +std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ) +{ + if( !_format.correct_ ) + { + _os << ILLEGAL_MODIFIER; + } + else if( _format.missing_closing_bracket_ ) + { + _os << MISSING_TERMINATOR; + } + else + { + if( _format.hex_ ) + { + _os << std::hex; + _os << std::showbase; + _os.fill( '0' ); + } + else + { + if( _format.pad_zeros_ ) + { + _os.fill( '0' ); + } + + if( _format.places_set_ ) + { + _os.width( _format.places_ ); + } + + if( _format.decimal_places_set_ ) + { + _os.precision( _format.decimal_places_ ); + } + } + } + + return( _os ); +} + + +bool is_allowed_char( const char _char ) +{ + const bool success = ( std::isdigit( _char ) || ( X == _char ) || ( CAPS_X == _char ) ); + return( success ); +} + + +sxe::format_settings parse_format_string( const char** const _format ) +{ + sxe::format_settings format_settings; + format_settings.correct_ = true; + SX_ASSERT( ( OPENING_SQUARE_BRACKET == **_format ), "Format string to parse doesn't start with [." ); + ++*_format; + format_settings.missing_closing_bracket_ = true; + bool point_found = false; + const char* text_before_point = *_format; + std::size_t text_before_point_size = 0; + const char* text_after_point = SX_NULLPTR; + std::size_t text_after_point_size = 0; + while( **_format ) + { + if( CLOSING_SQUARE_BRACKET == **_format ) + { + format_settings.missing_closing_bracket_ = false; + break; + } + else + if( POINT == **_format ) + { + if( point_found ) + { + format_settings.correct_ = false; + break; + } + else + { + point_found = true; + text_after_point = ( *_format ) + 1; + text_after_point_size = 0; + } + } + else + { + const char _text_char = **_format; + if( is_allowed_char( _text_char ) ) + { + if( point_found ) + { + ++text_after_point_size; + } + else + { + ++text_before_point_size; + } + } + else + { + format_settings.correct_ = false; + break; + } + } + + ++( *_format ); + } + + SX_ASSERT( text_before_point, "Logic error parsing format string!" ); + if( ( 0 == text_before_point_size ) && ( 0 == text_after_point_size ) ) + { + format_settings.correct_ = false; + } + + if( ( !format_settings.missing_closing_bracket_ ) && format_settings.correct_ ) + { + if( ( 0 < text_before_point_size ) && ( ( X == text_before_point[ 0 ] ) || ( CAPS_X == text_before_point[ 0 ] ) ) ) + { + format_settings.hex_ = true; + ++text_before_point; + --text_before_point_size; + } + + if( ( 0 < text_before_point_size ) && ( ZERO == text_before_point[ 0 ] ) ) + { + format_settings.pad_zeros_ = true; + ++text_before_point; + --text_before_point_size; + } + + if( 0 < text_before_point_size ) + { + format_settings.places_set_ = true; + if( !string_to_int( text_before_point, format_settings.places_ ) ) + { + format_settings.correct_ = false; + } + } + + if( 0 < text_after_point_size ) + { + SX_ASSERT( text_after_point, "Logic error parsing format string!" ); + format_settings.decimal_places_set_ = true; + if( !string_to_int( text_after_point, format_settings.decimal_places_ ) ) + { + format_settings.correct_ = false; + } + } + } + + return( format_settings ); +} + + +#ifdef SX_CPP03_BOOST + + +void print_superfluous_parameters( std::ostream& _os, const value_types& _values, value_types::const_iterator& _position ) +{ + while( _position != _values.end() ) + { + print_superfluous_parameters( _os, *_position ); + ++_position; + } +} + + +#endif + + +void sxprintf( std::ostream& _os, const char* _format ) +{ + while( *_format ) + { + if( PLACE_HOLDER == *_format ) + { + if( PLACE_HOLDER == *( _format + 1 ) ) + { + ++_format; + } + else + { + _os << MISSING_PARAMETERS_MESSAGE; + } + } + _os << *_format++; + } +} + + +#ifdef SX_CPP03_BOOST + + +std::string sxprintf(const char* const _format) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9, const value_type& _value10) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10); + return( target_string_stream.str() ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1 ) +{ + value_types values; + values.push_back( _value1 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + values.push_back( _value9 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + values.push_back( _value9 ); + values.push_back( _value10 ); + sxprintf( _os, _format, values ); +} + + +const char* sxprintf_impl( std::ostream& _os, const char* _format, value_types::const_iterator& _position, + const value_types::const_iterator _end, bool& printed ) +{ + while (*_format) + { + if (PLACE_HOLDER == *_format) + { + if (PLACE_HOLDER == *( _format + 1 )) + { + ++_format; // skip first place holder + _os << *_format++; // output of the second place holder + } + else + { + if (OPENING_SQUARE_BRACKET == *( _format + 1 )) + { + ++_format; + const sxe::format_settings format_settings = sxe::parse_format_string(&_format); + const std::ios_base::fmtflags stream_flags = _os.flags(); + const char streafill_ = _os.fill(); + _os << format_settings; + print_value_type_value( _os, *_position ); + _os.flags(stream_flags); + _os.fill(streafill_); + printed = true; + if( !format_settings.missing_closing_bracket_ ) + { + if( CLOSING_SQUARE_BRACKET == *( _format ) ) + { + ++_format; + } + } + else + { + if( !format_settings.correct_ ) + { + ++_format; + } + } + } + else + { + print_value_type_value( _os, *_position ); + printed = true; + ++_format; + break; + } + + if( _position + 1 != _end ) + { + if( *_format != '\0' ) + { + ++_position; + _format = sxprintf_impl( _os, _format, _position, _end, printed ); + } + } + return( _format ); + } + } + else + { + _os << *_format++; + } + } + return ( _format ); +} + + +void sxprintf( std::ostream& _os, const char * const _format, const value_types& _values ) +{ + SX_ASSERT( _format, "No format string to parse was passed!" ); + const char* current_position = _format; + + value_types::const_iterator _end = _values.end(); + value_types::const_iterator _position = _values.begin(); + while( _position != _end ) + { + bool printed = false; + current_position = sxprintf_impl( _os, current_position, _position, _end, printed ); + if( printed ) + { + ++_position; + } + if( current_position[0] == '\0' ) + { + break; + } + } + + sxprintf( _os, current_position ); + + if( _position != _end ) + { + print_superfluous_parameters( _os, _values, _position ); + } +} + + +void print_value_type_value( std::ostream& _os, const value_type& _value ) +{ + const std::type_info& type_info = _value.type(); + + if( type_info == typeid ( bool ) ) + { + stream_writer< bool >::print( _os, boost::get< bool >( _value ) ); + } + else if( type_info == typeid ( int ) ) + { + stream_writer< int >::print( _os, boost::get< int >( _value ) ); + } + else if( type_info == typeid ( unsigned int ) ) + { + stream_writer< unsigned int >::print( _os, boost::get< unsigned int >( _value ) ); + } + else if( type_info == typeid ( sxe::int8_t ) ) + { + stream_writer< sxe::int8_t >::print( _os, boost::get< sxe::int8_t >( _value ) ); + } + else if (type_info == typeid ( sxe::uint8_t )) + { + stream_writer< sxe::uint8_t >::print(_os, boost::get< sxe::uint8_t >(_value)); + } + else if( type_info == typeid ( sxe::uint16_t ) ) + { + stream_writer< sxe::uint16_t >::print( _os, boost::get< sxe::uint16_t >( _value ) ); + } + else if( type_info == typeid ( sxe::uint32_t ) ) + { + stream_writer< sxe::uint32_t >::print( _os, boost::get< sxe::uint32_t >( _value ) ); + } + else if( type_info == typeid ( std::string ) ) + { + stream_writer< std::string >::print( _os, boost::get< std::string >( _value ) ); + } + else if( type_info == typeid ( std::size_t ) ) + { + stream_writer< std::size_t >::print( _os, boost::get< std::size_t >( _value ) ); + } + else if( type_info == typeid ( const char* ) ) + { + stream_writer< const char* >::print( _os, boost::get< const char* >( _value ) ); + } + else if( type_info == typeid ( boost::int_least64_t ) ) + { + stream_writer< boost::int_least64_t >::print( _os, boost::get< boost::int_least64_t >( _value ) ); + } + else if( type_info == typeid ( double ) ) + { + stream_writer< double >::print( _os, boost::get< double >( _value ) ); + } +} + + +#endif + + +} diff --git a/externals/genesis/source/externals/essentials/source/essentials/source/uri.cpp b/externals/genesis/source/externals/essentials/source/essentials/source/uri.cpp new file mode 100644 index 0000000..1460efb --- /dev/null +++ b/externals/genesis/source/externals/essentials/source/essentials/source/uri.cpp @@ -0,0 +1,136 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/uri.hpp" + +#include +#include + +#include "essentials/base.hpp" + + +namespace sxe +{ + + +uri::uri( const std::string& _uri ) + : uri_() +{ + split_string_to_uri_segments( _uri ); +} + + +uri::~uri() SX_NOEXCEPT +{ + // Nothing to do... +} + + +bool uri::is_empty() const +{ + return( uri_.empty() ); +} + + +const std::string uri::to_string() const +{ + return( build_uri() ); +} + + +const std::string& uri::get_front() const +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + return( uri_.front() ); +} + + +const std::string& uri::get_back() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + return( uri_.back() ); +} + + +void uri::push_front( const std::string& _segment ) +{ + uri_.push_front( _segment ); +} + + +void uri::push_back( const std::string& _segment ) +{ + uri_.push_back( _segment ); +} + + +void uri::pop_front() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + uri_.pop_front(); +} + + +void uri::pop_back() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + uri_.pop_back(); +} + + +size_t uri::size() const +{ + return( uri_.size() ); +} + + +const std::string uri::build_uri() const +{ + std::stringstream uri; + + SX_FOR( const std::string& uri_element, uri_ ) + { + uri << URI_DELIMITER << uri_element; + } + + return( uri.str() ); +} + + +void uri::split_string_to_uri_segments( const std::string& _uri ) +{ + std::string uri = _uri; + if( !_uri.empty() ) + { + if( URI_DELIMITER == _uri[ 0 ] ) + { + uri = _uri.substr( 1 ); + } + + std::string::size_type start = 0; + std::string::size_type end = uri.find( URI_DELIMITER ); + while( end != std::string::npos ) + { + const std::string& segment = uri.substr( start, end - start ); + uri_.push_back( segment ); + start = ++end; + end = uri.find( URI_DELIMITER, end ); + } + + const std::string& last_segment = uri.substr( start ); + if( last_segment[ 0 ] != URI_DELIMITER ) + { + uri_.push_back( last_segment ); + } + } +} + + +} diff --git a/externals/genesis/source/genesis.sln b/externals/genesis/source/genesis.sln new file mode 100644 index 0000000..1083fcd --- /dev/null +++ b/externals/genesis/source/genesis.sln @@ -0,0 +1,163 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2009 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genesis", "genesis\genesis.vcxproj", "{466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}" + ProjectSection(ProjectDependencies) = postProject + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{7BB2B202-754C-4640-9E43-B3AB017EFD9C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "html_page_generator", "examples\html_page_generator\html_page_generator.vcxproj", "{A4401298-EBE7-4861-AC15-E23071C4FCE5}" + ProjectSection(ProjectDependencies) = postProject + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357} = {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{0FEFD4B7-9FBD-441B-AF1B-FD52E1E04F08}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials", "externals\essentials\source\essentials\essentials.vcxproj", "{132F81F8-46DA-49D0-9071-D70BC087B38C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build_tools", "build_tools", "{9621FF20-55AE-415B-B00A-55853998E619}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMake", "CMake", "{9513E631-618B-43D4-9FCA-5C4E8E3A48D0}" + ProjectSection(SolutionItems) = preProject + ..\CMakeLists.txt = ..\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{E351D004-E257-41B2-A2F9-34B85A5F272D}" + ProjectSection(SolutionItems) = preProject + CMakeLists.txt = CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "genesis", "genesis", "{C11DB251-3197-4B9D-B650-DBE49E8115CD}" + ProjectSection(SolutionItems) = preProject + genesis\CMakeLists.txt = genesis\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{7EB93F3B-F90E-47A4-8459-67AF40729913}" + ProjectSection(SolutionItems) = preProject + examples\CMakeLists.txt = examples\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "html_page_generator", "html_page_generator", "{8F23A302-B312-445A-AC0A-73307CFEE362}" + ProjectSection(SolutionItems) = preProject + examples\html_page_generator\CMakeLists.txt = examples\html_page_generator\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{2D664D50-E4A5-4621-A701-4B4CE01079BB}" + ProjectSection(SolutionItems) = preProject + externals\CMakeLists.txt = externals\CMakeLists.txt + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - C++ 03|Win32 = Debug - C++ 03|Win32 + Debug - C++ 03|x64 = Debug - C++ 03|x64 + Debug - VS 2015|Win32 = Debug - VS 2015|Win32 + Debug - VS 2015|x64 = Debug - VS 2015|x64 + Debug - VS 2017|Win32 = Debug - VS 2017|Win32 + Debug - VS 2017|x64 = Debug - VS 2017|x64 + Release - C++ 03|Win32 = Release - C++ 03|Win32 + Release - C++ 03|x64 = Release - C++ 03|x64 + Release - VS 2015|Win32 = Release - VS 2015|Win32 + Release - VS 2015|x64 = Release - VS 2015|x64 + Release - VS 2017|Win32 = Release - VS 2017|Win32 + Release - VS 2017|x64 = Release - VS 2017|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - C++ 03|Win32.ActiveCfg = Debug - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - C++ 03|Win32.Build.0 = Debug - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - C++ 03|Win32.Deploy.0 = Debug - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - C++ 03|x64.ActiveCfg = Debug - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - C++ 03|x64.Build.0 = Debug - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - C++ 03|x64.Deploy.0 = Debug - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - C++ 03|Win32.ActiveCfg = Release - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - C++ 03|Win32.Build.0 = Release - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - C++ 03|Win32.Deploy.0 = Release - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - C++ 03|x64.ActiveCfg = Release - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - C++ 03|x64.Build.0 = Release - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - C++ 03|x64.Deploy.0 = Release - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {A4401298-EBE7-4861-AC15-E23071C4FCE5}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A4401298-EBE7-4861-AC15-E23071C4FCE5} = {7BB2B202-754C-4640-9E43-B3AB017EFD9C} + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {0FEFD4B7-9FBD-441B-AF1B-FD52E1E04F08} + {9513E631-618B-43D4-9FCA-5C4E8E3A48D0} = {9621FF20-55AE-415B-B00A-55853998E619} + {E351D004-E257-41B2-A2F9-34B85A5F272D} = {9513E631-618B-43D4-9FCA-5C4E8E3A48D0} + {C11DB251-3197-4B9D-B650-DBE49E8115CD} = {E351D004-E257-41B2-A2F9-34B85A5F272D} + {7EB93F3B-F90E-47A4-8459-67AF40729913} = {E351D004-E257-41B2-A2F9-34B85A5F272D} + {8F23A302-B312-445A-AC0A-73307CFEE362} = {7EB93F3B-F90E-47A4-8459-67AF40729913} + {2D664D50-E4A5-4621-A701-4B4CE01079BB} = {E351D004-E257-41B2-A2F9-34B85A5F272D} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D2B39A2A-793E-484D-9858-C96385A3F50B} + EndGlobalSection +EndGlobal diff --git a/genesis/CMakeLists.txt b/externals/genesis/source/genesis/CMakeLists.txt similarity index 56% rename from genesis/CMakeLists.txt rename to externals/genesis/source/genesis/CMakeLists.txt index ffff76e..55ffd57 100644 --- a/genesis/CMakeLists.txt +++ b/externals/genesis/source/genesis/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8) project(genesis) +set(CMAKE_VERBOSE_MAKEFILE, 1) + if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() @@ -13,23 +15,39 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) include(./../CMakeHelpers/addSpecificFlags.cmake) -include(./../CMakeHelpers/addYasmineOptions.cmake) +include(./../CMakeHelpers/addSeadexOptions.cmake) include_directories("./include") -include_directories("./../externals/essentials/include") +include_directories("./../externals/essentials/source/essentials/include") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") +set(link_libraries_list "") + +if("${CPP_VERSION}" STREQUAL "03") + use_boost_libraries(link_libraries_list) +endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - add_library(libgenesis ${LINK_TYPE} ${genesis_SRC}) + add_library_for_linking(link_libraries_list libessentials) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library_for_linking(link_libraries_list essentials) +endif() + +message(STATUS "genesis linking to libraries: ${link_libraries_list}" ) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library(libgenesis SHARED ${genesis_SRC}) + target_link_libraries(libgenesis LINK_PUBLIC ${link_libraries_list}) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_library(genesis STATIC ${genesis_SRC}) + target_link_libraries(genesis LINK_PUBLIC ${link_libraries_list}) endif() -file(GLOB genesis_hpp "include/*.hpp") +file(GLOB genesis_hpp "./include/*.hpp") install(FILES ${genesis_hpp} DESTINATION include/genesis/include) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") install(TARGETS libgenesis DESTINATION lib) set_target_properties(libgenesis PROPERTIES PREFIX "") diff --git a/externals/genesis/source/genesis/changelog.txt b/externals/genesis/source/genesis/changelog.txt new file mode 100644 index 0000000..8b47c2b --- /dev/null +++ b/externals/genesis/source/genesis/changelog.txt @@ -0,0 +1,33 @@ +# Change log +All notable changes to this project are documented in this file. + + +##[0.3.2] - 2017-12-18 + +### Changed +• use essentials and hermes as libraries +• CMake: use external CMakeHelpers files +• CMake: refactoring of build files + +### Fixed +• rename private method recipe::create to recipe::create_impl because of bug (warning in clang) +• added SX_UNUSED_VARIABLE to is_delimiter_char, else a warning is generated in clang as it is not used (SX_ASSERT) + + +##[0.2.0] - 2017-09-20 + +### Added +• Support for Visual Studio 2017 builds +• C++03 compatibility + +### Changed +• rename: condition_block's private method check_modifier to apply_modifier +• method create_child of the class recipe_block is now protected + +### Fixed +• added missing override specifier to template_block::create method + + +##[0.1.0] - 2017-04-21 + +• The very first release version of genesis diff --git a/genesis/genesis.vcxproj b/externals/genesis/source/genesis/genesis.vcxproj similarity index 93% rename from genesis/genesis.vcxproj rename to externals/genesis/source/genesis/genesis.vcxproj index babd1f5..d618452 100644 --- a/genesis/genesis.vcxproj +++ b/externals/genesis/source/genesis/genesis.vcxproj @@ -1,755 +1,732 @@ - - - - - Debug - C++ 03 - Win32 - - - Debug - C++ 03 - x64 - - - Debug - Clang - Win32 - - - Debug - Clang - x64 - - - Debug - VS 2013 - Win32 - - - Debug - VS 2013 - x64 - - - Debug - VS 2015 - Win32 - - - Debug - VS 2015 - x64 - - - Debug - VS 2017 - Win32 - - - Debug - VS 2017 - x64 - - - Release - C++ 03 - Win32 - - - Release - C++ 03 - x64 - - - Release - Clang - Win32 - - - Release - Clang - x64 - - - Release - VS 2013 - Win32 - - - Release - VS 2013 - x64 - - - Release - VS 2015 - Win32 - - - Release - VS 2015 - x64 - - - Release - VS 2017 - Win32 - - - Release - VS 2017 - x64 - - - - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357} - genesis - 8.1 - - - - StaticLibrary - true - v141 - MultiByte - - - StaticLibrary - true - v141_clang_c2 - MultiByte - - - StaticLibrary - true - v140 - MultiByte - - - StaticLibrary - true - v120 - MultiByte - - - StaticLibrary - true - v141 - MultiByte - - - StaticLibrary - true - v120 - MultiByte - - - StaticLibrary - false - v141 - true - MultiByte - - - StaticLibrary - false - v141_clang_c2 - true - MultiByte - - - StaticLibrary - false - v140 - true - MultiByte - - - StaticLibrary - false - v120 - true - MultiByte - - - StaticLibrary - false - v141 - true - MultiByte - - - StaticLibrary - false - v120 - true - MultiByte - - - StaticLibrary - true - v141 - MultiByte - - - StaticLibrary - true - v141_clang_c2 - MultiByte - - - StaticLibrary - true - v140 - MultiByte - - - StaticLibrary - true - v120 - MultiByte - - - StaticLibrary - true - v141 - MultiByte - - - StaticLibrary - true - v120 - MultiByte - - - StaticLibrary - false - v141 - true - MultiByte - - - StaticLibrary - false - v141_clang_c2 - true - MultiByte - - - StaticLibrary - false - v140 - true - MultiByte - - - StaticLibrary - false - v120 - true - MultiByte - - - StaticLibrary - false - v141 - true - MultiByte - - - StaticLibrary - false - v120 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - Disabled - true - - - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - Level3 - MaxSpeed - true - true - true - - - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug - C++ 03 + Win32 + + + Debug - C++ 03 + x64 + + + Debug - Clang + Win32 + + + Debug - Clang + x64 + + + Debug - VS 2013 + Win32 + + + Debug - VS 2013 + x64 + + + Debug - VS 2015 + Win32 + + + Debug - VS 2015 + x64 + + + Debug - VS 2017 + Win32 + + + Debug - VS 2017 + x64 + + + Release - C++ 03 + Win32 + + + Release - C++ 03 + x64 + + + Release - Clang + Win32 + + + Release - Clang + x64 + + + Release - VS 2013 + Win32 + + + Release - VS 2013 + x64 + + + Release - VS 2015 + Win32 + + + Release - VS 2015 + x64 + + + Release - VS 2017 + Win32 + + + Release - VS 2017 + x64 + + + + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357} + genesis + 8.1 + + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141_clang_c2 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141_clang_c2 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/genesis/genesis.vcxproj.filters b/externals/genesis/source/genesis/genesis.vcxproj.filters similarity index 64% rename from genesis/genesis.vcxproj.filters rename to externals/genesis/source/genesis/genesis.vcxproj.filters index 01f8b19..f61e34a 100644 --- a/genesis/genesis.vcxproj.filters +++ b/externals/genesis/source/genesis/genesis.vcxproj.filters @@ -1,218 +1,158 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {e4072d57-8fc3-45b0-8a55-890235596a11} - - - {405c586e-518d-4d17-880c-e561a09a5c77} - - - {15239cf0-0a42-40d5-80ce-15256d0c1587} - - - {a2ba6865-a71e-441f-9efc-b6c67888c0a0} - - - {fc0c0321-a05d-41cd-a99c-11c3b68abbc0} - - - {5dc27c9e-86a8-4fb6-a2a8-bbdf434e29a0} - - - {97c6b545-0106-4ab1-8645-a95c5e9add8b} - - - - - license - - - license - - - license - - - license - - - license - - - license\essentials - - - license\essentials - - - license\essentials - - - license\essentials - - - license\essentials - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\external\essentials - - - Header Files\external\essentials - - - Header Files\external\essentials - - - Header Files\external\essentials - - - Header Files\external\essentials - - - Header Files\external\essentials - - - Header Files\external\essentials - - - Header Files\external\essentials - - - Header Files\external\essentials\compatibility - - - Header Files\external\essentials\compatibility - - - Header Files\external\essentials\compatibility - - - Header Files - - - Header Files - - - Header Files - - - Header Files\external\essentials\compatibility - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\external\essentials - - - Source Files\external\essentials - - - Source Files\external\essentials - - - Source Files - - - Source Files - - - - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {e4072d57-8fc3-45b0-8a55-890235596a11} + + + {97c6b545-0106-4ab1-8645-a95c5e9add8b} + + + + + license + + + license + + + license + + + license + + + license + + + license\essentials + + + license\essentials + + + license\essentials + + + license\essentials + + + license\essentials + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + \ No newline at end of file diff --git a/genesis/include/build_number.hpp b/externals/genesis/source/genesis/include/build_number.hpp similarity index 92% rename from genesis/include/build_number.hpp rename to externals/genesis/source/genesis/include/build_number.hpp index 05323f7..094a30b 100644 --- a/genesis/include/build_number.hpp +++ b/externals/genesis/source/genesis/include/build_number.hpp @@ -1,42 +1,42 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef BUILD_NUMBER_C13F16F5_B4C0_48CA_BF09_D5EB14953C3C -#define BUILD_NUMBER_C13F16F5_B4C0_48CA_BF09_D5EB14953C3C - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -namespace version -{ - - -const sxe::uint16_t BUILD_NUMBER( 31 ); - - -} - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BUILD_NUMBER_C13F16F5_B4C0_48CA_BF09_D5EB14953C3C +#define BUILD_NUMBER_C13F16F5_B4C0_48CA_BF09_D5EB14953C3C + + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +namespace version +{ + + +const sxe::uint16_t BUILD_NUMBER( 56 ); + + +} + + +} + + +} + + +#endif diff --git a/genesis/include/condition_block.hpp b/externals/genesis/source/genesis/include/condition_block.hpp similarity index 96% rename from genesis/include/condition_block.hpp rename to externals/genesis/source/genesis/include/condition_block.hpp index a2b684f..77ecb2e 100644 --- a/genesis/include/condition_block.hpp +++ b/externals/genesis/source/genesis/include/condition_block.hpp @@ -1,62 +1,62 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef CONDITION_BLOCK_3922737B_1A00_451A_AFCB_B29D0123210C -#define CONDITION_BLOCK_3922737B_1A00_451A_AFCB_B29D0123210C - - -#include "recipe_block.hpp" -#include "condition_modifier.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -//!\class confition_block -//!\brief class representing an 'if'. This block can have children. -class condition_block SX_FINAL - : public recipe_block -{ -public: - //!\brief constructor - //!\param _condition_name name of the condition block. - //!\param _modifier condition modifier. default value is none. - //!\sa condition_modifier - explicit condition_block( const std::string& _condition_name, const condition_modifier& _modifier = condition_modifier::NONE ); - virtual ~condition_block() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( condition_block ) - - //!\brief create the output for a step. - //!\param _recipe_callback generator callback - //!\param _ostream stream to which the generator writes. - virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; - - -private: - void apply_modifier( bool& _result ) const; - - const std::string condition_name_; - const condition_modifier modifier_; - - -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef CONDITION_BLOCK_3922737B_1A00_451A_AFCB_B29D0123210C +#define CONDITION_BLOCK_3922737B_1A00_451A_AFCB_B29D0123210C + + +#include "recipe_block.hpp" +#include "condition_modifier.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +//!\class confition_block +//!\brief class representing an 'if'. This block can have children. +class condition_block SX_FINAL + : public recipe_block +{ +public: + //!\brief constructor + //!\param _condition_name name of the condition block. + //!\param _modifier condition modifier. default value is none. + //!\sa condition_modifier + explicit condition_block( const std::string& _condition_name, const condition_modifier& _modifier = condition_modifier::NONE ); + virtual ~condition_block() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( condition_block ) + + //!\brief create the output for a step. + //!\param _recipe_callback generator callback + //!\param _ostream stream to which the generator writes. + virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; + + +private: + void apply_modifier( bool& _result ) const; + + const std::string condition_name_; + const condition_modifier modifier_; + + +}; + + +} + + +} + + +#endif diff --git a/genesis/include/condition_modifier.hpp b/externals/genesis/source/genesis/include/condition_modifier.hpp similarity index 96% rename from genesis/include/condition_modifier.hpp rename to externals/genesis/source/genesis/include/condition_modifier.hpp index ae2dbd4..ae1e766 100644 --- a/genesis/include/condition_modifier.hpp +++ b/externals/genesis/source/genesis/include/condition_modifier.hpp @@ -1,102 +1,102 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef CONDITION_MODIFIER_5286AF53_4751_4FDE_B4C9_E097AC8FB331 -#define CONDITION_MODIFIER_5286AF53_4751_4FDE_B4C9_E097AC8FB331 - - -#include - - -namespace sx -{ - - -namespace genesis -{ - - -#ifndef SX_CPP03_BOOST - -//!\enum condition_modifier -//!\brief Modifier for conditions. E.g. negate the result of a check. -enum class condition_modifier -{ - NONE = 0, NOT = 1 -}; - - -#else - - - //!\struct condition_modifier - //!\brief Structure representing a predefined modifier for conditions (enum wrapper for C++11 enum class like behavior). - struct condition_modifier - { - //!\enum condition_modifier - //!\brief Enumeration for predefined modifier for conditions. - enum inner - { - NONE = 0, NOT = 1 - }; - - - //!\brief Constructor. Default value is white. - condition_modifier() : value_( NONE ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _value Given modifier for conditions value that is represented by the structure. - condition_modifier( const inner _value ) : value_( _value ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _condition_modifier Given modifier for conditions structure containing the modifier for conditions that is represented by the structure. - condition_modifier( const condition_modifier& _condition_modifier ) : value_( _condition_modifier.value_ ) - { - // Nothing to do... - } - - - //!\brief Get the modifier for conditions value represented by the structure. - operator inner() const - { - return ( value_ ); - } - - - //!\brief Modifier for conditions represented by the structure. - inner value_; - - }; - - -#endif - - -//!\fn -//!\brief Get the condition modifier value from a string. -//!\param _condition_modifier Modifier as a string, generally read from template files. -//!\return Condition modifier enum value corresponding to the given value. -condition_modifier get_condition_modifier_from_string( const std::string& _condition_modifier ); - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef CONDITION_MODIFIER_5286AF53_4751_4FDE_B4C9_E097AC8FB331 +#define CONDITION_MODIFIER_5286AF53_4751_4FDE_B4C9_E097AC8FB331 + + +#include + + +namespace sx +{ + + +namespace genesis +{ + + +#ifndef SX_CPP03_BOOST + +//!\enum condition_modifier +//!\brief Modifier for conditions. E.g. negate the result of a check. +enum class condition_modifier +{ + NONE = 0, NOT = 1 +}; + + +#else + + + //!\struct condition_modifier + //!\brief Structure representing a predefined modifier for conditions (enum wrapper for C++11 enum class like behavior). + struct condition_modifier + { + //!\enum condition_modifier + //!\brief Enumeration for predefined modifier for conditions. + enum inner + { + NONE = 0, NOT = 1 + }; + + + //!\brief Constructor. Default value is white. + condition_modifier() : value_( NONE ) + { + // Nothing to do... + } + + + //!\brief Constructor + //!\param _value Given modifier for conditions value that is represented by the structure. + condition_modifier( const inner _value ) : value_( _value ) + { + // Nothing to do... + } + + + //!\brief Constructor + //!\param _condition_modifier Given modifier for conditions structure containing the modifier for conditions that is represented by the structure. + condition_modifier( const condition_modifier& _condition_modifier ) : value_( _condition_modifier.value_ ) + { + // Nothing to do... + } + + + //!\brief Get the modifier for conditions value represented by the structure. + operator inner() const + { + return ( value_ ); + } + + + //!\brief Modifier for conditions represented by the structure. + inner value_; + + }; + + +#endif + + +//!\fn +//!\brief Get the condition modifier value from a string. +//!\param _condition_modifier Modifier as a string, generally read from template files. +//!\return Condition modifier enum value corresponding to the given value. +condition_modifier get_condition_modifier_from_string( const std::string& _condition_modifier ); + + +} + + +} + + +#endif diff --git a/genesis/include/file_reader.hpp b/externals/genesis/source/genesis/include/file_reader.hpp similarity index 97% rename from genesis/include/file_reader.hpp rename to externals/genesis/source/genesis/include/file_reader.hpp index 9e9be92..e066747 100644 --- a/genesis/include/file_reader.hpp +++ b/externals/genesis/source/genesis/include/file_reader.hpp @@ -1,39 +1,39 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef FILE_READER_20EC6A5D_A4B2_4EDC_9B67_57B4B0A0DA31 -#define FILE_READER_20EC6A5D_A4B2_4EDC_9B67_57B4B0A0DA31 - - -#include - - -namespace sx -{ - - -namespace genesis -{ - - -//!\fn -//!\brief Function that reads a file into a given string variable. -//!\param _file_path File that is read. -//!\param _content Target for the content of the file. -//!\return True if the read was successful, false otherwise. -bool read( const std::string& _file_path, std::string& _content ); - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef FILE_READER_20EC6A5D_A4B2_4EDC_9B67_57B4B0A0DA31 +#define FILE_READER_20EC6A5D_A4B2_4EDC_9B67_57B4B0A0DA31 + + +#include + + +namespace sx +{ + + +namespace genesis +{ + + +//!\fn +//!\brief Function that reads a file into a given string variable. +//!\param _file_path File that is read. +//!\param _content Target for the content of the file. +//!\return True if the read was successful, false otherwise. +bool read( const std::string& _file_path, std::string& _content ); + + +} + + +} + + +#endif diff --git a/genesis/include/file_writer.hpp b/externals/genesis/source/genesis/include/file_writer.hpp similarity index 97% rename from genesis/include/file_writer.hpp rename to externals/genesis/source/genesis/include/file_writer.hpp index d1f6170..635e36d 100644 --- a/genesis/include/file_writer.hpp +++ b/externals/genesis/source/genesis/include/file_writer.hpp @@ -1,37 +1,37 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef FILE_WRITER_27D8B8DE_AD70_4536_857C_1D75B5D34EB8 -#define FILE_WRITER_27D8B8DE_AD70_4536_857C_1D75B5D34EB8 - - -#include - - -namespace sx -{ - - -namespace genesis -{ - - -//!\fn -//!\brief Function that writes the content of a ostream to the file with the given name. -//!\param _file_path Name of the file that will be written. -//!\param _output_stream Stream that is written to the file. -void write( const std::string& _file_path, const std::ostream& _output_stream ); - - -} - - -} - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef FILE_WRITER_27D8B8DE_AD70_4536_857C_1D75B5D34EB8 +#define FILE_WRITER_27D8B8DE_AD70_4536_857C_1D75B5D34EB8 + + +#include + + +namespace sx +{ + + +namespace genesis +{ + + +//!\fn +//!\brief Function that writes the content of a ostream to the file with the given name. +//!\param _file_path Name of the file that will be written. +//!\param _output_stream Stream that is written to the file. +void write( const std::string& _file_path, const std::ostream& _output_stream ); + + +} + + +} + +#endif diff --git a/genesis/include/genesis_exception.hpp b/externals/genesis/source/genesis/include/genesis_exception.hpp similarity index 97% rename from genesis/include/genesis_exception.hpp rename to externals/genesis/source/genesis/include/genesis_exception.hpp index bb7cfbd..c508b19 100644 --- a/genesis/include/genesis_exception.hpp +++ b/externals/genesis/source/genesis/include/genesis_exception.hpp @@ -1,35 +1,35 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef GENESIS_EXCEPTION_FDA50E1B_5130_4353_9100_E40405E1C32D -#define GENESIS_EXCEPTION_FDA50E1B_5130_4353_9100_E40405E1C32D - - -#include "essentials/exception_template.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -//!\brief Exception class of the genesis library. -SX_EXCEPTION( genesis_exception ) - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef GENESIS_EXCEPTION_FDA50E1B_5130_4353_9100_E40405E1C32D +#define GENESIS_EXCEPTION_FDA50E1B_5130_4353_9100_E40405E1C32D + + +#include "essentials/exception_template.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +//!\brief Exception class of the genesis library. +SX_EXCEPTION( genesis_exception ) + + +} + + +} + + +#endif diff --git a/genesis/include/grammar.hpp b/externals/genesis/source/genesis/include/grammar.hpp similarity index 97% rename from genesis/include/grammar.hpp rename to externals/genesis/source/genesis/include/grammar.hpp index 4bfb86f..0253805 100644 --- a/genesis/include/grammar.hpp +++ b/externals/genesis/source/genesis/include/grammar.hpp @@ -1,56 +1,56 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef GRAMMAR_F628CCE8_06DD_43A9_BEE3_C3EB343AC539 -#define GRAMMAR_F628CCE8_06DD_43A9_BEE3_C3EB343AC539 - - -#include - - -namespace sx -{ - - -namespace genesis -{ - - -extern const std::string condition_modifier_NOT; -extern const std::string condition_modifier_NONE; -extern const char DELIMITER_CHAR; -extern const char LINE_BREAK_CHAR; -extern const char OPEN_PARENTHESIS_CHAR; -extern const char CLOSE_PARENTHESIS_CHAR; -extern const char COMMA_CHAR; -extern const std::string COMMA_CLOSE_PARENTHESIS; -extern const std::string VARIABLE_COMMAND; -extern const std::string LOOP_START_COMMAND; -extern const std::string LOOP_END_COMMAND; -extern const std::string IF_START_COMMAND; -extern const std::string IF_END_COMMAND; -extern const std::string SWITCH_START_COMMAND; -extern const std::string SWITCH_END_COMMAND; -extern const std::string SWITCH_CASE_START_COMMAND; -extern const std::string SWITCH_CASE_END_COMMAND; -extern const std::string SWITCH_DEFAULT_START_COMMAND; -extern const std::string SWITCH_DEFAULT_END_COMMAND; -extern const int SWITCH_DEFAULT_INDEX_VALUE; -extern const std::string TEMPLATE_COMMAND; -extern const char NEW_LINE_CHAR; -extern const std::size_t SIZE_ONE; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef GRAMMAR_F628CCE8_06DD_43A9_BEE3_C3EB343AC539 +#define GRAMMAR_F628CCE8_06DD_43A9_BEE3_C3EB343AC539 + + +#include + + +namespace sx +{ + + +namespace genesis +{ + + +extern const std::string condition_modifier_NOT; +extern const std::string condition_modifier_NONE; +extern const char DELIMITER_CHAR; +extern const char LINE_BREAK_CHAR; +extern const char OPEN_PARENTHESIS_CHAR; +extern const char CLOSE_PARENTHESIS_CHAR; +extern const char COMMA_CHAR; +extern const std::string COMMA_CLOSE_PARENTHESIS; +extern const std::string VARIABLE_COMMAND; +extern const std::string LOOP_START_COMMAND; +extern const std::string LOOP_END_COMMAND; +extern const std::string IF_START_COMMAND; +extern const std::string IF_END_COMMAND; +extern const std::string SWITCH_START_COMMAND; +extern const std::string SWITCH_END_COMMAND; +extern const std::string SWITCH_CASE_START_COMMAND; +extern const std::string SWITCH_CASE_END_COMMAND; +extern const std::string SWITCH_DEFAULT_START_COMMAND; +extern const std::string SWITCH_DEFAULT_END_COMMAND; +extern const int SWITCH_DEFAULT_INDEX_VALUE; +extern const std::string TEMPLATE_COMMAND; +extern const char NEW_LINE_CHAR; +extern const std::size_t SIZE_ONE; + + +} + + +} + + +#endif diff --git a/genesis/include/loop_block.hpp b/externals/genesis/source/genesis/include/loop_block.hpp similarity index 96% rename from genesis/include/loop_block.hpp rename to externals/genesis/source/genesis/include/loop_block.hpp index 6b7b453..02ee0bf 100644 --- a/genesis/include/loop_block.hpp +++ b/externals/genesis/source/genesis/include/loop_block.hpp @@ -1,54 +1,54 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef LOOP_BLOCK_08F296C5_8660_453B_9AE3_903E1AEE52D9 -#define LOOP_BLOCK_08F296C5_8660_453B_9AE3_903E1AEE52D9 - - -#include "recipe_block.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -//!\class loop_block -//!\brief Class representing a loop. This block can have children. -class loop_block SX_FINAL - : public recipe_block -{ -public: - //!\brief Constructor - //!\param _loop_name Name of the loop block. - explicit loop_block( const std::string& _loop_name); - virtual ~loop_block() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( loop_block ) - - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream Stream to which the generator writes. - virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; - - -private: - const std::string loop_name_; -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef LOOP_BLOCK_08F296C5_8660_453B_9AE3_903E1AEE52D9 +#define LOOP_BLOCK_08F296C5_8660_453B_9AE3_903E1AEE52D9 + + +#include "recipe_block.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +//!\class loop_block +//!\brief Class representing a loop. This block can have children. +class loop_block SX_FINAL + : public recipe_block +{ +public: + //!\brief Constructor + //!\param _loop_name Name of the loop block. + explicit loop_block( const std::string& _loop_name); + virtual ~loop_block() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( loop_block ) + + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream Stream to which the generator writes. + virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; + + +private: + const std::string loop_name_; +}; + + +} + + +} + + +#endif diff --git a/genesis/include/messages.hpp b/externals/genesis/source/genesis/include/messages.hpp similarity index 96% rename from genesis/include/messages.hpp rename to externals/genesis/source/genesis/include/messages.hpp index 9a4bef3..2ac68ba 100644 --- a/genesis/include/messages.hpp +++ b/externals/genesis/source/genesis/include/messages.hpp @@ -1,35 +1,35 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef MESSAGES_790A336F_D398_4F59_93F0_8C44B7267E3D -#define MESSAGES_790A336F_D398_4F59_93F0_8C44B7267E3D - - -#include - - -namespace sx -{ - - -namespace genesis -{ - - -//!\brief Message for reporting an error while writing a file. -extern const std::string ERROR_WRITE_FILE; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef MESSAGES_790A336F_D398_4F59_93F0_8C44B7267E3D +#define MESSAGES_790A336F_D398_4F59_93F0_8C44B7267E3D + + +#include + + +namespace sx +{ + + +namespace genesis +{ + + +//!\brief Message for reporting an error while writing a file. +extern const std::string ERROR_WRITE_FILE; + + +} + + +} + + +#endif diff --git a/genesis/include/recipe.hpp b/externals/genesis/source/genesis/include/recipe.hpp similarity index 96% rename from genesis/include/recipe.hpp rename to externals/genesis/source/genesis/include/recipe.hpp index 0da0794..7ff6a88 100644 --- a/genesis/include/recipe.hpp +++ b/externals/genesis/source/genesis/include/recipe.hpp @@ -1,64 +1,64 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef RECIPE_20F2FCF1_99D0_4CC6_9E59_3E9BE7C1A2A6 -#define RECIPE_20F2FCF1_99D0_4CC6_9E59_3E9BE7C1A2A6 - - -#include "template_block.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -class recipe_step; - -//!\class recipe -//!\brief Class for generating code from the given template and using the given callback. It can write the generated code -//!\to the given file. -class recipe : public template_block -{ -public: - //!\brief Constructor - //!\param _template_name Name of the file containing the used template. - //!\param _recipe_callback Generator callback - //!\param _templates_path Path to the templates folder. - explicit recipe( const std::string& _template_name, recipe_callback& _recipe_callback, - const std::string& _templates_path ); - virtual ~recipe() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( recipe ) - - //!\brief Generates the code in a internal stream. - void generate(); - - //!\brief Write the generated code to the file with the given name. - //!\param _file_path Path of the while to which the generated code will be written. - void write_to_file( const std::string& _file_path ) const; - - -private: - void create_impl( recipe_callback& _recipe_callback ); - - recipe_callback& recipe_callback_; - std::stringstream stream_; -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef RECIPE_20F2FCF1_99D0_4CC6_9E59_3E9BE7C1A2A6 +#define RECIPE_20F2FCF1_99D0_4CC6_9E59_3E9BE7C1A2A6 + + +#include "template_block.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +class recipe_step; + +//!\class recipe +//!\brief Class for generating code from the given template and using the given callback. It can write the generated code +//!\to the given file. +class recipe : public template_block +{ +public: + //!\brief Constructor + //!\param _template_name Name of the file containing the used template. + //!\param _recipe_callback Generator callback + //!\param _templates_path Path to the templates folder. + explicit recipe( const std::string& _template_name, recipe_callback& _recipe_callback, + const std::string& _templates_path ); + virtual ~recipe() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( recipe ) + + //!\brief Generates the code in a internal stream. + void generate(); + + //!\brief Write the generated code to the file with the given name. + //!\param _file_path Path of the while to which the generated code will be written. + void write_to_file( const std::string& _file_path ) const; + + +private: + void create_impl( recipe_callback& _recipe_callback ); + + recipe_callback& recipe_callback_; + std::stringstream stream_; +}; + + +} + + +} + + +#endif diff --git a/genesis/include/recipe_block.hpp b/externals/genesis/source/genesis/include/recipe_block.hpp similarity index 96% rename from genesis/include/recipe_block.hpp rename to externals/genesis/source/genesis/include/recipe_block.hpp index 73d72ea..339127e 100644 --- a/genesis/include/recipe_block.hpp +++ b/externals/genesis/source/genesis/include/recipe_block.hpp @@ -1,59 +1,59 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef RECIPE_BLOCK_A5AF03FF_E23E_4887_A4C8_44C6E8605983 -#define RECIPE_BLOCK_A5AF03FF_E23E_4887_A4C8_44C6E8605983 - - -#include - -#include "recipe_step.hpp" - - -namespace sx -{ - - -namespace genesis -{ - -//!\class recipe_block -//!\brief Class that represents a recipe block. This block can have children. -class recipe_block : public recipe_step -{ -public: - //!\brief Constructor - explicit recipe_block(); - virtual ~recipe_block() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( recipe_block ) - - //!\brief Add a child to the list of children. - //!\param _child New child - virtual void add_child( sxe::SX_UNIQUE_PTR _child ); - - -protected: - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream Stream to which the generator writes. - virtual void create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ); - - -private: - std::vector< sxe::SX_UNIQUE_PTR > child_recipes_; -}; - - -} - - -} - - +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef RECIPE_BLOCK_A5AF03FF_E23E_4887_A4C8_44C6E8605983 +#define RECIPE_BLOCK_A5AF03FF_E23E_4887_A4C8_44C6E8605983 + + +#include + +#include "recipe_step.hpp" + + +namespace sx +{ + + +namespace genesis +{ + +//!\class recipe_block +//!\brief Class that represents a recipe block. This block can have children. +class recipe_block : public recipe_step +{ +public: + //!\brief Constructor + explicit recipe_block(); + virtual ~recipe_block() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( recipe_block ) + + //!\brief Add a child to the list of children. + //!\param _child New child + virtual void add_child( sxe::SX_UNIQUE_PTR _child ); + + +protected: + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream Stream to which the generator writes. + virtual void create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ); + + +private: + std::vector< sxe::SX_UNIQUE_PTR > child_recipes_; +}; + + +} + + +} + + #endif \ No newline at end of file diff --git a/genesis/include/recipe_callback.hpp b/externals/genesis/source/genesis/include/recipe_callback.hpp similarity index 97% rename from genesis/include/recipe_callback.hpp rename to externals/genesis/source/genesis/include/recipe_callback.hpp index 4d80fe7..46c696d 100644 --- a/genesis/include/recipe_callback.hpp +++ b/externals/genesis/source/genesis/include/recipe_callback.hpp @@ -1,98 +1,98 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef RECIPE_CALLBACK_94CA6C50_A463_41C9_B424_D595F361B6C2 -#define RECIPE_CALLBACK_94CA6C50_A463_41C9_B424_D595F361B6C2 - - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/non_copyable.hpp" - -#include "condition_modifier.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -//!\interface -//!\brief Callback Interface that needs to be implemented by a generator. -class recipe_callback -{ -public: - //!\brief Constructor - explicit recipe_callback() - { - // Nothing to do... - } - - - virtual ~recipe_callback() SX_NOEXCEPT - { - // Nothing to do... - } - - - SX_NO_COPY( recipe_callback ) - - //!\brief Get the content of a variable. - //!\param _variable_name Name of the variable for which the value is requested. - //!\return String Value of the given variable. - virtual std::string get_variable_content( const std::string& _variable_name ) = 0; - - //!\brief Check the condition of a loop_block. - //!\param _loop_name Name of the loop block that is executed. - virtual bool check_loop_condition( const std::string& _loop_name ) const = 0; - - //!\brief Execute actions before a loop_block. - //!\param _loop_name Name of the loop block that is executed. - virtual void before_loop( const std::string& _loop_name ) = 0; - - //!\brief Execute actions before an iteration of a loop_block. - //!\param _loop_name Name of the loop block that is executed. - virtual void before_loop_iteration( const std::string& _loop_name ) = 0; - - //!\brief Execute actions after an iteration of a loop_block. - //!\param _loop_name Name of the loop block that is executed. - virtual void after_loop_iteration( const std::string& _loop_name ) = 0; - - //!\brief Execute actions after a loop_block. - //!\param _loop_name Name of the loop block that is executed. - virtual void after_loop( const std::string& _loop_name ) = 0; - - //!\brief Check the condition of a condition_block. - //!\param _loop_name Name of the condition block that is executed. - virtual bool check_condition( const std::string& _condition_name ) const = 0; - - //!\brief Execute actions before a condition_block. - //!\param _loop_name Name of the condition block that is executed. - virtual void condition_begin( const std::string& _condition_name ) = 0; - - //!\brief Execute actions after a condition_block. - //!\param _loop_name Name of the condition block that is executed. - virtual void condition_end( const std::string& _condition_name ) = 0; - - //!\brief Returns the index of the case of the switch with the given name which shall be executed. - //!\param _switch_name Name of the switch block for which the case index is requested. - //!\return The index of the case that shall be executed. - virtual int get_switch_case( const std::string& _switch_name ) = 0; -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef RECIPE_CALLBACK_94CA6C50_A463_41C9_B424_D595F361B6C2 +#define RECIPE_CALLBACK_94CA6C50_A463_41C9_B424_D595F361B6C2 + + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/non_copyable.hpp" + +#include "condition_modifier.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +//!\interface +//!\brief Callback Interface that needs to be implemented by a generator. +class recipe_callback +{ +public: + //!\brief Constructor + explicit recipe_callback() + { + // Nothing to do... + } + + + virtual ~recipe_callback() SX_NOEXCEPT + { + // Nothing to do... + } + + + SX_NO_COPY( recipe_callback ) + + //!\brief Get the content of a variable. + //!\param _variable_name Name of the variable for which the value is requested. + //!\return String Value of the given variable. + virtual std::string get_variable_content( const std::string& _variable_name ) = 0; + + //!\brief Check the condition of a loop_block. + //!\param _loop_name Name of the loop block that is executed. + virtual bool check_loop_condition( const std::string& _loop_name ) const = 0; + + //!\brief Execute actions before a loop_block. + //!\param _loop_name Name of the loop block that is executed. + virtual void before_loop( const std::string& _loop_name ) = 0; + + //!\brief Execute actions before an iteration of a loop_block. + //!\param _loop_name Name of the loop block that is executed. + virtual void before_loop_iteration( const std::string& _loop_name ) = 0; + + //!\brief Execute actions after an iteration of a loop_block. + //!\param _loop_name Name of the loop block that is executed. + virtual void after_loop_iteration( const std::string& _loop_name ) = 0; + + //!\brief Execute actions after a loop_block. + //!\param _loop_name Name of the loop block that is executed. + virtual void after_loop( const std::string& _loop_name ) = 0; + + //!\brief Check the condition of a condition_block. + //!\param _loop_name Name of the condition block that is executed. + virtual bool check_condition( const std::string& _condition_name ) const = 0; + + //!\brief Execute actions before a condition_block. + //!\param _loop_name Name of the condition block that is executed. + virtual void condition_begin( const std::string& _condition_name ) = 0; + + //!\brief Execute actions after a condition_block. + //!\param _loop_name Name of the condition block that is executed. + virtual void condition_end( const std::string& _condition_name ) = 0; + + //!\brief Returns the index of the case of the switch with the given name which shall be executed. + //!\param _switch_name Name of the switch block for which the case index is requested. + //!\return The index of the case that shall be executed. + virtual int get_switch_case( const std::string& _switch_name ) = 0; +}; + + +} + + +} + + +#endif diff --git a/genesis/include/recipe_step.hpp b/externals/genesis/source/genesis/include/recipe_step.hpp similarity index 96% rename from genesis/include/recipe_step.hpp rename to externals/genesis/source/genesis/include/recipe_step.hpp index 553992f..aa0418b 100644 --- a/genesis/include/recipe_step.hpp +++ b/externals/genesis/source/genesis/include/recipe_step.hpp @@ -1,63 +1,63 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef RECIPE_STEP_1A42F342_F0C6_49C9_8FC3_0BAEDFBD05AE -#define RECIPE_STEP_1A42F342_F0C6_49C9_8FC3_0BAEDFBD05AE - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/non_copyable.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -class recipe_callback; - - -//!\interface recipe_step -//!\brief A step of a recipe. -class recipe_step -{ -public: - //!\brief Constructor - recipe_step() - { - // Nothing to do... - } - - - virtual ~recipe_step() SX_NOEXCEPT - { - // Nothing to do... - } - - - SX_NO_COPY( recipe_step ) - - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream Stream to which the generator writes. - virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) = 0; -}; - - -} - - -} - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef RECIPE_STEP_1A42F342_F0C6_49C9_8FC3_0BAEDFBD05AE +#define RECIPE_STEP_1A42F342_F0C6_49C9_8FC3_0BAEDFBD05AE + + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/non_copyable.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +class recipe_callback; + + +//!\interface recipe_step +//!\brief A step of a recipe. +class recipe_step +{ +public: + //!\brief Constructor + recipe_step() + { + // Nothing to do... + } + + + virtual ~recipe_step() SX_NOEXCEPT + { + // Nothing to do... + } + + + SX_NO_COPY( recipe_step ) + + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream Stream to which the generator writes. + virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) = 0; +}; + + +} + + +} + +#endif diff --git a/genesis/include/switch_block.hpp b/externals/genesis/source/genesis/include/switch_block.hpp similarity index 97% rename from genesis/include/switch_block.hpp rename to externals/genesis/source/genesis/include/switch_block.hpp index 3ad8e38..331068c 100644 --- a/genesis/include/switch_block.hpp +++ b/externals/genesis/source/genesis/include/switch_block.hpp @@ -1,75 +1,75 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SWITCH_BLOCK_DBBA48C9_294D_4F33_8424_CCD31767B4BC -#define SWITCH_BLOCK_DBBA48C9_294D_4F33_8424_CCD31767B4BC - - -#include "recipe_block.hpp" - -#include - - -namespace sx -{ - - -namespace genesis -{ - - -//!\class switch_block -//!\brief class representing an 'switch'. This block can have children. -class switch_block SX_FINAL - : public recipe_block -{ -public: - //!\brief constructor - //!\param _switch_name Name of the switch block. - explicit switch_block( const std::string& _switch_name ); - virtual ~switch_block() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( switch_block ) - - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream stream to which the generator writes. - virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; - - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream Stream to which the generator writes. - virtual void create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; - - //!\brief Add a child to the list of children. - //!\param _child New child - virtual void add_child( sxe::SX_UNIQUE_PTR _child ) SX_OVERRIDE; - - - //!\brief Set the internal index for the current case. This is only used during parsing of a template. - //!\param _index Index value. Index value must be greater than or equal to zero. - void set_case_index( const int _index ); - - -private: - const std::string switch_name_; - int current_case_index_; - std::map< int, std::vector< sxe::SX_UNIQUE_PTR > > switch_cases_; - std::vector< sxe::SX_UNIQUE_PTR > default_; - - -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SWITCH_BLOCK_DBBA48C9_294D_4F33_8424_CCD31767B4BC +#define SWITCH_BLOCK_DBBA48C9_294D_4F33_8424_CCD31767B4BC + + +#include "recipe_block.hpp" + +#include + + +namespace sx +{ + + +namespace genesis +{ + + +//!\class switch_block +//!\brief class representing an 'switch'. This block can have children. +class switch_block SX_FINAL + : public recipe_block +{ +public: + //!\brief constructor + //!\param _switch_name Name of the switch block. + explicit switch_block( const std::string& _switch_name ); + virtual ~switch_block() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( switch_block ) + + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream stream to which the generator writes. + virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; + + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream Stream to which the generator writes. + virtual void create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; + + //!\brief Add a child to the list of children. + //!\param _child New child + virtual void add_child( sxe::SX_UNIQUE_PTR _child ) SX_OVERRIDE; + + + //!\brief Set the internal index for the current case. This is only used during parsing of a template. + //!\param _index Index value. Index value must be greater than or equal to zero. + void set_case_index( const int _index ); + + +private: + const std::string switch_name_; + int current_case_index_; + std::map< int, std::vector< sxe::SX_UNIQUE_PTR > > switch_cases_; + std::vector< sxe::SX_UNIQUE_PTR > default_; + + +}; + + +} + + +} + + +#endif diff --git a/genesis/include/template_block.hpp b/externals/genesis/source/genesis/include/template_block.hpp similarity index 96% rename from genesis/include/template_block.hpp rename to externals/genesis/source/genesis/include/template_block.hpp index c284590..f9ac035 100644 --- a/genesis/include/template_block.hpp +++ b/externals/genesis/source/genesis/include/template_block.hpp @@ -1,103 +1,103 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef TEMPLATE_BLOCK_43849414_0A6E_429C_9D51_FB0562A58B05 -#define TEMPLATE_BLOCK_43849414_0A6E_429C_9D51_FB0562A58B05 - - -#include - -#include "recipe_block.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -class text_step; -class variable_step; -class loop_block; -class condition_block; - - -//!\class template_block -//!\brief Class representing a recipe block created from a template file. -class template_block - : public recipe_block -{ -public: - //!\brief Constructor. Get the template file name and the path to the template directory. - //!\param _template_name Name of the template file. - //!\param _template_path Path to templates directory - explicit template_block( const std::string& _template_name, const std::string& _template_path ); - virtual ~template_block() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( template_block ) - - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream Stream to which the generator writes. - virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; - - -private: - void parse( std::string& _file_buffer ); - void get_text( std::string &_file_buffer ); - std::string get_keyword( std::string& _file_buffer ); - void get_variable( std::string &_file_buffer ); - void get_loop( std::string &_file_buffer ); - void get_if( std::string &_file_buffer ); - void get_switch( std::string& _file_buffer ); - void get_switch_case( std::string& _file_buffer ); - void get_switch_default( std::string& _file_buffer ); - void get_template( std::string &_file_buffer ); - const std::string get_last_to_be_closed() const; - static std::string read_template_file( const std::string& _file_buffer, const std::string& _templates_path ); - void check_new_line_after_end_command( std::string &_file_buffer ); - void close_loop( std::string& _file_buffer ); - void close_condition( std::string& _file_buffer ); - void close_switch( std::string& _file_buffer ); - void close_switch_case( std::string& _file_buffer ); - void close_switch_default( std::string& _file_buffer ); - bool is_any_recipe_open() const; - std::vector get_parameters( std::string& _file_buffer ) const; - void final_check() const; - - template - void add_child_to_recipe( sxe::SX_UNIQUE_PTR _child ) - { - if( opened_recipes_.empty() ) - { - add_child( sxe::move( _child ) ); - } - else - { - opened_recipes_.top()->add_child( sxe::move( _child ) ); - } - } - - - std::stack opened_recipes_; - std::vector keywords_; - std::string template_to_parse_; - const std::string& template_path_; - const std::string& template_file_; -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef TEMPLATE_BLOCK_43849414_0A6E_429C_9D51_FB0562A58B05 +#define TEMPLATE_BLOCK_43849414_0A6E_429C_9D51_FB0562A58B05 + + +#include + +#include "recipe_block.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +class text_step; +class variable_step; +class loop_block; +class condition_block; + + +//!\class template_block +//!\brief Class representing a recipe block created from a template file. +class template_block + : public recipe_block +{ +public: + //!\brief Constructor. Get the template file name and the path to the template directory. + //!\param _template_name Name of the template file. + //!\param _template_path Path to templates directory + explicit template_block( const std::string& _template_name, const std::string& _template_path ); + virtual ~template_block() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( template_block ) + + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream Stream to which the generator writes. + virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; + + +private: + void parse( std::string& _file_buffer ); + void get_text( std::string &_file_buffer ); + std::string get_keyword( std::string& _file_buffer ); + void get_variable( std::string &_file_buffer ); + void get_loop( std::string &_file_buffer ); + void get_if( std::string &_file_buffer ); + void get_switch( std::string& _file_buffer ); + void get_switch_case( std::string& _file_buffer ); + void get_switch_default( std::string& _file_buffer ); + void get_template( std::string &_file_buffer ); + const std::string get_last_to_be_closed() const; + static std::string read_template_file( const std::string& _file_buffer, const std::string& _templates_path ); + void check_new_line_after_end_command( std::string &_file_buffer ); + void close_loop( std::string& _file_buffer ); + void close_condition( std::string& _file_buffer ); + void close_switch( std::string& _file_buffer ); + void close_switch_case( std::string& _file_buffer ); + void close_switch_default( std::string& _file_buffer ); + bool is_any_recipe_open() const; + std::vector get_parameters( std::string& _file_buffer ) const; + void final_check() const; + + template + void add_child_to_recipe( sxe::SX_UNIQUE_PTR _child ) + { + if( opened_recipes_.empty() ) + { + add_child( sxe::move( _child ) ); + } + else + { + opened_recipes_.top()->add_child( sxe::move( _child ) ); + } + } + + + std::stack opened_recipes_; + std::vector keywords_; + std::string template_to_parse_; + const std::string& template_path_; + const std::string& template_file_; +}; + + +} + + +} + + +#endif diff --git a/genesis/include/text_step.hpp b/externals/genesis/source/genesis/include/text_step.hpp similarity index 96% rename from genesis/include/text_step.hpp rename to externals/genesis/source/genesis/include/text_step.hpp index fc7548d..566c90f 100644 --- a/genesis/include/text_step.hpp +++ b/externals/genesis/source/genesis/include/text_step.hpp @@ -1,54 +1,54 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef TEXT_STEP_56DA4C34_9848_4123_AB65_1C9839E009A2 -#define TEXT_STEP_56DA4C34_9848_4123_AB65_1C9839E009A2 - - -#include "recipe_step.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -//!\class test_step -//!\brief Class representing a text step of the recipe. -class text_step SX_FINAL - : public recipe_step -{ -public: - //!\brief Constructor - //!\param _text Content of the text block. - explicit text_step( const std::string& _text ); - virtual ~text_step() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( text_step ) - - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream Stream to which the generator writes. - virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; - - -private: - const std::string text_; -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef TEXT_STEP_56DA4C34_9848_4123_AB65_1C9839E009A2 +#define TEXT_STEP_56DA4C34_9848_4123_AB65_1C9839E009A2 + + +#include "recipe_step.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +//!\class test_step +//!\brief Class representing a text step of the recipe. +class text_step SX_FINAL + : public recipe_step +{ +public: + //!\brief Constructor + //!\param _text Content of the text block. + explicit text_step( const std::string& _text ); + virtual ~text_step() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( text_step ) + + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream Stream to which the generator writes. + virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; + + +private: + const std::string text_; +}; + + +} + + +} + + +#endif diff --git a/genesis/include/variable_step.hpp b/externals/genesis/source/genesis/include/variable_step.hpp similarity index 96% rename from genesis/include/variable_step.hpp rename to externals/genesis/source/genesis/include/variable_step.hpp index c8ae270..f0aebe6 100644 --- a/genesis/include/variable_step.hpp +++ b/externals/genesis/source/genesis/include/variable_step.hpp @@ -1,54 +1,54 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef VARIABLE_STEP_11B39100_54E6_40E4_85FC_0A642202937C -#define VARIABLE_STEP_11B39100_54E6_40E4_85FC_0A642202937C - - -#include "recipe_step.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -//!\class variable_step -//!\brief Class representing a variable step of the recipe. -class variable_step SX_FINAL - : public recipe_step -{ -public: - //!\brief Constructor - //!\param _variable_name Name of the variable represented by the variable_step. - explicit variable_step( const std::string& _variable_name ); - virtual ~variable_step() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY( variable_step ) - - //!\brief Create the output for a step. - //!\param _recipe_callback Generator callback - //!\param _ostream Stream to which the generator writes. - virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; - - -private: - const std::string variable_name_; -}; - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef VARIABLE_STEP_11B39100_54E6_40E4_85FC_0A642202937C +#define VARIABLE_STEP_11B39100_54E6_40E4_85FC_0A642202937C + + +#include "recipe_step.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +//!\class variable_step +//!\brief Class representing a variable step of the recipe. +class variable_step SX_FINAL + : public recipe_step +{ +public: + //!\brief Constructor + //!\param _variable_name Name of the variable represented by the variable_step. + explicit variable_step( const std::string& _variable_name ); + virtual ~variable_step() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY( variable_step ) + + //!\brief Create the output for a step. + //!\param _recipe_callback Generator callback + //!\param _ostream Stream to which the generator writes. + virtual void create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) SX_OVERRIDE; + + +private: + const std::string variable_name_; +}; + + +} + + +} + + +#endif diff --git a/genesis/include/version.hpp b/externals/genesis/source/genesis/include/version.hpp similarity index 96% rename from genesis/include/version.hpp rename to externals/genesis/source/genesis/include/version.hpp index aede3f0..e21a917 100644 --- a/genesis/include/version.hpp +++ b/externals/genesis/source/genesis/include/version.hpp @@ -1,48 +1,48 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef VERSION_11BB60D2_9C1A_4102_BBCC_0486F61F9C1C -#define VERSION_11BB60D2_9C1A_4102_BBCC_0486F61F9C1C - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -namespace version -{ - - -void log_version(); - - -sxe::uint16_t get_major_version(); -sxe::uint16_t get_minor_version(); -sxe::uint16_t get_patch_version(); -sxe::uint16_t get_build_number(); - - -} - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef VERSION_11BB60D2_9C1A_4102_BBCC_0486F61F9C1C +#define VERSION_11BB60D2_9C1A_4102_BBCC_0486F61F9C1C + + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +namespace version +{ + + +void log_version(); + + +sxe::uint16_t get_major_version(); +sxe::uint16_t get_minor_version(); +sxe::uint16_t get_patch_version(); +sxe::uint16_t get_build_number(); + + +} + + +} + + +} + + +#endif diff --git a/genesis/source/condition_block.cpp b/externals/genesis/source/genesis/source/condition_block.cpp similarity index 96% rename from genesis/source/condition_block.cpp rename to externals/genesis/source/genesis/source/condition_block.cpp index 32e101a..66dc01e 100644 --- a/genesis/source/condition_block.cpp +++ b/externals/genesis/source/genesis/source/condition_block.cpp @@ -1,75 +1,75 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "condition_block.hpp" - -#include "essentials/exception.hpp" - -#include "recipe_callback.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -condition_block::condition_block( const std::string& _condition_name, const condition_modifier& _modifier ) : - recipe_block(), - condition_name_( _condition_name ), - modifier_( _modifier ) -{ - // Nothing to do... -} - - -condition_block::~condition_block() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void condition_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - _recipe_callback.condition_begin( condition_name_ ); - bool result = _recipe_callback.check_condition( condition_name_ ); - apply_modifier( result ); - if( result ) - { - create_children( _recipe_callback, _ostream ); - _recipe_callback.condition_end( condition_name_ ); - } -} - - -void condition_block::apply_modifier( bool& _result ) const -{ - switch( modifier_ ) - { - case sx::genesis::condition_modifier::NOT: - _result = !_result; - break; - - case sx::genesis::condition_modifier::NONE: - // Nothing to do... - break; - - default: - sxe::exception( "Incompatible value for condition modifier!" ); - break; - } -} - - -} - - +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "condition_block.hpp" + +#include "essentials/exception.hpp" + +#include "recipe_callback.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +condition_block::condition_block( const std::string& _condition_name, const condition_modifier& _modifier ) : + recipe_block(), + condition_name_( _condition_name ), + modifier_( _modifier ) +{ + // Nothing to do... +} + + +condition_block::~condition_block() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void condition_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + _recipe_callback.condition_begin( condition_name_ ); + bool result = _recipe_callback.check_condition( condition_name_ ); + apply_modifier( result ); + if( result ) + { + create_children( _recipe_callback, _ostream ); + _recipe_callback.condition_end( condition_name_ ); + } +} + + +void condition_block::apply_modifier( bool& _result ) const +{ + switch( modifier_ ) + { + case sx::genesis::condition_modifier::NOT: + _result = !_result; + break; + + case sx::genesis::condition_modifier::NONE: + // Nothing to do... + break; + + default: + sxe::exception( "Incompatible value for condition modifier!" ); + break; + } +} + + +} + + } \ No newline at end of file diff --git a/genesis/source/condition_modifier.cpp b/externals/genesis/source/genesis/source/condition_modifier.cpp similarity index 96% rename from genesis/source/condition_modifier.cpp rename to externals/genesis/source/genesis/source/condition_modifier.cpp index b6a8f5c..5aada78 100644 --- a/genesis/source/condition_modifier.cpp +++ b/externals/genesis/source/genesis/source/condition_modifier.cpp @@ -1,52 +1,52 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "condition_modifier.hpp" - -#include - -#include "essentials/conversion.hpp" - -#include "grammar.hpp" -#include "genesis_exception.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -condition_modifier get_condition_modifier_from_string( const std::string& _condition_modifier ) -{ - const std::string condition_modifier_caps = sxe::to_upper( _condition_modifier ); - - condition_modifier modifier( condition_modifier::NONE ); - if( condition_modifier_caps == condition_modifier_NOT ) - { - modifier = condition_modifier::NOT; - } - else if( condition_modifier_caps == condition_modifier_NONE ) - { - modifier = condition_modifier::NONE; - } - else - { - throw sx::genesis::genesis_exception( "Invalid condition modifier!" ); - } - return ( modifier ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "condition_modifier.hpp" + +#include + +#include "essentials/conversion.hpp" + +#include "grammar.hpp" +#include "genesis_exception.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +condition_modifier get_condition_modifier_from_string( const std::string& _condition_modifier ) +{ + const std::string condition_modifier_caps = sxe::to_upper( _condition_modifier ); + + condition_modifier modifier( condition_modifier::NONE ); + if( condition_modifier_caps == condition_modifier_NOT ) + { + modifier = condition_modifier::NOT; + } + else if( condition_modifier_caps == condition_modifier_NONE ) + { + modifier = condition_modifier::NONE; + } + else + { + throw sx::genesis::genesis_exception( "Invalid condition modifier!" ); + } + return ( modifier ); +} + + +} + + +} diff --git a/genesis/source/file_reader.cpp b/externals/genesis/source/genesis/source/file_reader.cpp similarity index 96% rename from genesis/source/file_reader.cpp rename to externals/genesis/source/genesis/source/file_reader.cpp index db25ecc..f5e63f1 100644 --- a/genesis/source/file_reader.cpp +++ b/externals/genesis/source/genesis/source/file_reader.cpp @@ -1,42 +1,42 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "file_reader.hpp" - -#include -#include - - -namespace sx -{ - -namespace genesis -{ - - -bool read( const std::string& _file_path, std::string& _content ) -{ - bool read = false; - std::ostringstream outputString; - std::ifstream inputFile( _file_path.c_str(), std::ios::in ); - if( inputFile ) - { - outputString << inputFile.rdbuf(); - inputFile.close(); - read = true; - } - _content = outputString.str(); - return ( read ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "file_reader.hpp" + +#include +#include + + +namespace sx +{ + +namespace genesis +{ + + +bool read( const std::string& _file_path, std::string& _content ) +{ + bool read = false; + std::ostringstream outputString; + std::ifstream inputFile( _file_path.c_str(), std::ios::in ); + if( inputFile ) + { + outputString << inputFile.rdbuf(); + inputFile.close(); + read = true; + } + _content = outputString.str(); + return ( read ); +} + + +} + + +} diff --git a/genesis/source/file_writer.cpp b/externals/genesis/source/genesis/source/file_writer.cpp similarity index 96% rename from genesis/source/file_writer.cpp rename to externals/genesis/source/genesis/source/file_writer.cpp index c7f282e..6118b56 100644 --- a/genesis/source/file_writer.cpp +++ b/externals/genesis/source/genesis/source/file_writer.cpp @@ -1,49 +1,49 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "file_writer.hpp" - -#include - -#include "genesis_exception.hpp" -#include "messages.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -void write( const std::string& _file_path, const std::ostream& _output_stream ) -{ -#ifdef SX_CPP03_BOOST - std::ofstream target_file( _file_path.c_str(), std::ios_base::out ); -#else - std::ofstream target_file( _file_path, std::ios_base::out ); -#endif - - if( target_file.is_open() ) - { - target_file << _output_stream.rdbuf(); - target_file.close(); - } - else - { - throw sx::genesis::genesis_exception( ERROR_WRITE_FILE, _file_path ); - } -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "file_writer.hpp" + +#include + +#include "genesis_exception.hpp" +#include "messages.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +void write( const std::string& _file_path, const std::ostream& _output_stream ) +{ +#ifdef SX_CPP03_BOOST + std::ofstream target_file( _file_path.c_str(), std::ios_base::out ); +#else + std::ofstream target_file( _file_path, std::ios_base::out ); +#endif + + if( target_file.is_open() ) + { + target_file << _output_stream.rdbuf(); + target_file.close(); + } + else + { + throw sx::genesis::genesis_exception( ERROR_WRITE_FILE, _file_path ); + } +} + + +} + + +} diff --git a/genesis/source/grammar.cpp b/externals/genesis/source/genesis/source/grammar.cpp similarity index 97% rename from genesis/source/grammar.cpp rename to externals/genesis/source/genesis/source/grammar.cpp index 7326e84..d03f575 100644 --- a/genesis/source/grammar.cpp +++ b/externals/genesis/source/genesis/source/grammar.cpp @@ -1,49 +1,49 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "grammar.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -const std::string condition_modifier_NOT = "NOT"; -const std::string condition_modifier_NONE = "NONE"; -const char DELIMITER_CHAR = '$'; -const char LINE_BREAK_CHAR = '@'; -const char OPEN_PARENTHESIS_CHAR = '('; -const char CLOSE_PARENTHESIS_CHAR = ')'; -const char COMMA_CHAR = ','; -const std::string COMMA_CLOSE_PARENTHESIS = ",)"; -const std::string VARIABLE_COMMAND = "$var"; -const std::string LOOP_START_COMMAND = "$loop"; -const std::string LOOP_END_COMMAND = "$pool"; -const std::string IF_START_COMMAND = "$if"; -const std::string IF_END_COMMAND = "$fi"; -const std::string SWITCH_START_COMMAND = "$switch"; -const std::string SWITCH_END_COMMAND = "$hctiws"; -const std::string SWITCH_CASE_START_COMMAND = "$case"; -const std::string SWITCH_CASE_END_COMMAND = "$esac"; -const std::string SWITCH_DEFAULT_START_COMMAND = "$default"; -const std::string SWITCH_DEFAULT_END_COMMAND = "$tluafed"; -const int SWITCH_DEFAULT_INDEX_VALUE = -1; -const std::string TEMPLATE_COMMAND = "$template"; -const char NEW_LINE_CHAR = '\n'; -const std::size_t SIZE_ONE = 1; - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "grammar.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +const std::string condition_modifier_NOT = "NOT"; +const std::string condition_modifier_NONE = "NONE"; +const char DELIMITER_CHAR = '$'; +const char LINE_BREAK_CHAR = '@'; +const char OPEN_PARENTHESIS_CHAR = '('; +const char CLOSE_PARENTHESIS_CHAR = ')'; +const char COMMA_CHAR = ','; +const std::string COMMA_CLOSE_PARENTHESIS = ",)"; +const std::string VARIABLE_COMMAND = "$var"; +const std::string LOOP_START_COMMAND = "$loop"; +const std::string LOOP_END_COMMAND = "$pool"; +const std::string IF_START_COMMAND = "$if"; +const std::string IF_END_COMMAND = "$fi"; +const std::string SWITCH_START_COMMAND = "$switch"; +const std::string SWITCH_END_COMMAND = "$hctiws"; +const std::string SWITCH_CASE_START_COMMAND = "$case"; +const std::string SWITCH_CASE_END_COMMAND = "$esac"; +const std::string SWITCH_DEFAULT_START_COMMAND = "$default"; +const std::string SWITCH_DEFAULT_END_COMMAND = "$tluafed"; +const int SWITCH_DEFAULT_INDEX_VALUE = -1; +const std::string TEMPLATE_COMMAND = "$template"; +const char NEW_LINE_CHAR = '\n'; +const std::size_t SIZE_ONE = 1; + + +} + + +} diff --git a/genesis/source/loop_block.cpp b/externals/genesis/source/genesis/source/loop_block.cpp similarity index 96% rename from genesis/source/loop_block.cpp rename to externals/genesis/source/genesis/source/loop_block.cpp index b295dc4..3034aad 100644 --- a/genesis/source/loop_block.cpp +++ b/externals/genesis/source/genesis/source/loop_block.cpp @@ -1,54 +1,54 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "loop_block.hpp" - -#include "recipe_callback.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -loop_block::loop_block( const std::string& _loop_name ) : - recipe_block(), - loop_name_( _loop_name ) -{ - // Nothing to do... -} - - -loop_block::~loop_block() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void loop_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - _recipe_callback.before_loop( loop_name_ ); - - while( _recipe_callback.check_loop_condition( loop_name_ ) ) - { - _recipe_callback.before_loop_iteration( loop_name_ ); - create_children( _recipe_callback, _ostream ); - _recipe_callback.after_loop_iteration( loop_name_ ); - } - _recipe_callback.after_loop( loop_name_ ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "loop_block.hpp" + +#include "recipe_callback.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +loop_block::loop_block( const std::string& _loop_name ) : + recipe_block(), + loop_name_( _loop_name ) +{ + // Nothing to do... +} + + +loop_block::~loop_block() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void loop_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + _recipe_callback.before_loop( loop_name_ ); + + while( _recipe_callback.check_loop_condition( loop_name_ ) ) + { + _recipe_callback.before_loop_iteration( loop_name_ ); + create_children( _recipe_callback, _ostream ); + _recipe_callback.after_loop_iteration( loop_name_ ); + } + _recipe_callback.after_loop( loop_name_ ); +} + + +} + + +} diff --git a/genesis/source/messages.cpp b/externals/genesis/source/genesis/source/messages.cpp similarity index 97% rename from genesis/source/messages.cpp rename to externals/genesis/source/genesis/source/messages.cpp index 1cd39b5..13b911d 100644 --- a/genesis/source/messages.cpp +++ b/externals/genesis/source/genesis/source/messages.cpp @@ -1,27 +1,27 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "messages.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -const std::string ERROR_WRITE_FILE = "File % cannot be opened for writing!"; - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "messages.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +const std::string ERROR_WRITE_FILE = "File % cannot be opened for writing!"; + + +} + + +} diff --git a/genesis/source/recipe.cpp b/externals/genesis/source/genesis/source/recipe.cpp similarity index 96% rename from genesis/source/recipe.cpp rename to externals/genesis/source/genesis/source/recipe.cpp index 1fc543c..1f9ac71 100644 --- a/genesis/source/recipe.cpp +++ b/externals/genesis/source/genesis/source/recipe.cpp @@ -1,61 +1,61 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "recipe.hpp" - -#include "file_writer.hpp" -#include "genesis_exception.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -recipe::recipe( const std::string& _template_name, recipe_callback& _recipe_callback, - const std::string& _templates_path ) : - template_block( _template_name, _templates_path ), - recipe_callback_( _recipe_callback ), - stream_() -{ - // Nothing to do... -} - - -recipe::~recipe() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void recipe::generate() -{ - create_impl( recipe_callback_ ); -} - - -void recipe::write_to_file( const std::string& _file_path ) const -{ - write( _file_path, stream_ ); -} - - -void recipe::create_impl( recipe_callback& _recipe_callback ) -{ - template_block::create( _recipe_callback, stream_ ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "recipe.hpp" + +#include "file_writer.hpp" +#include "genesis_exception.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +recipe::recipe( const std::string& _template_name, recipe_callback& _recipe_callback, + const std::string& _templates_path ) : + template_block( _template_name, _templates_path ), + recipe_callback_( _recipe_callback ), + stream_() +{ + // Nothing to do... +} + + +recipe::~recipe() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void recipe::generate() +{ + create_impl( recipe_callback_ ); +} + + +void recipe::write_to_file( const std::string& _file_path ) const +{ + write( _file_path, stream_ ); +} + + +void recipe::create_impl( recipe_callback& _recipe_callback ) +{ + template_block::create( _recipe_callback, stream_ ); +} + + +} + + +} diff --git a/genesis/source/recipe_block.cpp b/externals/genesis/source/genesis/source/recipe_block.cpp similarity index 96% rename from genesis/source/recipe_block.cpp rename to externals/genesis/source/genesis/source/recipe_block.cpp index 0948130..10260d8 100644 --- a/genesis/source/recipe_block.cpp +++ b/externals/genesis/source/genesis/source/recipe_block.cpp @@ -1,53 +1,53 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "recipe_block.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -recipe_block::recipe_block() : - recipe_step(), - child_recipes_() -{ - // Nothing to do... -} - - -recipe_block::~recipe_block() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void recipe_block::create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - SX_FOR( sxe::SX_UNIQUE_PTR& child, child_recipes_ ) - { - child->create( _recipe_callback, _ostream ); - } -} - - -void recipe_block::add_child( sxe::SX_UNIQUE_PTR _child ) -{ - child_recipes_.push_back( sxe::move( _child ) ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "recipe_block.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +recipe_block::recipe_block() : + recipe_step(), + child_recipes_() +{ + // Nothing to do... +} + + +recipe_block::~recipe_block() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void recipe_block::create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + SX_FOR( sxe::SX_UNIQUE_PTR& child, child_recipes_ ) + { + child->create( _recipe_callback, _ostream ); + } +} + + +void recipe_block::add_child( sxe::SX_UNIQUE_PTR _child ) +{ + child_recipes_.push_back( sxe::move( _child ) ); +} + + +} + + +} diff --git a/genesis/source/switch_block.cpp b/externals/genesis/source/genesis/source/switch_block.cpp similarity index 96% rename from genesis/source/switch_block.cpp rename to externals/genesis/source/genesis/source/switch_block.cpp index af124fe..e287605 100644 --- a/genesis/source/switch_block.cpp +++ b/externals/genesis/source/genesis/source/switch_block.cpp @@ -1,89 +1,89 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "switch_block.hpp" - -#include "recipe_callback.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -switch_block::switch_block( const std::string& _switch_name ) : - recipe_block(), - switch_name_( _switch_name ), - current_case_index_(), - switch_cases_(), - default_() -{ - // Nothing to do... -} - - -switch_block::~switch_block() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void switch_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - current_case_index_ = _recipe_callback.get_switch_case( switch_name_ ); - create_children( _recipe_callback, _ostream ); -} - - -void switch_block::create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - if( current_case_index_ >= 0 ) - { - std::vector< sxe::SX_UNIQUE_PTR >& children_steps = switch_cases_[current_case_index_]; - SX_FOR( sxe::SX_UNIQUE_PTR& child , children_steps ) - { - child->create( _recipe_callback, _ostream ); - } - } - else - { - SX_FOR( sxe::SX_UNIQUE_PTR& child , default_ ) - { - child->create( _recipe_callback, _ostream ); - } - } -} - - -void switch_block::add_child( sxe::SX_UNIQUE_PTR _child ) -{ - if( current_case_index_ >= 0 ) - { - switch_cases_[current_case_index_].push_back( sxe::move( _child ) ); - } - else - { - default_.push_back( sxe::move( _child ) ); - } -} - - -void switch_block::set_case_index( const int _index ) -{ - current_case_index_ = _index; -} - - -} - - +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "switch_block.hpp" + +#include "recipe_callback.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +switch_block::switch_block( const std::string& _switch_name ) : + recipe_block(), + switch_name_( _switch_name ), + current_case_index_(), + switch_cases_(), + default_() +{ + // Nothing to do... +} + + +switch_block::~switch_block() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void switch_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + current_case_index_ = _recipe_callback.get_switch_case( switch_name_ ); + create_children( _recipe_callback, _ostream ); +} + + +void switch_block::create_children( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + if( current_case_index_ >= 0 ) + { + std::vector< sxe::SX_UNIQUE_PTR >& children_steps = switch_cases_[current_case_index_]; + SX_FOR( sxe::SX_UNIQUE_PTR& child , children_steps ) + { + child->create( _recipe_callback, _ostream ); + } + } + else + { + SX_FOR( sxe::SX_UNIQUE_PTR& child , default_ ) + { + child->create( _recipe_callback, _ostream ); + } + } +} + + +void switch_block::add_child( sxe::SX_UNIQUE_PTR _child ) +{ + if( current_case_index_ >= 0 ) + { + switch_cases_[current_case_index_].push_back( sxe::move( _child ) ); + } + else + { + default_.push_back( sxe::move( _child ) ); + } +} + + +void switch_block::set_case_index( const int _index ) +{ + current_case_index_ = _index; +} + + +} + + } \ No newline at end of file diff --git a/genesis/source/template_block.cpp b/externals/genesis/source/genesis/source/template_block.cpp similarity index 96% rename from genesis/source/template_block.cpp rename to externals/genesis/source/genesis/source/template_block.cpp index 16a5faa..b784e94 100644 --- a/genesis/source/template_block.cpp +++ b/externals/genesis/source/genesis/source/template_block.cpp @@ -1,516 +1,516 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "template_block.hpp" - -#include -#include -#include - -#include "essentials/base.hpp" -#include "essentials/conversion.hpp" - -#include "genesis_exception.hpp" -#include "file_reader.hpp" -#include "text_step.hpp" -#include "variable_step.hpp" -#include "loop_block.hpp" -#include "switch_block.hpp" -#include "condition_block.hpp" -#include "grammar.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -template_block::template_block( const std::string& _template_name, const std::string& _template_path ) : - recipe_block(), - opened_recipes_(), - keywords_(), - template_to_parse_( read_template_file( _template_name, _template_path ) ), - template_path_( _template_path ), - template_file_( _template_name ) -{ - // Nothing to do... -} - - -template_block::~template_block() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void template_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - parse( template_to_parse_ ); - final_check(); - create_children( _recipe_callback, _ostream ); -} - - -void template_block::parse( std::string& _file_buffer ) -{ - while( !_file_buffer.empty() ) - { - get_text( _file_buffer ); - if( !_file_buffer.empty() ) - { - const std::string command = get_keyword( _file_buffer ); - if( command == VARIABLE_COMMAND ) - { - get_variable( _file_buffer ); - } - else if( command == TEMPLATE_COMMAND ) - { - get_template( _file_buffer ); - } - else if( command == LOOP_START_COMMAND ) - { - get_loop( _file_buffer ); - } - else if( command == IF_START_COMMAND ) - { - get_if( _file_buffer ); - } - else if( command == SWITCH_START_COMMAND ) - { - get_switch( _file_buffer ); - } - else if( command == SWITCH_CASE_START_COMMAND ) - { - get_switch_case( _file_buffer ); - } - else if( command == SWITCH_DEFAULT_START_COMMAND ) - { - get_switch_default( _file_buffer ); - } - else if( command == LOOP_END_COMMAND ) - { - close_loop( _file_buffer ); - } - else if( command == IF_END_COMMAND ) - { - close_condition( _file_buffer ); - } - else if( command == SWITCH_END_COMMAND ) - { - close_switch( _file_buffer ); - } - else if( command == SWITCH_CASE_END_COMMAND ) - { - close_switch_case( _file_buffer ); - } - else if( command == SWITCH_DEFAULT_END_COMMAND ) - { - close_switch_default( _file_buffer ); - } - else - { - throw sx::genesis::genesis_exception( "Unknown command! Check template file '%'!", template_file_ ); - } - } - } -} - - -void template_block::get_text( std::string &_file_buffer ) -{ - std::stringstream buffer; - bool more_text = true; - while( more_text ) - { - const std::size_t position = _file_buffer.find( DELIMITER_CHAR ); - if( position != std::string::npos ) - { - buffer << _file_buffer.substr( 0, position ); - _file_buffer.erase( 0, position ); - const bool is_delimiter_char = _file_buffer[0] == DELIMITER_CHAR; - SX_ASSERT( is_delimiter_char, "First char in the buffer is not the delimiter char!" ); - SX_UNUSED_VARIABLE( is_delimiter_char ); - if( _file_buffer.length() > 2 ) - { - if( _file_buffer[1] == DELIMITER_CHAR ) - { - buffer << DELIMITER_CHAR; - _file_buffer.erase( 0, 2 ); - } - else if( _file_buffer[1] == LINE_BREAK_CHAR ) - { - buffer << '\n'; - _file_buffer.erase( 0, 2 ); - } - else - { - more_text = false; - - const std::string text = buffer.str(); - buffer.str( std::string() ); - add_child_to_recipe( SX_MAKE_UNIQUE( text ) ); - } - } - else - { - throw sx::genesis::genesis_exception( "File '%' ends with a delimiter char!", template_file_ ); - } - } - else - { - more_text = false; - sxe::SX_UNIQUE_PTR new_text_step = SX_MAKE_UNIQUE( buffer.str() + _file_buffer ); - buffer.str( std::string() ); - if( is_any_recipe_open() ) - { - throw sx::genesis::genesis_exception( "A condition/loop not closed in file '%'!", template_file_ ); - } - else - { - add_child( sxe::move( new_text_step ) ); - _file_buffer.clear(); - } - } - } -} - - -std::string template_block::get_keyword( std::string& _file_buffer ) -{ - std::size_t position; - if( keywords_.empty() ) - { - position = _file_buffer.find( OPEN_PARENTHESIS_CHAR ); - } - else - { - if( _file_buffer.substr( 0, get_last_to_be_closed().length() ) == get_last_to_be_closed() ) - { - position = get_last_to_be_closed().length(); - } - else - { - position = _file_buffer.find( OPEN_PARENTHESIS_CHAR ); - } - } - - std::string keyword = ""; - if( position != std::string::npos ) - { - keyword = _file_buffer.substr( 0, position ); - } - else - { - throw sx::genesis::genesis_exception( "No command found!" ); - } - return ( keyword ); -} - - -void template_block::get_variable( std::string &_file_buffer ) -{ - _file_buffer.erase( 0, VARIABLE_COMMAND.length() + SIZE_ONE ); - const std::vector parameters = get_parameters( _file_buffer ); - if( parameters.size() != 1 ) - { - throw sx::genesis::genesis_exception( "Variable command does not have exactly 1 parameter in file '%'!", template_file_ ); - } - else - { - add_child_to_recipe( SX_MAKE_UNIQUE( parameters[0] ) ); - } -} - - -void template_block::get_loop( std::string &_file_buffer ) -{ - _file_buffer.erase( 0, LOOP_START_COMMAND.length() + SIZE_ONE ); - const std::vector parameters = get_parameters( _file_buffer ); - if( parameters.size() != 1 ) - { - throw sx::genesis::genesis_exception( "Loop command does not have exactly 1 parameter in file '%'!", template_file_ ); - } - else - { - sxe::SX_UNIQUE_PTR new_loop_block = SX_MAKE_UNIQUE( parameters[0] ); - loop_block* new_loop_block_ptr = new_loop_block.get(); - add_child_to_recipe( sxe::move( new_loop_block ) ); - opened_recipes_.push( new_loop_block_ptr ); - keywords_.push_back( LOOP_END_COMMAND ); - } -} - - -void template_block::get_if( std::string &_file_buffer ) -{ - keywords_.push_back( IF_END_COMMAND ); - _file_buffer.erase( 0, IF_START_COMMAND.length() + SIZE_ONE ); - const std::vector parameters = get_parameters( _file_buffer ); - if( parameters.size() != 1 && parameters.size() != 2 ) - { - throw sx::genesis::genesis_exception( "No sufficient parameters provided for 'if' command in file '%'!", template_file_ ); - } - else - { - sxe::SX_UNIQUE_PTR new_condition_block; - if( parameters.size() > 1 ) - { - new_condition_block = - SX_MAKE_UNIQUE( parameters[0], get_condition_modifier_from_string( parameters[1] ) ); - } - else - { - new_condition_block = - SX_MAKE_UNIQUE( parameters[0], condition_modifier::NONE ); - } - condition_block* new_condition_block_ptr = new_condition_block.get(); - add_child_to_recipe( sxe::move( new_condition_block ) ); - opened_recipes_.push( new_condition_block_ptr ); - } -} - - -void template_block::get_switch( std::string& _file_buffer ) -{ - _file_buffer.erase( 0, SWITCH_START_COMMAND.length() + SIZE_ONE ); - const std::vector parameters = get_parameters( _file_buffer ); - if( parameters.size() != 1 ) - { - throw sx::genesis::genesis_exception( "Switch command has not exactly 1 parameter in file '%'!", template_file_ ); - } - else - { - sxe::SX_UNIQUE_PTR new_switch_block = SX_MAKE_UNIQUE( parameters[0] ); - switch_block* new_switch_block_ptr = new_switch_block.get(); - add_child_to_recipe( sxe::move( new_switch_block ) ); - opened_recipes_.push( new_switch_block_ptr ); - keywords_.push_back( SWITCH_END_COMMAND ); - } -} - - -void template_block::get_switch_case( std::string& _file_buffer ) -{ - _file_buffer.erase( 0, SWITCH_CASE_START_COMMAND.length() + SIZE_ONE ); - const std::vector parameters = get_parameters( _file_buffer ); - if( parameters.size() != 1 ) - { - throw sx::genesis::genesis_exception( "Switch case command has not exactly 1 parameter in file '%'!", template_file_ ); - } - else - { - if( opened_recipes_.empty() ) - { - throw sx::genesis::genesis_exception( "There is no switch for the switch case in '%'!", template_file_ ); - } - else - { - switch_block* switch_ = dynamic_cast< switch_block* >( opened_recipes_.top() ); - if( switch_ ) - { - int index = 0; - sxe::string_to_int( parameters[0].c_str(), index ); - switch_->set_case_index( index ); - keywords_.push_back( SWITCH_CASE_END_COMMAND ); - } - else - { - throw sx::genesis::genesis_exception( "There is no switch for the switch case in '%'!", template_file_ ); - } - } - } -} - - -void template_block::get_switch_default( std::string& _file_buffer ) -{ - _file_buffer.erase( 0, SWITCH_DEFAULT_START_COMMAND.length() + SIZE_ONE ); - const std::vector parameters = get_parameters( _file_buffer ); - if( !parameters.empty()) - { - throw sx::genesis::genesis_exception( "Switch default command must have no parameters in file '%'!", template_file_ ); - } - else - { - if( opened_recipes_.empty() ) - { - throw sx::genesis::genesis_exception( "There is no switch for the default case in '%'!", template_file_ ); - } - else - { - switch_block* switch_ = dynamic_cast< switch_block* >( opened_recipes_.top() ); - if( switch_ ) - { - switch_->set_case_index( SWITCH_DEFAULT_INDEX_VALUE ); - keywords_.push_back( SWITCH_DEFAULT_END_COMMAND ); - } - else - { - throw sx::genesis::genesis_exception( "There is no switch for the switch default in '%'!", template_file_ ); - } - } - } -} - - -void template_block::get_template( std::string &_file_buffer ) -{ - _file_buffer.erase( 0, TEMPLATE_COMMAND.length() + SIZE_ONE ); - const std::vector parameters = get_parameters( _file_buffer ); - if( parameters.empty() ) - { - throw sx::genesis::genesis_exception( "No sufficient parameters provided for 'template' command in file '%'!", template_file_ ); - } - else - { - add_child_to_recipe( SX_MAKE_UNIQUE( parameters[0], template_path_ ) ); - } -} - - -const std::string template_block::get_last_to_be_closed() const -{ - const std::string last_element = keywords_.back(); - return( last_element ); -} - - -std::string template_block::read_template_file( const std::string& _template_name, const std::string& _templates_path ) -{ - std::string template_file_as_string; - read( _templates_path + "/" + _template_name, template_file_as_string ); - if( template_file_as_string.empty() ) - { - std::cout << "Template file '" << _template_name << "' is empty!" << std::endl; - } - return( template_file_as_string ); -} - - -void template_block::check_new_line_after_end_command( std::string &_file_buffer ) -{ - if( _file_buffer.length() > 2 ) - { - if( _file_buffer[0] == NEW_LINE_CHAR ) - { - _file_buffer.erase( 0, 1 ); - } - } -} - - -void template_block::close_loop( std::string& _file_buffer ) -{ - const std::size_t position = _file_buffer.find( LOOP_END_COMMAND ); - _file_buffer.erase( 0, position + LOOP_END_COMMAND.length() ); - check_new_line_after_end_command( _file_buffer ); - keywords_.pop_back(); - opened_recipes_.pop(); -} - - -void template_block::close_condition( std::string& _file_buffer ) -{ - const std::size_t position = _file_buffer.find( IF_END_COMMAND ); - _file_buffer.erase( 0, position + IF_END_COMMAND.length() ); - check_new_line_after_end_command( _file_buffer ); - keywords_.pop_back(); - opened_recipes_.pop(); -} - - -void template_block::close_switch( std::string& _file_buffer ) -{ - const std::size_t position = _file_buffer.find( SWITCH_END_COMMAND ); - _file_buffer.erase( 0, position + SWITCH_END_COMMAND.length() ); - check_new_line_after_end_command( _file_buffer ); - keywords_.pop_back(); - opened_recipes_.pop(); -} - - -void template_block::close_switch_case( std::string& _file_buffer ) -{ - const std::size_t position = _file_buffer.find( SWITCH_CASE_END_COMMAND ); - _file_buffer.erase( 0, position + SWITCH_CASE_END_COMMAND.length() ); - check_new_line_after_end_command( _file_buffer ); - keywords_.pop_back(); -} - - -void template_block::close_switch_default( std::string& _file_buffer ) -{ - const std::size_t position = _file_buffer.find( SWITCH_DEFAULT_END_COMMAND ); - _file_buffer.erase( 0, position + SWITCH_DEFAULT_END_COMMAND.length() ); - check_new_line_after_end_command( _file_buffer ); - keywords_.pop_back(); -} - - -bool template_block::is_any_recipe_open() const -{ - return( !opened_recipes_.empty() ); -} - - -std::vector template_block::get_parameters( std::string& _file_buffer ) const -{ - std::vector parameters; - std::size_t stop_position = _file_buffer.find( CLOSE_PARENTHESIS_CHAR ); - std::string string_parameters = _file_buffer.substr( 0, stop_position ); - _file_buffer.erase( 0, stop_position + SIZE_ONE ); - - string_parameters.erase( std::remove_if( string_parameters.begin(), string_parameters.end(), ::isspace ), string_parameters.end() ); - - std::string step; - std::istringstream stream( string_parameters ); - while( getline( stream, step, ',' ) ) - { - parameters.push_back( step ); - } - - return( parameters ); -} - - -void template_block::final_check() const -{ - SX_ASSERT( template_to_parse_.empty(), "The file buffer was not completely parsed!" ); - - if( !keywords_.empty() ) - { - std::string command = keywords_.back(); - if( command == LOOP_END_COMMAND ) - { - command = LOOP_START_COMMAND; - } - else if( command == IF_END_COMMAND ) - { - command = IF_START_COMMAND; - } - else - { - sx::genesis::genesis_exception( "Unknown command end: '%'!", command ); - } - - sx::genesis::genesis_exception( "Command '%' does not have a close command in file '%'!", template_file_ ); - } - - if( !opened_recipes_.empty() ) - { - sx::genesis::genesis_exception( "Internal error! Not all recipes were processed at the end of generation." ); - } -} - -} - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "template_block.hpp" + +#include +#include +#include + +#include "essentials/base.hpp" +#include "essentials/conversion.hpp" + +#include "genesis_exception.hpp" +#include "file_reader.hpp" +#include "text_step.hpp" +#include "variable_step.hpp" +#include "loop_block.hpp" +#include "switch_block.hpp" +#include "condition_block.hpp" +#include "grammar.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +template_block::template_block( const std::string& _template_name, const std::string& _template_path ) : + recipe_block(), + opened_recipes_(), + keywords_(), + template_to_parse_( read_template_file( _template_name, _template_path ) ), + template_path_( _template_path ), + template_file_( _template_name ) +{ + // Nothing to do... +} + + +template_block::~template_block() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void template_block::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + parse( template_to_parse_ ); + final_check(); + create_children( _recipe_callback, _ostream ); +} + + +void template_block::parse( std::string& _file_buffer ) +{ + while( !_file_buffer.empty() ) + { + get_text( _file_buffer ); + if( !_file_buffer.empty() ) + { + const std::string command = get_keyword( _file_buffer ); + if( command == VARIABLE_COMMAND ) + { + get_variable( _file_buffer ); + } + else if( command == TEMPLATE_COMMAND ) + { + get_template( _file_buffer ); + } + else if( command == LOOP_START_COMMAND ) + { + get_loop( _file_buffer ); + } + else if( command == IF_START_COMMAND ) + { + get_if( _file_buffer ); + } + else if( command == SWITCH_START_COMMAND ) + { + get_switch( _file_buffer ); + } + else if( command == SWITCH_CASE_START_COMMAND ) + { + get_switch_case( _file_buffer ); + } + else if( command == SWITCH_DEFAULT_START_COMMAND ) + { + get_switch_default( _file_buffer ); + } + else if( command == LOOP_END_COMMAND ) + { + close_loop( _file_buffer ); + } + else if( command == IF_END_COMMAND ) + { + close_condition( _file_buffer ); + } + else if( command == SWITCH_END_COMMAND ) + { + close_switch( _file_buffer ); + } + else if( command == SWITCH_CASE_END_COMMAND ) + { + close_switch_case( _file_buffer ); + } + else if( command == SWITCH_DEFAULT_END_COMMAND ) + { + close_switch_default( _file_buffer ); + } + else + { + throw sx::genesis::genesis_exception( "Unknown command! Check template file '%'!", template_file_ ); + } + } + } +} + + +void template_block::get_text( std::string &_file_buffer ) +{ + std::stringstream buffer; + bool more_text = true; + while( more_text ) + { + const std::size_t position = _file_buffer.find( DELIMITER_CHAR ); + if( position != std::string::npos ) + { + buffer << _file_buffer.substr( 0, position ); + _file_buffer.erase( 0, position ); + const bool is_delimiter_char = _file_buffer[0] == DELIMITER_CHAR; + SX_ASSERT( is_delimiter_char, "First char in the buffer is not the delimiter char!" ); + SX_UNUSED_VARIABLE( is_delimiter_char ); + if( _file_buffer.length() > 2 ) + { + if( _file_buffer[1] == DELIMITER_CHAR ) + { + buffer << DELIMITER_CHAR; + _file_buffer.erase( 0, 2 ); + } + else if( _file_buffer[1] == LINE_BREAK_CHAR ) + { + buffer << '\n'; + _file_buffer.erase( 0, 2 ); + } + else + { + more_text = false; + + const std::string text = buffer.str(); + buffer.str( std::string() ); + add_child_to_recipe( SX_MAKE_UNIQUE( text ) ); + } + } + else + { + throw sx::genesis::genesis_exception( "File '%' ends with a delimiter char!", template_file_ ); + } + } + else + { + more_text = false; + sxe::SX_UNIQUE_PTR new_text_step = SX_MAKE_UNIQUE( buffer.str() + _file_buffer ); + buffer.str( std::string() ); + if( is_any_recipe_open() ) + { + throw sx::genesis::genesis_exception( "A condition/loop not closed in file '%'!", template_file_ ); + } + else + { + add_child( sxe::move( new_text_step ) ); + _file_buffer.clear(); + } + } + } +} + + +std::string template_block::get_keyword( std::string& _file_buffer ) +{ + std::size_t position; + if( keywords_.empty() ) + { + position = _file_buffer.find( OPEN_PARENTHESIS_CHAR ); + } + else + { + if( _file_buffer.substr( 0, get_last_to_be_closed().length() ) == get_last_to_be_closed() ) + { + position = get_last_to_be_closed().length(); + } + else + { + position = _file_buffer.find( OPEN_PARENTHESIS_CHAR ); + } + } + + std::string keyword = ""; + if( position != std::string::npos ) + { + keyword = _file_buffer.substr( 0, position ); + } + else + { + throw sx::genesis::genesis_exception( "No command found!" ); + } + return ( keyword ); +} + + +void template_block::get_variable( std::string &_file_buffer ) +{ + _file_buffer.erase( 0, VARIABLE_COMMAND.length() + SIZE_ONE ); + const std::vector parameters = get_parameters( _file_buffer ); + if( parameters.size() != 1 ) + { + throw sx::genesis::genesis_exception( "Variable command does not have exactly 1 parameter in file '%'!", template_file_ ); + } + else + { + add_child_to_recipe( SX_MAKE_UNIQUE( parameters[0] ) ); + } +} + + +void template_block::get_loop( std::string &_file_buffer ) +{ + _file_buffer.erase( 0, LOOP_START_COMMAND.length() + SIZE_ONE ); + const std::vector parameters = get_parameters( _file_buffer ); + if( parameters.size() != 1 ) + { + throw sx::genesis::genesis_exception( "Loop command does not have exactly 1 parameter in file '%'!", template_file_ ); + } + else + { + sxe::SX_UNIQUE_PTR new_loop_block = SX_MAKE_UNIQUE( parameters[0] ); + loop_block* new_loop_block_ptr = new_loop_block.get(); + add_child_to_recipe( sxe::move( new_loop_block ) ); + opened_recipes_.push( new_loop_block_ptr ); + keywords_.push_back( LOOP_END_COMMAND ); + } +} + + +void template_block::get_if( std::string &_file_buffer ) +{ + keywords_.push_back( IF_END_COMMAND ); + _file_buffer.erase( 0, IF_START_COMMAND.length() + SIZE_ONE ); + const std::vector parameters = get_parameters( _file_buffer ); + if( parameters.size() != 1 && parameters.size() != 2 ) + { + throw sx::genesis::genesis_exception( "No sufficient parameters provided for 'if' command in file '%'!", template_file_ ); + } + else + { + sxe::SX_UNIQUE_PTR new_condition_block; + if( parameters.size() > 1 ) + { + new_condition_block = + SX_MAKE_UNIQUE( parameters[0], get_condition_modifier_from_string( parameters[1] ) ); + } + else + { + new_condition_block = + SX_MAKE_UNIQUE( parameters[0], condition_modifier::NONE ); + } + condition_block* new_condition_block_ptr = new_condition_block.get(); + add_child_to_recipe( sxe::move( new_condition_block ) ); + opened_recipes_.push( new_condition_block_ptr ); + } +} + + +void template_block::get_switch( std::string& _file_buffer ) +{ + _file_buffer.erase( 0, SWITCH_START_COMMAND.length() + SIZE_ONE ); + const std::vector parameters = get_parameters( _file_buffer ); + if( parameters.size() != 1 ) + { + throw sx::genesis::genesis_exception( "Switch command has not exactly 1 parameter in file '%'!", template_file_ ); + } + else + { + sxe::SX_UNIQUE_PTR new_switch_block = SX_MAKE_UNIQUE( parameters[0] ); + switch_block* new_switch_block_ptr = new_switch_block.get(); + add_child_to_recipe( sxe::move( new_switch_block ) ); + opened_recipes_.push( new_switch_block_ptr ); + keywords_.push_back( SWITCH_END_COMMAND ); + } +} + + +void template_block::get_switch_case( std::string& _file_buffer ) +{ + _file_buffer.erase( 0, SWITCH_CASE_START_COMMAND.length() + SIZE_ONE ); + const std::vector parameters = get_parameters( _file_buffer ); + if( parameters.size() != 1 ) + { + throw sx::genesis::genesis_exception( "Switch case command has not exactly 1 parameter in file '%'!", template_file_ ); + } + else + { + if( opened_recipes_.empty() ) + { + throw sx::genesis::genesis_exception( "There is no switch for the switch case in '%'!", template_file_ ); + } + else + { + switch_block* switch_ = dynamic_cast< switch_block* >( opened_recipes_.top() ); + if( switch_ ) + { + int index = 0; + sxe::string_to_int( parameters[0].c_str(), index ); + switch_->set_case_index( index ); + keywords_.push_back( SWITCH_CASE_END_COMMAND ); + } + else + { + throw sx::genesis::genesis_exception( "There is no switch for the switch case in '%'!", template_file_ ); + } + } + } +} + + +void template_block::get_switch_default( std::string& _file_buffer ) +{ + _file_buffer.erase( 0, SWITCH_DEFAULT_START_COMMAND.length() + SIZE_ONE ); + const std::vector parameters = get_parameters( _file_buffer ); + if( !parameters.empty()) + { + throw sx::genesis::genesis_exception( "Switch default command must have no parameters in file '%'!", template_file_ ); + } + else + { + if( opened_recipes_.empty() ) + { + throw sx::genesis::genesis_exception( "There is no switch for the default case in '%'!", template_file_ ); + } + else + { + switch_block* switch_ = dynamic_cast< switch_block* >( opened_recipes_.top() ); + if( switch_ ) + { + switch_->set_case_index( SWITCH_DEFAULT_INDEX_VALUE ); + keywords_.push_back( SWITCH_DEFAULT_END_COMMAND ); + } + else + { + throw sx::genesis::genesis_exception( "There is no switch for the switch default in '%'!", template_file_ ); + } + } + } +} + + +void template_block::get_template( std::string &_file_buffer ) +{ + _file_buffer.erase( 0, TEMPLATE_COMMAND.length() + SIZE_ONE ); + const std::vector parameters = get_parameters( _file_buffer ); + if( parameters.empty() ) + { + throw sx::genesis::genesis_exception( "No sufficient parameters provided for 'template' command in file '%'!", template_file_ ); + } + else + { + add_child_to_recipe( SX_MAKE_UNIQUE( parameters[0], template_path_ ) ); + } +} + + +const std::string template_block::get_last_to_be_closed() const +{ + const std::string last_element = keywords_.back(); + return( last_element ); +} + + +std::string template_block::read_template_file( const std::string& _template_name, const std::string& _templates_path ) +{ + std::string template_file_as_string; + read( _templates_path + "/" + _template_name, template_file_as_string ); + if( template_file_as_string.empty() ) + { + std::cout << "Template file '" << _template_name << "' is empty!" << std::endl; + } + return( template_file_as_string ); +} + + +void template_block::check_new_line_after_end_command( std::string &_file_buffer ) +{ + if( _file_buffer.length() > 2 ) + { + if( _file_buffer[0] == NEW_LINE_CHAR ) + { + _file_buffer.erase( 0, 1 ); + } + } +} + + +void template_block::close_loop( std::string& _file_buffer ) +{ + const std::size_t position = _file_buffer.find( LOOP_END_COMMAND ); + _file_buffer.erase( 0, position + LOOP_END_COMMAND.length() ); + check_new_line_after_end_command( _file_buffer ); + keywords_.pop_back(); + opened_recipes_.pop(); +} + + +void template_block::close_condition( std::string& _file_buffer ) +{ + const std::size_t position = _file_buffer.find( IF_END_COMMAND ); + _file_buffer.erase( 0, position + IF_END_COMMAND.length() ); + check_new_line_after_end_command( _file_buffer ); + keywords_.pop_back(); + opened_recipes_.pop(); +} + + +void template_block::close_switch( std::string& _file_buffer ) +{ + const std::size_t position = _file_buffer.find( SWITCH_END_COMMAND ); + _file_buffer.erase( 0, position + SWITCH_END_COMMAND.length() ); + check_new_line_after_end_command( _file_buffer ); + keywords_.pop_back(); + opened_recipes_.pop(); +} + + +void template_block::close_switch_case( std::string& _file_buffer ) +{ + const std::size_t position = _file_buffer.find( SWITCH_CASE_END_COMMAND ); + _file_buffer.erase( 0, position + SWITCH_CASE_END_COMMAND.length() ); + check_new_line_after_end_command( _file_buffer ); + keywords_.pop_back(); +} + + +void template_block::close_switch_default( std::string& _file_buffer ) +{ + const std::size_t position = _file_buffer.find( SWITCH_DEFAULT_END_COMMAND ); + _file_buffer.erase( 0, position + SWITCH_DEFAULT_END_COMMAND.length() ); + check_new_line_after_end_command( _file_buffer ); + keywords_.pop_back(); +} + + +bool template_block::is_any_recipe_open() const +{ + return( !opened_recipes_.empty() ); +} + + +std::vector template_block::get_parameters( std::string& _file_buffer ) const +{ + std::vector parameters; + std::size_t stop_position = _file_buffer.find( CLOSE_PARENTHESIS_CHAR ); + std::string string_parameters = _file_buffer.substr( 0, stop_position ); + _file_buffer.erase( 0, stop_position + SIZE_ONE ); + + string_parameters.erase( std::remove_if( string_parameters.begin(), string_parameters.end(), ::isspace ), string_parameters.end() ); + + std::string step; + std::istringstream stream( string_parameters ); + while( getline( stream, step, ',' ) ) + { + parameters.push_back( step ); + } + + return( parameters ); +} + + +void template_block::final_check() const +{ + SX_ASSERT( template_to_parse_.empty(), "The file buffer was not completely parsed!" ); + + if( !keywords_.empty() ) + { + std::string command = keywords_.back(); + if( command == LOOP_END_COMMAND ) + { + command = LOOP_START_COMMAND; + } + else if( command == IF_END_COMMAND ) + { + command = IF_START_COMMAND; + } + else + { + sx::genesis::genesis_exception( "Unknown command end: '%'!", command ); + } + + sx::genesis::genesis_exception( "Command '%' does not have a close command in file '%'!", template_file_ ); + } + + if( !opened_recipes_.empty() ) + { + sx::genesis::genesis_exception( "Internal error! Not all recipes were processed at the end of generation." ); + } +} + +} + +} diff --git a/genesis/source/text_step.cpp b/externals/genesis/source/genesis/source/text_step.cpp similarity index 95% rename from genesis/source/text_step.cpp rename to externals/genesis/source/genesis/source/text_step.cpp index f010ef7..433aea4 100644 --- a/genesis/source/text_step.cpp +++ b/externals/genesis/source/genesis/source/text_step.cpp @@ -1,49 +1,49 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "text_step.hpp" - -#include "essentials/base.hpp" - -#include "recipe_callback.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -text_step::text_step( const std::string& _text ) : - recipe_step(), - text_( _text ) -{ - // Nothing to do... -} - - -text_step::~text_step() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void text_step::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - SX_UNUSED_PARAMETER( _recipe_callback ); - _ostream << text_; -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "text_step.hpp" + +#include "essentials/base.hpp" + +#include "recipe_callback.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +text_step::text_step( const std::string& _text ) : + recipe_step(), + text_( _text ) +{ + // Nothing to do... +} + + +text_step::~text_step() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void text_step::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + SX_UNUSED_PARAMETER( _recipe_callback ); + _ostream << text_; +} + + +} + + +} diff --git a/genesis/source/variable_step.cpp b/externals/genesis/source/genesis/source/variable_step.cpp similarity index 96% rename from genesis/source/variable_step.cpp rename to externals/genesis/source/genesis/source/variable_step.cpp index 43acfce..23d75ff 100644 --- a/genesis/source/variable_step.cpp +++ b/externals/genesis/source/genesis/source/variable_step.cpp @@ -1,46 +1,46 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "variable_step.hpp" - -#include "recipe_callback.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -variable_step::variable_step( const std::string& _variable_name ) : - recipe_step(), - variable_name_( _variable_name ) -{ - // Nothing to do... -} - - -variable_step::~variable_step() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void variable_step::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) -{ - _ostream << _recipe_callback.get_variable_content( variable_name_ ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "variable_step.hpp" + +#include "recipe_callback.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +variable_step::variable_step( const std::string& _variable_name ) : + recipe_step(), + variable_name_( _variable_name ) +{ + // Nothing to do... +} + + +variable_step::~variable_step() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void variable_step::create( recipe_callback& _recipe_callback, std::stringstream& _ostream ) +{ + _ostream << _recipe_callback.get_variable_content( variable_name_ ); +} + + +} + + +} diff --git a/genesis/source/version.cpp b/externals/genesis/source/genesis/source/version.cpp similarity index 92% rename from genesis/source/version.cpp rename to externals/genesis/source/genesis/source/version.cpp index 74d4df0..10b1c00 100644 --- a/genesis/source/version.cpp +++ b/externals/genesis/source/genesis/source/version.cpp @@ -1,81 +1,81 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex genesis library (http://genesis.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://genesis.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include - -#include "essentials/sxprintf.hpp" - -#include "version.hpp" -#include "build_number.hpp" - - -namespace sx -{ - - -namespace genesis -{ - - -namespace version -{ - - -namespace -{ - - -const sxe::uint16_t VERSION_MAJOR( 0 ); -const sxe::uint16_t VERSION_MINOR( 3 ); -const sxe::uint16_t VERSION_PATCH( 1 ); - - -} - - -// cppcheck-suppress unusedFunction -void log_version() -{ - std::cout << sxe::sxprintf( "genesis library version %.%.%.%.", get_major_version(), - get_minor_version(), get_patch_version(), get_build_number() ) << std::endl; -} - - -sxe::uint16_t get_major_version() -{ - return( VERSION_MAJOR ); -} - - -sxe::uint16_t get_minor_version() -{ - return( VERSION_MINOR ); -} - - -sxe::uint16_t get_patch_version() -{ - return( VERSION_PATCH ); -} - - -sxe::uint16_t get_build_number() -{ - return( BUILD_NUMBER ); -} - - -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex genesis library (http://genesis.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://genesis.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include + +#include "essentials/sxprintf.hpp" + +#include "version.hpp" +#include "build_number.hpp" + + +namespace sx +{ + + +namespace genesis +{ + + +namespace version +{ + + +namespace +{ + + +const sxe::uint16_t VERSION_MAJOR( 0 ); +const sxe::uint16_t VERSION_MINOR( 3 ); +const sxe::uint16_t VERSION_PATCH( 2 ); + + +} + + +// cppcheck-suppress unusedFunction +void log_version() +{ + std::cout << sxe::sxprintf( "genesis library version %.%.%.%.", get_major_version(), + get_minor_version(), get_patch_version(), get_build_number() ) << std::endl; +} + + +sxe::uint16_t get_major_version() +{ + return( VERSION_MAJOR ); +} + + +sxe::uint16_t get_minor_version() +{ + return( VERSION_MINOR ); +} + + +sxe::uint16_t get_patch_version() +{ + return( VERSION_PATCH ); +} + + +sxe::uint16_t get_build_number() +{ + return( BUILD_NUMBER ); +} + + +} + + +} + + +} diff --git a/externals/hermes/CMakeLists.txt b/externals/hermes/CMakeLists.txt new file mode 100644 index 0000000..2c7e9ef --- /dev/null +++ b/externals/hermes/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) + +project(hermes) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +add_subdirectory(source) \ No newline at end of file diff --git a/externals/hermes/source/CMakeHelpers/addBoost.cmake b/externals/hermes/source/CMakeHelpers/addBoost.cmake new file mode 100644 index 0000000..d833dc1 --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/addBoost.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(Y_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${Y_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${Y_BOOST_LIB_INCLUDE}) + set(SX_BOOST_LIB_PATH ${Y_BOOST_LIB_PATH}) + set(SX_BOOST_LIB_INCLUDE ${Y_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("Y_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") +elseif(SX_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${SX_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${SX_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("SX_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + +else() + message("SX_BOOST_LIB_INCLUDE is not set by user. Searching for boost libraries.") + set(Boost_USE_MULTITHREADED ON) + find_package(Boost COMPONENTS date_time filesystem system program_options chrono thread random unit_test_framework) + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + message("Boost found.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + else() + message(STATUS "Boost libraries not found!") + endif() +endif() diff --git a/externals/hermes/source/CMakeHelpers/addSeadexOptions.cmake b/externals/hermes/source/CMakeHelpers/addSeadexOptions.cmake new file mode 100644 index 0000000..48bd9c6 --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/addSeadexOptions.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +# Seadex preprocessor definitions + + +option("SX_NO_LOGGING" "Use when you want to use no logging at all (no logging code is created).") +if( "${SX_NO_LOGGING}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_LOGGING\"") + message(STATUS "No logging used.") +else() + message(STATUS "Logger is used.") +endif() + + +option("SX_NO_STD_MAKE_UNIQUE" "When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then.") +if( "${SX_NO_STD_MAKE_UNIQUE}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_STD_MAKE_UNIQUE\"") + message(STATUS "SX_NO_STD_MAKE_UNIQUE is defined.") +endif() + + +option("SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG" "Sets to use a workaround for bug in GCC with expansion of template parameter pack that appears in a lambda-expression (bug reported for GCC 4.8.4)") +if( "${SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG}" ) + set(extra_flags "${extra_flags} -D \"SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG\"") + message(STATUS "SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG is defined.") +endif() \ No newline at end of file diff --git a/externals/hermes/source/CMakeHelpers/addSpecificFlags.cmake b/externals/hermes/source/CMakeHelpers/addSpecificFlags.cmake new file mode 100644 index 0000000..b568fbb --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/addSpecificFlags.cmake @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +add_compiler_flag("-Wall") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +#gcc/clang compiler flags + if(NOT "SX_PEDANTIC" STREQUAL "OFF") + add_compiler_flag("-pedantic") + endif() + + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_compiler_flag("-g") + endif() + + if("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++03") + add_compiler_flag("-D \"SX_CPP03_BOOST\"") + add_compiler_flag("-D \"SX_NO_VARIADIC_MACRO\"") + elseif("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++14") + else() + add_compiler_flag("-std=c++11") + add_compiler_flag("-D \"SX_NO_STD_MAKE_UNIQUE\"") + endif() + +# platform + if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) + add_compiler_flag("-m64") + message(STATUS "setting platform x64") + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") + add_compiler_flag("-m32") + message(STATUS "setting platform x86") + endif() +endif() + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Checks buffer security. + set(extra_flags "${extra_flags} /GS") + + #Sets output warning level. + set(extra_flags "${extra_flags} /W4") + + #Disable specific Warnings. + set(extra_flags "${extra_flags} /wd\"4127\" /wd\"4250\"") + + #Defines constants and macros. + set(extra_flags "${extra_flags} /D \"_CRT_SECURE_NO_WARNINGS\"") + + #Enables function-level linking. + set(extra_flags "${extra_flags} /Gy") + + #Specifies standard behaviour under /Ze. + set(extra_flags "${extra_flags} /Zc:wchar_t /Zc:inline") + + #Disable minimal rebuild. + set(extra_flags "${extra_flags} /Gm-") + + #Enables additional security features and warnings. + set(extra_flags "${extra_flags} /sdl") + + #Specifies floating-point behaviour. + set(extra_flags "${extra_flags} /fp:precise") + + #Multibyte character sets macro. + set(extra_flags "${extra_flags} /D \"_MBCS\"") + + #Enables you to provide internal compiler error (ICE) information directly to the Visual C++ team. + set(extra_flags "${extra_flags} /errorReport:prompt") + + #Treats warnings as errors. + if( "${MSVC_VERSION}" STRGREATER "1800" ) + set(extra_flags "${extra_flags} /WX") + #else( "${MSVC_VERSION}" STRLESS "1900" ) + else() + set(extra_flags "${extra_flags} /WX-") + endif() + + + #Generates intrinsic functions. + set(extra_flags "${extra_flags} /Oi") + + #Specifies the model of exception handling. + set(extra_flags "${extra_flags} /EHsc") + + #Creates an object file. + set(extra_flags "${extra_flags} /Fo") + + #Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. + #set(extra_flags "${extra_flags} /NXCOMPAT") + + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() + +endif() \ No newline at end of file diff --git a/externals/hermes/source/CMakeHelpers/addYasmineOptions.cmake b/externals/hermes/source/CMakeHelpers/addYasmineOptions.cmake new file mode 100644 index 0000000..7964d92 --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/addYasmineOptions.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +include("${CMAKE_CURRENT_LIST_DIR}/addSeadexOptions.cmake") + +# yasmine's preprocessor definitions + + +set(Y_OPTIMIZE "SPEED" CACHE STRING "Sets the optimize type. Supported values: SPEED and SIZE. Default value is SPEED.") +if( "${Y_OPTIMIZE}" STREQUAL "SIZE" ) + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SIZE\"") + message(STATUS "Optimizing for size.") +else() + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SPEED\"") + message(STATUS "Optimizing for speed.") +endif() + + +option("Y_LEAN_AND_MEAN" "If you compile the library with Y_LEAN_AND_MEAN being defined or if you define the macro locally before including yasmine.hpp, all the state pseudostates and the asynchronous simple state (with the asynchronous behaviour) are excluded (i.e. those headers are not included). This can reduce compile time.") +if( "${Y_LEAN_AND_MEAN}" ) + set(extra_flags "${extra_flags} -D \"Y_LEAN_AND_MEAN\"") + message(STATUS "Y_LEAN_AND_MEAN is defined.") +endif() + +option("Y_PROFILER" "If Y_PROFILER is defined, the state machine will count the number of events that were processed. The user can query the counter by calling the 'get_number_of_processed_events' method.") +if( "${Y_PROFILER}" ) + set(extra_flags "${extra_flags} -D \"Y_PROFILER\"") + message(STATUS "Y_PROFILER is defined.") +endif() + diff --git a/externals/hermes/source/CMakeHelpers/functions.cmake b/externals/hermes/source/CMakeHelpers/functions.cmake new file mode 100644 index 0000000..3a76857 --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/functions.cmake @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +function(use_pthread varName) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(${varName} ${${varName}} pthread PARENT_SCOPE) + endif() +endfunction() + + +function(use_boost_libraries varName) + set(${varName} ${${varName}} ${Boost_LIBRARIES} PARENT_SCOPE) +endfunction() + + +function(add_library_for_linking varName libraryName) + set(${varName} ${${varName}} ${libraryName} PARENT_SCOPE) +endfunction() diff --git a/externals/hermes/source/CMakeHelpers/functionsAddCompilerFlags.cmake b/externals/hermes/source/CMakeHelpers/functionsAddCompilerFlags.cmake new file mode 100644 index 0000000..105747b --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/functionsAddCompilerFlags.cmake @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +include(CheckCXXCompilerFlag) + + +function(add_compiler_flag varFlag) + string(FIND "${CMAKE_CXX_FLAGS}" "${varFlag}" flag_already_set) + if(flag_already_set EQUAL -1) + check_cxx_compiler_flag("${varFlag}" flag_supported) + if(flag_supported) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${varFlag}" PARENT_SCOPE) + endif() + unset(flag_supported CACHE) + endif() +endfunction() diff --git a/externals/hermes/source/CMakeHelpers/functionsRapidJSON.cmake b/externals/hermes/source/CMakeHelpers/functionsRapidJSON.cmake new file mode 100644 index 0000000..c638987 --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/functionsRapidJSON.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +function(use_rapid_JSON) +if(SX_RAPIDJSON) + message("SX_RAPIDJSON is set by user.") +else() + message("SX_RAPIDJSON is not set by user. Setting default value.") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + find_package(RapidJSON) + if(NOT ("${RAPIDJSON_INCLUDE_DIRS}" STREQUAL "")) + set(SX_RAPIDJSON ${RAPIDJSON_INCLUDE_DIRS}) + message(STATUS "Found rapidjson on: ${RAPIDJSON_INCLUDE_DIRS}") + else() + set(SX_RAPIDJSON /usr/include) + message(STATUS "Set default value for rapidjson") + endif() + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(SX_RAPIDJSON "C:\\Program Files") + endif() +endif() + +include_directories(${SX_RAPIDJSON}) + +message(STATUS "include rapidJSON from: ${SX_RAPIDJSON}") + +endfunction() diff --git a/externals/hermes/source/CMakeHelpers/setVariables.cmake b/externals/hermes/source/CMakeHelpers/setVariables.cmake new file mode 100644 index 0000000..a6f1454 --- /dev/null +++ b/externals/hermes/source/CMakeHelpers/setVariables.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +if(("${Y_STATIC}" STREQUAL "ON") OR ("${SX_STATIC}" STREQUAL "ON")) + set(LINK_TYPE "STATIC") +else() + set(LINK_TYPE "SHARED") +endif() diff --git a/externals/hermes/source/CMakeLists.txt b/externals/hermes/source/CMakeLists.txt new file mode 100644 index 0000000..2f86fb3 --- /dev/null +++ b/externals/hermes/source/CMakeLists.txt @@ -0,0 +1,13 @@ + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +include(./CMakeHelpers/setVariables.cmake) + +include(./CMakeHelpers/addBoost.cmake) +include(./CMakeHelpers/functions.cmake) +include(./CMakeHelpers/functionsAddCompilerFlags.cmake) + +add_subdirectory(externals) +add_subdirectory(hermes) diff --git a/externals/hermes/source/build/c++03.props b/externals/hermes/source/build/c++03.props new file mode 100644 index 0000000..789513c --- /dev/null +++ b/externals/hermes/source/build/c++03.props @@ -0,0 +1,31 @@ + + + + + ..\..\..\..\3rd party\boost\Content\boost_1_60_0 + ..\..\..\..\3rd party\boost\Content\boost_1_60_0\stage\VS2015\$(Platform)\lib + + + <_PropertySheetDisplayName>c++03 + + + + SX_NO_VARIADIC_MACRO;SX_CPP03_BOOST;BOOST_SP_USE_STD_ATOMIC;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + $(BOOST_PATH);%(AdditionalIncludeDirectories) + + + + $(BOOST_LIB_PATH);$(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/hermes/source/build/debug_info.props b/externals/hermes/source/build/debug_info.props new file mode 100644 index 0000000..5dc702b --- /dev/null +++ b/externals/hermes/source/build/debug_info.props @@ -0,0 +1,18 @@ + + + + + + + + + NotSet + true + + + EditAndContinue + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + + \ No newline at end of file diff --git a/externals/hermes/source/build/hermes.props b/externals/hermes/source/build/hermes.props new file mode 100644 index 0000000..83bbf52 --- /dev/null +++ b/externals/hermes/source/build/hermes.props @@ -0,0 +1,32 @@ + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Level4 + 4127;4250 + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + None + false + true + ..\essentials\include;include;%(AdditionalIncludeDirectories) + /D "_STL_WARNING_LEVEL=3" %(AdditionalOptions) + + + + + + No + Default + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + + + + \ No newline at end of file diff --git a/externals/hermes/source/build/use_boost_externals.props b/externals/hermes/source/build/use_boost_externals.props new file mode 100644 index 0000000..cdd4e52 --- /dev/null +++ b/externals/hermes/source/build/use_boost_externals.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/hermes/source/build/use_essentials.props b/externals/hermes/source/build/use_essentials.props new file mode 100644 index 0000000..ff74c75 --- /dev/null +++ b/externals/hermes/source/build/use_essentials.props @@ -0,0 +1,21 @@ + + + + + + + ..\externals\essentials\source\essentials\include;%(AdditionalIncludeDirectories) + + + + + + Default + essentials.lib;%(AdditionalDependencies) + + + false + + + + \ No newline at end of file diff --git a/externals/hermes/source/changelog.txt b/externals/hermes/source/changelog.txt new file mode 100644 index 0000000..861e3a1 --- /dev/null +++ b/externals/hermes/source/changelog.txt @@ -0,0 +1,29 @@ +# Change log +All notable changes to this project are documented in this file. + +##[1.2.0] - 2017-12-18 + +## Changed +• use essentials as a library. +• CMake: use external CMakeHelpers files +• CMake: refactoring of build scripts + + +##[1.1.0] - 2017-09-20 + +### Added +• Support for Visual Studio 2017 builds + +### Changed +• removed uri delimiter from globals + + +##[1.0.1] - 2017-04-07 + +### Changed +• 3rd party component 'essentials' was moved inside 'externals' folder. + + +##[1.0.0] - 2017-04-03 + +• The very first released version of hermes diff --git a/externals/hermes/source/externals/CMakeLists.txt b/externals/hermes/source/externals/CMakeLists.txt new file mode 100644 index 0000000..e095099 --- /dev/null +++ b/externals/hermes/source/externals/CMakeLists.txt @@ -0,0 +1,11 @@ +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + if (NOT TARGET libessentials) + message(STATUS "essentuals was not build before. It is build now.") + add_subdirectory(essentials) + endif() +else() + if (NOT TARGET essentials) + message(STATUS "essentuals was not build before. It is build now.") + add_subdirectory(essentials) + endif() +endif() diff --git a/externals/hermes/source/externals/essentials/CMakeLists.txt b/externals/hermes/source/externals/essentials/CMakeLists.txt new file mode 100644 index 0000000..097f692 --- /dev/null +++ b/externals/hermes/source/externals/essentials/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) + +project(essentials) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +add_subdirectory(source) diff --git a/externals/hermes/source/externals/essentials/license/essentials_Anhang_Appendix_20170406.pdf b/externals/hermes/source/externals/essentials/license/essentials_Anhang_Appendix_20170406.pdf new file mode 100644 index 0000000..e6c6650 Binary files /dev/null and b/externals/hermes/source/externals/essentials/license/essentials_Anhang_Appendix_20170406.pdf differ diff --git a/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf new file mode 100644 index 0000000..1cdf2ed Binary files /dev/null and b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406.pdf differ diff --git a/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf new file mode 100644 index 0000000..037bf28 Binary files /dev/null and b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_geschaeftliche_Nutzung_Fassung_20170406_en.pdf differ diff --git a/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf new file mode 100644 index 0000000..0ba7c9e Binary files /dev/null and b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406.pdf differ diff --git a/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf new file mode 100644 index 0000000..90989c4 Binary files /dev/null and b/externals/hermes/source/externals/essentials/license/essentials_Lizenz_und_Nutzungsbedingungen_private_und wissenschaftliche_Nutzung_Fassung_20170406_en.pdf differ diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/addBoost.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addBoost.cmake new file mode 100644 index 0000000..d833dc1 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addBoost.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(Y_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${Y_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${Y_BOOST_LIB_INCLUDE}) + set(SX_BOOST_LIB_PATH ${Y_BOOST_LIB_PATH}) + set(SX_BOOST_LIB_INCLUDE ${Y_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("Y_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") +elseif(SX_BOOST_LIB_INCLUDE) + set(Boost_LIBRARIES ${SX_BOOST_LIB_PATH}) + set(Boost_INCLUDE_DIRS ${SX_BOOST_LIB_INCLUDE}) + + include_directories(${Boost_INCLUDE_DIRS}) + message("SX_BOOST_LIB_INCLUDE is set by user.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + +else() + message("SX_BOOST_LIB_INCLUDE is not set by user. Searching for boost libraries.") + set(Boost_USE_MULTITHREADED ON) + find_package(Boost COMPONENTS date_time filesystem system program_options chrono thread random unit_test_framework) + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + message("Boost found.") + message("Path to libraries: ${Boost_LIBRARIES}") + message("Path to includes: ${Boost_INCLUDE_DIRS}") + else() + message(STATUS "Boost libraries not found!") + endif() +endif() diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake new file mode 100644 index 0000000..48bd9c6 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addSeadexOptions.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +# Seadex preprocessor definitions + + +option("SX_NO_LOGGING" "Use when you want to use no logging at all (no logging code is created).") +if( "${SX_NO_LOGGING}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_LOGGING\"") + message(STATUS "No logging used.") +else() + message(STATUS "Logger is used.") +endif() + + +option("SX_NO_STD_MAKE_UNIQUE" "When the standard make_unique is not available (e.g. no C++14 support), you have to define this preprocessor definition. A yasmine drop-in replacement template will be used instead then.") +if( "${SX_NO_STD_MAKE_UNIQUE}" ) + set(extra_flags "${extra_flags} -D \"SX_NO_STD_MAKE_UNIQUE\"") + message(STATUS "SX_NO_STD_MAKE_UNIQUE is defined.") +endif() + + +option("SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG" "Sets to use a workaround for bug in GCC with expansion of template parameter pack that appears in a lambda-expression (bug reported for GCC 4.8.4)") +if( "${SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG}" ) + set(extra_flags "${extra_flags} -D \"SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG\"") + message(STATUS "SX_GCC_EXPAND_TEMPLATE_PARAM_PACK_BUG is defined.") +endif() \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake new file mode 100644 index 0000000..b568fbb --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addSpecificFlags.cmake @@ -0,0 +1,112 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +add_compiler_flag("-Wall") + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +#gcc/clang compiler flags + if(NOT "SX_PEDANTIC" STREQUAL "OFF") + add_compiler_flag("-pedantic") + endif() + + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_compiler_flag("-g") + endif() + + if("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++03") + add_compiler_flag("-D \"SX_CPP03_BOOST\"") + add_compiler_flag("-D \"SX_NO_VARIADIC_MACRO\"") + elseif("${CPP_VERSION}" STREQUAL "03") + add_compiler_flag("-std=c++14") + else() + add_compiler_flag("-std=c++11") + add_compiler_flag("-D \"SX_NO_STD_MAKE_UNIQUE\"") + endif() + +# platform + if( "${CMAKE_CXX_FLAGS}" STREQUAL "-m64" ) + add_compiler_flag("-m64") + message(STATUS "setting platform x64") + elseif("${CMAKE_CXX_FLAGS}" STREQUAL "-m32") + add_compiler_flag("-m32") + message(STATUS "setting platform x86") + endif() +endif() + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Checks buffer security. + set(extra_flags "${extra_flags} /GS") + + #Sets output warning level. + set(extra_flags "${extra_flags} /W4") + + #Disable specific Warnings. + set(extra_flags "${extra_flags} /wd\"4127\" /wd\"4250\"") + + #Defines constants and macros. + set(extra_flags "${extra_flags} /D \"_CRT_SECURE_NO_WARNINGS\"") + + #Enables function-level linking. + set(extra_flags "${extra_flags} /Gy") + + #Specifies standard behaviour under /Ze. + set(extra_flags "${extra_flags} /Zc:wchar_t /Zc:inline") + + #Disable minimal rebuild. + set(extra_flags "${extra_flags} /Gm-") + + #Enables additional security features and warnings. + set(extra_flags "${extra_flags} /sdl") + + #Specifies floating-point behaviour. + set(extra_flags "${extra_flags} /fp:precise") + + #Multibyte character sets macro. + set(extra_flags "${extra_flags} /D \"_MBCS\"") + + #Enables you to provide internal compiler error (ICE) information directly to the Visual C++ team. + set(extra_flags "${extra_flags} /errorReport:prompt") + + #Treats warnings as errors. + if( "${MSVC_VERSION}" STRGREATER "1800" ) + set(extra_flags "${extra_flags} /WX") + #else( "${MSVC_VERSION}" STRLESS "1900" ) + else() + set(extra_flags "${extra_flags} /WX-") + endif() + + + #Generates intrinsic functions. + set(extra_flags "${extra_flags} /Oi") + + #Specifies the model of exception handling. + set(extra_flags "${extra_flags} /EHsc") + + #Creates an object file. + set(extra_flags "${extra_flags} /Fo") + + #Marks an executable as verified to be compatible with the Windows Data Execution Prevention feature. + #set(extra_flags "${extra_flags} /NXCOMPAT") + + + # for release + if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" ) + #Creates fast code. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /PDB-") + + #Controls LINK optimizations. + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /OPT:REF /OPT:ICF") + + # for debug + elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) + #Creates a program database (PDB) file. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /PDB") + endif() + +endif() \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake new file mode 100644 index 0000000..7964d92 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/addYasmineOptions.cmake @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +include("${CMAKE_CURRENT_LIST_DIR}/addSeadexOptions.cmake") + +# yasmine's preprocessor definitions + + +set(Y_OPTIMIZE "SPEED" CACHE STRING "Sets the optimize type. Supported values: SPEED and SIZE. Default value is SPEED.") +if( "${Y_OPTIMIZE}" STREQUAL "SIZE" ) + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SIZE\"") + message(STATUS "Optimizing for size.") +else() + set(extra_flags "${extra_flags} -D \"Y_OPTIMIZE_4_SPEED\"") + message(STATUS "Optimizing for speed.") +endif() + + +option("Y_LEAN_AND_MEAN" "If you compile the library with Y_LEAN_AND_MEAN being defined or if you define the macro locally before including yasmine.hpp, all the state pseudostates and the asynchronous simple state (with the asynchronous behaviour) are excluded (i.e. those headers are not included). This can reduce compile time.") +if( "${Y_LEAN_AND_MEAN}" ) + set(extra_flags "${extra_flags} -D \"Y_LEAN_AND_MEAN\"") + message(STATUS "Y_LEAN_AND_MEAN is defined.") +endif() + +option("Y_PROFILER" "If Y_PROFILER is defined, the state machine will count the number of events that were processed. The user can query the counter by calling the 'get_number_of_processed_events' method.") +if( "${Y_PROFILER}" ) + set(extra_flags "${extra_flags} -D \"Y_PROFILER\"") + message(STATUS "Y_PROFILER is defined.") +endif() + diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/functions.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/functions.cmake new file mode 100644 index 0000000..3a76857 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/functions.cmake @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +function(use_pthread varName) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(${varName} ${${varName}} pthread PARENT_SCOPE) + endif() +endfunction() + + +function(use_boost_libraries varName) + set(${varName} ${${varName}} ${Boost_LIBRARIES} PARENT_SCOPE) +endfunction() + + +function(add_library_for_linking varName libraryName) + set(${varName} ${${varName}} ${libraryName} PARENT_SCOPE) +endfunction() diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake new file mode 100644 index 0000000..105747b --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/functionsAddCompilerFlags.cmake @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8) + +include(CheckCXXCompilerFlag) + + +function(add_compiler_flag varFlag) + string(FIND "${CMAKE_CXX_FLAGS}" "${varFlag}" flag_already_set) + if(flag_already_set EQUAL -1) + check_cxx_compiler_flag("${varFlag}" flag_supported) + if(flag_supported) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${varFlag}" PARENT_SCOPE) + endif() + unset(flag_supported CACHE) + endif() +endfunction() diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake new file mode 100644 index 0000000..c638987 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/functionsRapidJSON.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +function(use_rapid_JSON) +if(SX_RAPIDJSON) + message("SX_RAPIDJSON is set by user.") +else() + message("SX_RAPIDJSON is not set by user. Setting default value.") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + find_package(RapidJSON) + if(NOT ("${RAPIDJSON_INCLUDE_DIRS}" STREQUAL "")) + set(SX_RAPIDJSON ${RAPIDJSON_INCLUDE_DIRS}) + message(STATUS "Found rapidjson on: ${RAPIDJSON_INCLUDE_DIRS}") + else() + set(SX_RAPIDJSON /usr/include) + message(STATUS "Set default value for rapidjson") + endif() + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(SX_RAPIDJSON "C:\\Program Files") + endif() +endif() + +include_directories(${SX_RAPIDJSON}) + +message(STATUS "include rapidJSON from: ${SX_RAPIDJSON}") + +endfunction() diff --git a/externals/hermes/source/externals/essentials/source/CMakeHelpers/setVariables.cmake b/externals/hermes/source/externals/essentials/source/CMakeHelpers/setVariables.cmake new file mode 100644 index 0000000..a6f1454 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeHelpers/setVariables.cmake @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.8) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + + +if(("${Y_STATIC}" STREQUAL "ON") OR ("${SX_STATIC}" STREQUAL "ON")) + set(LINK_TYPE "STATIC") +else() + set(LINK_TYPE "SHARED") +endif() diff --git a/externals/hermes/source/externals/essentials/source/CMakeLists.txt b/externals/hermes/source/externals/essentials/source/CMakeLists.txt new file mode 100644 index 0000000..daef5a2 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/CMakeLists.txt @@ -0,0 +1,16 @@ + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +include(./CMakeHelpers/setVariables.cmake) + +include(./CMakeHelpers/addBoost.cmake) +include(./CMakeHelpers/functions.cmake) +include(./CMakeHelpers/functionsAddCompilerFlags.cmake) + +add_subdirectory(essentials) + +if(EXISTS essentials_unit_tests) +add_subdirectory(essentials_unit_tests) +endif() diff --git a/externals/hermes/source/externals/essentials/source/build/c++03.props b/externals/hermes/source/externals/essentials/source/build/c++03.props new file mode 100644 index 0000000..d76c9b5 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/c++03.props @@ -0,0 +1,31 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + <_PropertySheetDisplayName>c++03 + + + + SX_NO_VARIADIC_MACRO;SX_CPP03_BOOST;BOOST_SP_USE_STD_ATOMIC;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + $(BOOST_PATH);%(AdditionalIncludeDirectories) + + + + $(BOOST_LIB_PATH);$(SolutionDir)\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/build/debug_info.props b/externals/hermes/source/externals/essentials/source/build/debug_info.props new file mode 100644 index 0000000..5dc702b --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/debug_info.props @@ -0,0 +1,18 @@ + + + + + + + + + NotSet + true + + + EditAndContinue + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/build/essentials.props b/externals/hermes/source/externals/essentials/source/build/essentials.props new file mode 100644 index 0000000..8bdf813 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/essentials.props @@ -0,0 +1,31 @@ + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + Level4 + 4127;4250 + WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + None + false + true + include;%(AdditionalIncludeDirectories) + /D "_STL_WARNING_LEVEL=3" %(AdditionalOptions) + + + + + + No + Default + + + false + + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/build/use_boost.props b/externals/hermes/source/externals/essentials/source/build/use_boost.props new file mode 100644 index 0000000..85fdae4 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/use_boost.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/build/use_boost_as_external.props b/externals/hermes/source/externals/essentials/source/build/use_boost_as_external.props new file mode 100644 index 0000000..cdd4e52 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/use_boost_as_external.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\..\..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/build/use_boost_externals.props b/externals/hermes/source/externals/essentials/source/build/use_boost_externals.props new file mode 100644 index 0000000..27f07b7 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/use_boost_externals.props @@ -0,0 +1,30 @@ + + + + + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1 + ..\..\..\3rd party\libs\boost\Content\boost_1_65_1\stage\win\$(Platform)\$(PlatformToolsetVersion)\lib + + + + + + $(BOOST_PATH);%(AdditionalIncludeDirectories) + Y_USE_BOOST;BOOST_SP_USE_STD_ATOMIC;%(PreprocessorDefinitions) + + + $(BOOST_LIB_PATH);%(AdditionalLibraryDirectories) + + + + + + $(BOOST_PATH) + true + + + $(BOOST_LIB_PATH) + true + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/build/use_essentials.props b/externals/hermes/source/externals/essentials/source/build/use_essentials.props new file mode 100644 index 0000000..9f7bfc9 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/use_essentials.props @@ -0,0 +1,32 @@ + + + + + ..\..\..\essentials\source\essentials\include + ..\..\..\essentials\source\essentials\include\compatibility + ..\..\..\essentials\source\$(Platform)\$(Configuration) + + + + + $(ESSENTIALS_INCLUDE_PATH);$(ESSENTIALS_COMPATIBILITY_PATH);%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);$(ESSENTIALS_LIB_PATH);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + + $(ESSENTIALS_INCLUDE_PATH) + + + $(ESSENTIALS_COMPATIBILITY_PATH) + + + $(ESSENTIALS_LIB_PATH) + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/build/use_essentials_base.props b/externals/hermes/source/externals/essentials/source/build/use_essentials_base.props new file mode 100644 index 0000000..7f85a09 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/build/use_essentials_base.props @@ -0,0 +1,28 @@ + + + + + ..\essentials\include + ..\$(Platform)\$(Configuration) + + + + + $(ESSENTIALS_INCLUDE_PATH);$(ESSENTIALS_COMPATIBILITY_PATH);%(AdditionalIncludeDirectories) + None + + + + $(SolutionDir)\$(Platform)\$(Configuration);$(ESSENTIALS_LIB_PATH);%(AdditionalLibraryDirectories) + essentials.lib;%(AdditionalDependencies) + + + + + $(ESSENTIALS_INCLUDE_PATH) + + + $(ESSENTIALS_LIB_PATH) + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/changelog.txt b/externals/hermes/source/externals/essentials/source/changelog.txt new file mode 100644 index 0000000..d1a6a27 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/changelog.txt @@ -0,0 +1,38 @@ +# Change log +All notable changes to this project are documented in this file. + +##[1.3.2] - 2017-12-18 + +### Added +• SX_UNUSED_VARIABLE macro for suppressing warnings for unreferenced variable. +• backward compatibility for macros Y_NO_STD_MAKE_UNIQUE, Y_CPP03_BOOST, Y_UNIQUE_PTR, Y_MAKE_UNIQUE, Y_MAKE_SHARED, Y_UNUSED_PARAMETER + +### Changed +• CMake: use external CMakeHelpers files +• CMake: refactoring of build scripts + +### Fixed +• missing boost namespace in sxprintf + + +##[1.1.0] - 2017-09-20 + +### Added +• Support for Visual Studio 2017 builds +• conversion functions: to_lower and to_upper +• added uri class + + +##[1.0.1] - 2017-04-07 + +### Changed +• macro helpers improved to count up to 15 parameters +• essentials file structure refactoring. All source files are now located in the 'source' folder, the header files for compatibility +are located in the 'include/essentials/compatibility' folder and other header files are located in the 'include/essentials' folder. + + +##[1.0.0] - 2017-03-30 + +• The very first released version of essentials + + diff --git a/externals/hermes/source/externals/essentials/source/essentials.sln b/externals/hermes/source/externals/essentials/source/essentials.sln new file mode 100644 index 0000000..c96fe08 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials.sln @@ -0,0 +1,156 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2010 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials", "essentials\essentials.vcxproj", "{132F81F8-46DA-49D0-9071-D70BC087B38C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials_unit_tests", "essentials_unit_tests\essentials_unit_tests.vcxproj", "{6F4D72B1-E418-4859-8C19-D58659041948}" + ProjectSection(ProjectDependencies) = postProject + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build_tools", "build_tools", "{77439103-0A48-4243-8D07-3223DC5CF353}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMake", "CMake", "{86310DF6-AE4D-48C6-B302-80F5091FC09B}" + ProjectSection(SolutionItems) = preProject + ..\CMakeLists.txt = ..\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{1C08A7CC-21A3-42E1-AA39-7E03F88A73F3}" + ProjectSection(SolutionItems) = preProject + CMakeLists.txt = CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "essentials", "essentials", "{968024AC-A87C-40E9-B75A-B7AE9790C73F}" + ProjectSection(SolutionItems) = preProject + essentials\CMakeLists.txt = essentials\CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMakeHelpers", "CMakeHelpers", "{35E7ED3A-7DF9-4E75-B289-99B3D0050992}" + ProjectSection(SolutionItems) = preProject + CMakeHelpers\addBoost.cmake = CMakeHelpers\addBoost.cmake + CMakeHelpers\addSeadexOptions.cmake = CMakeHelpers\addSeadexOptions.cmake + CMakeHelpers\addSpecificFlags.cmake = CMakeHelpers\addSpecificFlags.cmake + CMakeHelpers\addYasmineOptions.cmake = CMakeHelpers\addYasmineOptions.cmake + CMakeHelpers\functions.cmake = CMakeHelpers\functions.cmake + CMakeHelpers\functionsAddCompilerFlags.cmake = CMakeHelpers\functionsAddCompilerFlags.cmake + CMakeHelpers\functionsRapidJSON.cmake = CMakeHelpers\functionsRapidJSON.cmake + CMakeHelpers\setVariables.cmake = CMakeHelpers\setVariables.cmake + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "essentials_unit_tests", "essentials_unit_tests", "{63218938-B7EC-4913-9B3B-CEAE1F2A925B}" + ProjectSection(SolutionItems) = preProject + essentials_unit_tests\CMakeLists.txt = essentials_unit_tests\CMakeLists.txt + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - C++ 03|Win32 = Debug - C++ 03|Win32 + Debug - C++ 03|x64 = Debug - C++ 03|x64 + Debug - C++ 03|x86 = Debug - C++ 03|x86 + Debug - VS 2015|Win32 = Debug - VS 2015|Win32 + Debug - VS 2015|x64 = Debug - VS 2015|x64 + Debug - VS 2015|x86 = Debug - VS 2015|x86 + Debug - VS 2017|Win32 = Debug - VS 2017|Win32 + Debug - VS 2017|x64 = Debug - VS 2017|x64 + Debug - VS 2017|x86 = Debug - VS 2017|x86 + Release - C++ 03|Win32 = Release - C++ 03|Win32 + Release - C++ 03|x64 = Release - C++ 03|x64 + Release - C++ 03|x86 = Release - C++ 03|x86 + Release - VS 2015|Win32 = Release - VS 2015|Win32 + Release - VS 2015|x64 = Release - VS 2015|x64 + Release - VS 2015|x86 = Release - VS 2015|x86 + Release - VS 2017|Win32 = Release - VS 2017|Win32 + Release - VS 2017|x64 = Release - VS 2017|x64 + Release - VS 2017|x86 = Release - VS 2017|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.Build.2 = Debug - VS 2013|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {6F4D72B1-E418-4859-8C19-D58659041948}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {86310DF6-AE4D-48C6-B302-80F5091FC09B} = {77439103-0A48-4243-8D07-3223DC5CF353} + {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} = {86310DF6-AE4D-48C6-B302-80F5091FC09B} + {968024AC-A87C-40E9-B75A-B7AE9790C73F} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + {35E7ED3A-7DF9-4E75-B289-99B3D0050992} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + {63218938-B7EC-4913-9B3B-CEAE1F2A925B} = {1C08A7CC-21A3-42E1-AA39-7E03F88A73F3} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CB028EB1-46EF-44C3-B508-97BC3E09DC4D} + EndGlobalSection +EndGlobal diff --git a/externals/hermes/source/externals/essentials/source/essentials/CMakeLists.txt b/externals/hermes/source/externals/essentials/source/essentials/CMakeLists.txt new file mode 100644 index 0000000..edc08df --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 2.8) + +project(essentials) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +file(GLOB essentials_SRC "include/essentials/*.hpp" "include/essentials/compatibility/*.hpp" "source/*.cpp") + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +include(./../CMakeHelpers/addSpecificFlags.cmake) +include(./../CMakeHelpers/addSeadexOptions.cmake) + +include_directories("./include") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library(libessentials ${LINK_TYPE} ${essentials_SRC}) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library(essentials STATIC ${essentials_SRC}) +endif() + + +file(GLOB essentials_hpp "include/essentials/*.hpp" "include/essentials/compatibility/*.hpp") +install(FILES ${essentials_hpp} DESTINATION include/essentials/include) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + install(TARGETS libessentials DESTINATION lib) + set_target_properties(libessentials PROPERTIES PREFIX "") +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + install(TARGETS essentials DESTINATION lib) + set_target_properties(essentials PROPERTIES PREFIX "") +endif() diff --git a/externals/hermes/source/externals/essentials/source/essentials/essentials.vcxproj b/externals/hermes/source/externals/essentials/source/essentials/essentials.vcxproj new file mode 100644 index 0000000..63f7f7e --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/essentials.vcxproj @@ -0,0 +1,545 @@ + + + + + Debug - C++ 03 + Win32 + + + Debug - C++ 03 + x64 + + + Debug - Clang + Win32 + + + Debug - Clang + x64 + + + Debug - VS 2013 + Win32 + + + Debug - VS 2013 + x64 + + + Debug - VS 2015 + Win32 + + + Debug - VS 2015 + x64 + + + Debug - VS 2017 + Win32 + + + Release - C++ 03 + Win32 + + + Release - C++ 03 + x64 + + + Release - Clang + Win32 + + + Release - Clang + x64 + + + Release - VS 2015 + Win32 + + + Release - VS 2015 + x64 + + + Release - VS 2017 + Win32 + + + Debug - VS 2017 + x64 + + + Release - VS 2017 + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {132F81F8-46DA-49D0-9071-D70BC087B38C} + essentials + 8.1 + + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141_clang_c2 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Level3 + Disabled + true + + + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/essentials/essentials.vcxproj.filters b/externals/hermes/source/externals/essentials/source/essentials/essentials.vcxproj.filters new file mode 100644 index 0000000..e68031a --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/essentials.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {4a8b49fc-8912-43d5-a33a-962f5e097001} + + + {13a9f023-217a-4d7a-946f-8147bce1d21a} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + + + license + + + license + + + license + + + license + + + license + + + + + Header Files\compatibility + + + Header Files\compatibility + + + Header Files\compatibility + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\compatibility + + + \ No newline at end of file diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/base.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/base.hpp new file mode 100644 index 0000000..9ea9eb7 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/base.hpp @@ -0,0 +1,41 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A +#define BASE_0C97CC9D_8A5B_4696_9964_49819CD9233A + + +//!\def SX_ASSERT( _condition, _message ) +//!\brief Assert a given condition. Adds the message to the assert for better diagnostics when the assert is triggered. +#define SX_ASSERT( _condition, _message ) \ + do \ + { \ + assert( ( _condition ) && _message ); \ + } \ + while( 0 ) + +//!\def SX_ASSERTED( _x ) +//!\brief Suppress warnings for variables that are only used within asserts. +#define SX_ASSERTED( _x ) static_cast< void >( _x ); + +//!\def SX_UNUSED_PARAMETER( _x ) +//!\brief Suppress warnings for unreferenced parameters. +#define SX_UNUSED_PARAMETER( _x ) static_cast( _x ) + + +//!\def SX_UNUSED_VARIABLE( _x ) +//!\brief Suppress warnings for unreferenced variable. +#define SX_UNUSED_VARIABLE( _x ) static_cast( _x ) + + +#include + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/build_number.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/build_number.hpp new file mode 100644 index 0000000..6771ace --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/build_number.hpp @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 +#define BUILD_NUMBER_0A2C7A7F_B3EC_443A_BDD8_652E7DEFC433 + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + +namespace version +{ + + + const sxe::uint16_t BUILD_NUMBER( 96 ); + + +} + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp new file mode 100644 index 0000000..1946dc4 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/chrono.hpp @@ -0,0 +1,59 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 +#define CHRONO_2625645C_6611_46F7_AA2F_6F3B256839F3 + + +#ifdef SX_CPP03_BOOST + +#include + +#else + +#include + +#endif + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + using boost::chrono::time_point; + using boost::chrono::system_clock; + using boost::chrono::steady_clock; + using boost::chrono::seconds; + using boost::chrono::milliseconds; + using boost::chrono::duration_cast; + using boost::chrono::time_point; + + +#else // C++11 compatibility + + + using std::chrono::time_point; + using std::chrono::system_clock; + using std::chrono::steady_clock; + using std::chrono::milliseconds; + using std::chrono::seconds; + using std::chrono::duration_cast; + using std::chrono::time_point; + + +#endif + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp new file mode 100644 index 0000000..4d5e764 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/compatibility.hpp @@ -0,0 +1,184 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 +#define COMPATIBILITY_63A35CFD_26BC_42BE_9F09_D559349FFE63 + + +#include "essentials_backward_compatibility.hpp" + + +#ifdef SX_CPP03_BOOST +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4456 ) +#pragma warning( disable : 4996 ) +#endif + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + +#else +#include +#include +#include +#include +#include +#endif + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + #define SX_OVERRIDE + #define SX_FINAL + #define SX_DELETE + #define SX_NULLPTR NULL + + #define SX_FOR(_variable, _container) BOOST_FOREACH( _variable, _container ) + + #define SX_CONSTEXPR const + + #define SX_NOEXCEPT throw() + + + using boost::shared_ptr; + #define SX_UNIQUE_PTR shared_ptr + + #define SX_MAKE_SHARED boost::make_shared + #define SX_MAKE_UNIQUE boost::make_shared + + template + _type& move(_type& _t) + { + return( _t ); + } + + using boost::int8_t; + using boost::int16_t; + using boost::int32_t; + using boost::int64_t; + using boost::uint8_t; + using boost::uint16_t; + using boost::uint32_t; + using boost::uint64_t; + + using boost::bind; + using boost::ref; + using boost::cref; + using boost::placeholders::_1; + using boost::placeholders::_2; + + using boost::function; + + using boost::remove_reference; + using boost::remove_const; + + using boost::random_device; + + +#else // C++11 compatibility + + #ifdef SX_NO_STD_MAKE_UNIQUE + + template< typename t, typename ... args > + std::unique_ptr< t > make_unique(args&& ... _args) + { + return( std::unique_ptr< t >(new t(std::forward< args >(_args)...)) ); + } + + #else + + using std::make_unique; + + #endif + + #define SX_OVERRIDE override + #define SX_FINAL final + #define SX_DELETE = delete + #define SX_NULLPTR nullptr + + #define SX_FOR(_variable, _container) for( _variable : _container ) + + #ifdef _MSC_VER + #if _MSC_VER <= 1800 + #define SX_CONSTEXPR const + #endif + #endif + + #ifndef SX_CONSTEXPR + #define SX_CONSTEXPR constexpr + #endif + +#ifdef _MSC_VER + #if _MSC_VER <= 1800 + #define SX_NOEXCEPT throw() + #else + #define SX_NOEXCEPT noexcept + #endif +#else + #define SX_NOEXCEPT noexcept +#endif + + using std::shared_ptr; + template + using SX_UNIQUE_PTR = std::unique_ptr<_pointee>; + + #define SX_MAKE_SHARED std::make_shared + #define SX_MAKE_UNIQUE sxe::make_unique + + using std::move; + + + using std::int8_t; + using std::int16_t; + using std::int32_t; + using std::int64_t; + using std::uint8_t; + using std::uint16_t; + using std::uint32_t; + using std::uint64_t; + + using std::bind; + using std::ref; + using std::cref; + using std::placeholders::_1; + using std::placeholders::_2; + + using std::function; + + using std::remove_reference; + using std::remove_const; + + using std::random_device; + + +#endif + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp new file mode 100644 index 0000000..c0b2d60 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/essentials_backward_compatibility.hpp @@ -0,0 +1,31 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 +#define ESSENTIALS_BACKWARD_COMPATIBILITY_EBFE3698_30C0_456A_A146_1F081011CB49 + + +#ifdef Y_NO_STD_MAKE_UNIQUE +#define SX_NO_STD_MAKE_UNIQUE +#endif + + +#ifdef Y_CPP03_BOOST +#define SX_CPP03_BOOST +#endif + + +#define Y_UNIQUE_PTR SX_UNIQUE_PTR +#define Y_MAKE_UNIQUE SX_MAKE_UNIQUE +#define Y_MAKE_SHARED SX_MAKE_SHARED +#define Y_UNUSED_PARAMETER SX_UNUSED_PARAMETER + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp new file mode 100644 index 0000000..2381481 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/compatibility/thread.hpp @@ -0,0 +1,63 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF +#define THREAD_A43220E4_F5F8_42D5_9B31_749D813922CF + + +#ifdef SX_CPP03_BOOST + +#include +#include + +#else + +#include +#include +#include +#include + +#endif + + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST // C++03 compatibility + + using boost::thread; + using boost::unique_lock; + using boost::mutex; + using boost::lock_guard; + using boost::condition_variable; + using boost::this_thread::sleep_for; + using boost::atomic; + + +#else // C++11 compatibility + + + using std::thread; + using std::unique_lock; + using std::mutex; + using std::lock_guard; + using std::condition_variable; + using std::this_thread::sleep_for; + using std::atomic; + + +#endif + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/conversion.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/conversion.hpp new file mode 100644 index 0000000..c46dd99 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/conversion.hpp @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 +#define CONVERSION_99CAC61B_DD8A_43E2_8612_0F42873A5741 + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + + //!\brief Converts a number from string to int. + //!\param _int_as_string Number in string format. + //!\param _result Variable where the result will be stored. + //!\return True on success, false otherwise. + bool string_to_int( const char* const _int_as_string, int& _result ); + + //!\brief Converts a number from unsigned int 32 to string. + //!\param _value Number to be converted. + //!\return Number as string. + std::string to_string( const sxe::uint32_t _value ); + + //!\brief Converts a number from int to string. + //!\param _value Number to be converted. + //!\return Number as string. + std::string to_string( const int _value ); + + //!\brief Converts a string to uppercase. + //!\param _value String to be converted. + //!\return String in uppercase format. + //!\sa to_lower + std::string to_upper( const std::string& _value ); + + //!\brief Converts a string to lowercase. + //!\param _value String to be converted. + //!\return String in lowercase format. + //!\sa to_upper + std::string to_lower( const std::string& _value ); + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/essentials_version.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/essentials_version.hpp new file mode 100644 index 0000000..96d967f --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/essentials_version.hpp @@ -0,0 +1,41 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E +#define VERSION_E55DC329_9A27_4598_928C_1CD8A4AA389E + + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + + +namespace version +{ + + +void log_version(); + + +sxe::uint16_t get_major_version(); +sxe::uint16_t get_minor_version(); +sxe::uint16_t get_patch_version(); +sxe::uint16_t get_build_number(); + + +} + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/exception.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/exception.hpp new file mode 100644 index 0000000..76ad4b8 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/exception.hpp @@ -0,0 +1,30 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 +#define EXCEPTION_B675DC28_13E9_4827_9916_4649C36BD407 + + +#include "exception_template.hpp" + + +namespace sxe +{ + + +//!\def SX_EXCEPTION( exception ) +//!\brief The Seadex essentials exception class. +SX_EXCEPTION( exception ) + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/exception_template.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/exception_template.hpp new file mode 100644 index 0000000..2415a7d --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/exception_template.hpp @@ -0,0 +1,160 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D +#define EXCEPTION_TEMPLATE_6EFED438_B578_4EF6_B02A_53DC49B89A0D + + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/sxprintf.hpp" + + +#ifndef SX_CPP03_BOOST + + +//!\def SX_EXCEPTION( _name ) +//!\brief Create an exception class inheriting std::exception with the given name. It also supports +//! creating messages with placeholders by calling sxprintf. +//!\sa sxprintf +#define SX_EXCEPTION( _name ) \ +class _name: public std::exception \ +{ \ +public: \ + template< typename ... args > \ + _name(const std::string & _what, args ... _args ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _args ... ) ) \ + { \ + } \ +\ +\ + virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ +\ +\ + virtual const char* what() const throw () SX_OVERRIDE \ + { \ + return ( what_.c_str() ); \ + } \ +\ +\ +private: \ + std::string what_; \ +\ +\ +}; + + +#else + + +#define SX_EXCEPTION( _name ) \ +class _name: public std::exception \ +{ \ +public: \ + explicit _name(const std::string & _what ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str() ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6 ) ) \ + { \ + } \ +\ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ) \ + { \ + } \ +\ +\ + explicit _name(const std::string & _what, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ):\ + std::exception(), \ + what_( sxe::sxprintf( _what.c_str(), _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ) \ + { \ + } \ +\ +\ + virtual ~_name () SX_NOEXCEPT SX_OVERRIDE {}\ +\ +\ + virtual const char* what() const throw () SX_OVERRIDE \ + { \ + return ( what_.c_str() ); \ + } \ +\ +\ +private: \ + std::string what_; \ +\ +\ +}; + + +#endif + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/format_settings.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/format_settings.hpp new file mode 100644 index 0000000..757c60a --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/format_settings.hpp @@ -0,0 +1,45 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB +#define FORMAT_SETTINGS_1D24A599_70E3_42BB_BFE6_46BD94217FAB + + +#include + +#include "compatibility/compatibility.hpp" + + +namespace sxe +{ + +//!\struct format_settings +//!\brief Structure containing information for formatting the output of sxprintf. +struct format_settings SX_FINAL +{ + //!\brief Constructor. + format_settings(); + + + std::string format_string_; + bool missing_closing_bracket_; + bool correct_; + bool hex_; + bool pad_zeros_; + bool places_set_; + int places_; + bool decimal_places_set_; + int decimal_places_; +}; + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp new file mode 100644 index 0000000..b0777eb --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/macro_helpers.hpp @@ -0,0 +1,46 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 +#define MACRO_HELPERS_D52C3077_E0EF_4C4E_B451_1472DEE602E8 + + +#ifndef SX_NO_VARIADIC_MACRO + + +//!\def EXPAND( x ) +//!\brief Helper to work around some Visual C++ compiler quirk dealing with variadic macros. +#define EXPAND( x ) x + +//!\def CAT( A, B ) +//!\brief Concatenate two tokens. +#define CAT( A, B ) A ## B + +//!\def SELECT( NAME, NUM ) +//!\brief Creating a name from a base name and a number with underscore between them. +#define SELECT( NAME, NUM ) CAT( NAME ## _, NUM ) + +//!\def GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) +//!\brief Helper for counting the number of parameters of a macro. +#define GET_COUNT( _ONE, _TWO, _THREE, _FOUR, _FIVE, _SIX, _SEVEN, _EIGHT, _NINE, _TEN, _ELEVEN, _TWELVE, _THIRTEEN, _FOURTEEN, _FIFTEEN, COUNT, ... ) COUNT + +//!\def VA_SIZE( ... ) +//!\brief Count the number of parameters of a macro. +#define VA_SIZE( ... ) EXPAND( GET_COUNT( __VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1 ) ) + +//!\def VA_SELECT( NAME, ... ) +//!\brief Selects the correct overloaded macro based on the number of parameters. +#define VA_SELECT( NAME, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )(__VA_ARGS__) ) + + +#endif + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/non_copyable.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/non_copyable.hpp new file mode 100644 index 0000000..b93fff3 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/non_copyable.hpp @@ -0,0 +1,68 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 +#define NON_COPYABLE_D2C5BF6C_4B43_42AF_9E42_1AAE2B5C49C8 + + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST + + +//!\def SX_NO_COPY(_class_name) +//!\brief Delete the copy constructor and assignment operator of the given class. +#define SX_NO_COPY(_class_name)\ +private:\ + _class_name(const _class_name&) SX_DELETE;\ + _class_name& operator=(const _class_name&) SX_DELETE;\ +public:\ +\ + + +//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) +//!\brief Delete the assignment operator of the given class. +#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ +private:\ + _class_name& operator=( const _class_name& ) SX_DELETE;\ +public:\ +\ + + +#else + + +//!\def SX_NO_COPY(_class_name) +//!\brief Delete the copy constructor and assignment operator of the given class. +#define SX_NO_COPY(_class_name)\ + _class_name(const _class_name&) SX_DELETE;\ + _class_name& operator=(const _class_name&) SX_DELETE;\ +\ + + +//!\def SX_NO_ASSIGNMENT_OPERATOR(_class_name) +//!\brief Delete the assignment operator of the given class. +#define SX_NO_ASSIGNMENT_OPERATOR(_class_name)\ + _class_name& operator=( const _class_name& ) SX_DELETE;\ +\ + + +#endif + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/sxprintf.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/sxprintf.hpp new file mode 100644 index 0000000..0d9a863 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/sxprintf.hpp @@ -0,0 +1,242 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 +#define PRINTF_2B6FD3F2_C084_486B_805B_5F0E05B743E4 + + +#include +#include + + +#ifdef SX_CPP03_BOOST + #include + #include +#endif + +#include "compatibility/compatibility.hpp" +#include "format_settings.hpp" + + +namespace sxe +{ + + +#ifdef SX_CPP03_BOOST + typedef boost::variant< bool, int, unsigned int, sxe::int8_t, sxe::uint8_t, sxe::uint16_t, sxe::uint32_t, + std::string, std::size_t, const char*, boost::int_least64_t, double > value_type; + typedef std::vector< value_type > value_types; +#endif + + +extern const char PLACE_HOLDER; +extern const char* const SUPERFLUOUS_PARAMETER_START; +extern const char SUPERFLUOUS_PARAMETER_END; +extern const char OPENING_SQUARE_BRACKET; +extern const char CLOSING_SQUARE_BRACKET; + + +template< typename value > +struct stream_writer +{ + static void print( std::ostream& _os, const value& _value ) + { + _os << _value; + } +}; + + +template< > +struct stream_writer< sxe::uint8_t > +{ + static void print(std::ostream& _os, const sxe::uint8_t& _value) + { + _os << static_cast( _value ); + } +}; + + +// cppcheck-suppress unusedFunction +std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ); +sxe::format_settings parse_format_string( const char** const _format ); + + +#ifdef SX_CPP03_BOOST + +void print_value_type_value( std::ostream& _os, const value_type& _value ); + + +#endif + + +template< typename value > +void print_superfluous_parameters( std::ostream& _os, const value& _value ) +{ + _os << SUPERFLUOUS_PARAMETER_START; +#ifndef SX_CPP03_BOOST + stream_writer< value >::print( _os, _value ); +#else + print_value_type_value( _os, _value ); +#endif + _os << SUPERFLUOUS_PARAMETER_END; +} + + +#ifndef SX_CPP03_BOOST + + +template< typename value, typename ... args > +void print_superfluous_parameters( std::ostream& _os, + const value& _value, args ... _args ) +{ + _os << SUPERFLUOUS_PARAMETER_START; + stream_writer< value >::print( _os, _value ); + _os << SUPERFLUOUS_PARAMETER_END; + print_superfluous_parameters( _os, _args ... ); +} + + +#else + + +#endif + + +void sxprintf( std::ostream& _os, const char* _format ); + +#ifndef SX_CPP03_BOOST +template< typename value, typename ... args > +void sxprintf( std::ostream& _os, const char* _format, const value& _value, args ... _args ) +{ + while( *_format ) + { + if( PLACE_HOLDER == *_format ) + { + if( PLACE_HOLDER == *( _format + 1 ) ) + { + ++_format; // skip first place holder + _os << *_format++; // output of the second place holder + } + else + { + if( OPENING_SQUARE_BRACKET == *( _format + 1 ) ) + { + ++_format; + const sxe::format_settings format_settings = sxe::parse_format_string( &_format ); + const std::ios_base::fmtflags stream_flags = _os.flags(); + const char streafill_ = _os.fill(); + if( format_settings.correct_ ) + { + _os << format_settings; + stream_writer< value >::print( _os, _value ); + } + else + { + while( CLOSING_SQUARE_BRACKET != *( _format ) ) + { + ++_format; + } + stream_writer< value >::print( _os, _value ); + _os << format_settings; + } + _os.flags( stream_flags ); + _os.fill( streafill_ ); + } + else + { + stream_writer< value >::print( _os, _value ); + } + + sxprintf( _os, _format + 1, _args ... ); + return; + } + } + else + { + _os << *_format++; + } + } + + print_superfluous_parameters( _os, _value, _args ... ); +} + + +//!\brief Creates a formatted message. The format string can contain placeholders ('%'s) that will be replaced with +//!the parameters by this function. To emit a '%' use two percent signs ("%%"). +//!\param _format The format string in which will the placeholders will be replaced (if there are any). +//!\param _args The arguments that will replace the placeholders in the format string. The number of parameters in +//!_args has to be equal to the number of placeholders in the format string. If you pass too few or too many +//!arguments, the resulting string will contain diagnostics in the resulting string +//!([Missing parameter!] or [Superfluous parameter: x]). +//!\return String containing the complete formatted message. +template< typename ... args > +std::string sxprintf(const char* const _format, args ... _args) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _args ...); + return( target_string_stream.str() ); +} + +#else + +std::string sxprintf(const char* const _format); +std::string sxprintf(const char* const _format, const value_type& _value1); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9); +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9, const value_type& _value10); + + +void sxprintf(std::ostream& _os, const char* const _format); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9); +void sxprintf(std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10); + + void sxprintf(std::ostream& _os, const char* const _format, const value_types& _values); + +#endif + + +} + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/include/essentials/uri.hpp b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/uri.hpp new file mode 100644 index 0000000..0499a44 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/include/essentials/uri.hpp @@ -0,0 +1,55 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D +#define URI_72CBB6C3_57D9_443A_99F0_9EDE9A2BC07D + + +#include + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sxe +{ + + +const char URI_DELIMITER = '/'; + + +class uri SX_FINAL +{ +public: + explicit uri( const std::string& _uri = "" ); + ~uri() SX_NOEXCEPT; + bool is_empty() const; + const std::string to_string() const; + const std::string& get_front() const; + const std::string& get_back(); + void push_front( const std::string& _segment ); + void push_back( const std::string& _segment ); + void pop_front(); + void pop_back(); + size_t size() const; + + +private: + const std::string build_uri() const; + void split_string_to_uri_segments( const std::string& _uri ); + + + std::deque< std::string > uri_; +}; + + +} + + +#endif diff --git a/externals/hermes/source/externals/essentials/source/essentials/source/conversion.cpp b/externals/hermes/source/externals/essentials/source/essentials/source/conversion.cpp new file mode 100644 index 0000000..ed91544 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/source/conversion.cpp @@ -0,0 +1,103 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/conversion.hpp" + +#include +#include +#include + +#ifndef SX_CPP03_BOOST + #include +#else + #include +#endif + + +namespace sxe +{ + + +bool string_to_int( const char* const _int_as_string, int& _result ) +{ + bool success = false; + try + { +#ifndef SX_CPP03_BOOST + _result = std::stoi( std::string( _int_as_string ) ); + success = true; +#else + std::istringstream is( _int_as_string ); + if (is >> _result) + { + success = true; + } + else + { + success = false; + } +#endif + + } + catch ( const std::invalid_argument& ) + { + success = false; + } + catch ( const std::out_of_range& ) + { + success = false; + } + return( success ); +} + + +std::string to_string( const sxe::uint32_t _value ) +{ +#ifndef SX_CPP03_BOOST + return( std::to_string( _value ) ); +#else + std::ostringstream ostr; + ostr << _value; + return( ostr.str() ); +#endif +} + + +std::string to_string( const int _value ) +{ +#ifndef SX_CPP03_BOOST + return( std::to_string( _value ) ); +#else + std::ostringstream ostr; + ostr << _value; + return( ostr.str() ); +#endif +} + + +// cppcheck-suppress unusedFunction +std::string to_upper( const std::string& _value ) +{ + std::string value_caps = _value; + std::transform( value_caps.begin(), value_caps.end(), value_caps.begin(), static_cast< int( *)( int ) >( ::std::toupper ) ); + return( value_caps ); +} + + +// cppcheck-suppress unusedFunction +std::string to_lower( const std::string& _value ) +{ + std::string value_to_lower = _value; + std::transform( value_to_lower.begin(), value_to_lower.end(), value_to_lower.begin(), static_cast< int( *)( int ) >( ::std::tolower ) ); + return( value_to_lower ); +} + + +} diff --git a/externals/hermes/source/externals/essentials/source/essentials/source/essentials_version.cpp b/externals/hermes/source/externals/essentials/source/essentials/source/essentials_version.cpp new file mode 100644 index 0000000..7279071 --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/source/essentials_version.cpp @@ -0,0 +1,74 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "essentials/essentials_version.hpp" + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/build_number.hpp" +#include "essentials/sxprintf.hpp" + + +namespace sxe +{ + + +namespace version +{ + + +namespace +{ + + +const sxe::uint16_t VERSION_MAJOR( 1 ); +const sxe::uint16_t VERSION_MINOR( 3 ); +const sxe::uint16_t VERSION_PATCH( 2 ); + + +} + + +// cppcheck-suppress unusedFunction +void log_version() +{ + std::cout << sxe::sxprintf( "essentials library version %.%.%.%.", get_major_version(), + get_minor_version(), get_patch_version(), get_build_number() ) << std::endl; +} + + +sxe::uint16_t get_major_version() +{ + return( VERSION_MAJOR ); +} + + +sxe::uint16_t get_minor_version() +{ + return( VERSION_MINOR ); +} + + +sxe::uint16_t get_patch_version() +{ + return( VERSION_PATCH ); +} + + +sxe::uint16_t get_build_number() +{ + return( BUILD_NUMBER ); +} + + +} + + +} diff --git a/externals/hermes/source/externals/essentials/source/essentials/source/format_settings.cpp b/externals/hermes/source/externals/essentials/source/essentials/source/format_settings.cpp new file mode 100644 index 0000000..0417c8a --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/source/format_settings.cpp @@ -0,0 +1,32 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "essentials/format_settings.hpp" + + +namespace sxe +{ + + +format_settings::format_settings(): + format_string_(), + missing_closing_bracket_( false ), + correct_( false ), + hex_( false ), + pad_zeros_( false ), + places_set_( false ), + places_( 0 ), + decimal_places_set_( false ), + decimal_places_( 0 ) +{ + // Nothing to do... +} + + +} diff --git a/externals/hermes/source/externals/essentials/source/essentials/source/sxprintf.cpp b/externals/hermes/source/externals/essentials/source/essentials/source/sxprintf.cpp new file mode 100644 index 0000000..99844aa --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/source/sxprintf.cpp @@ -0,0 +1,628 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/sxprintf.hpp" + +#include + +#include "essentials/base.hpp" +#include "essentials/conversion.hpp" + + +namespace sxe +{ + + +namespace +{ + + + const char MISSING_PARAMETERS_MESSAGE[] = "[Missing parameter!]"; + const char MISSING_TERMINATOR[] = "[Missing output modifier terminator!]"; + const char ILLEGAL_MODIFIER[] = "[Illegal output modifier!]"; + const char POINT = '.'; + const char ZERO = '0'; + const char X = 'x'; + const char CAPS_X = 'X'; + + +} + + +const char PLACE_HOLDER = '%'; +const char* const SUPERFLUOUS_PARAMETER_START = "[Superfluous parameter: "; +const char SUPERFLUOUS_PARAMETER_END = ']'; +const char OPENING_SQUARE_BRACKET = '['; +const char CLOSING_SQUARE_BRACKET = ']'; + + +// cppcheck-suppress unusedFunction +std::ostream& operator<<( std::ostream& _os, const sxe::format_settings& _format ) +{ + if( !_format.correct_ ) + { + _os << ILLEGAL_MODIFIER; + } + else if( _format.missing_closing_bracket_ ) + { + _os << MISSING_TERMINATOR; + } + else + { + if( _format.hex_ ) + { + _os << std::hex; + _os << std::showbase; + _os.fill( '0' ); + } + else + { + if( _format.pad_zeros_ ) + { + _os.fill( '0' ); + } + + if( _format.places_set_ ) + { + _os.width( _format.places_ ); + } + + if( _format.decimal_places_set_ ) + { + _os.precision( _format.decimal_places_ ); + } + } + } + + return( _os ); +} + + +bool is_allowed_char( const char _char ) +{ + const bool success = ( std::isdigit( _char ) || ( X == _char ) || ( CAPS_X == _char ) ); + return( success ); +} + + +sxe::format_settings parse_format_string( const char** const _format ) +{ + sxe::format_settings format_settings; + format_settings.correct_ = true; + SX_ASSERT( ( OPENING_SQUARE_BRACKET == **_format ), "Format string to parse doesn't start with [." ); + ++*_format; + format_settings.missing_closing_bracket_ = true; + bool point_found = false; + const char* text_before_point = *_format; + std::size_t text_before_point_size = 0; + const char* text_after_point = SX_NULLPTR; + std::size_t text_after_point_size = 0; + while( **_format ) + { + if( CLOSING_SQUARE_BRACKET == **_format ) + { + format_settings.missing_closing_bracket_ = false; + break; + } + else + if( POINT == **_format ) + { + if( point_found ) + { + format_settings.correct_ = false; + break; + } + else + { + point_found = true; + text_after_point = ( *_format ) + 1; + text_after_point_size = 0; + } + } + else + { + const char _text_char = **_format; + if( is_allowed_char( _text_char ) ) + { + if( point_found ) + { + ++text_after_point_size; + } + else + { + ++text_before_point_size; + } + } + else + { + format_settings.correct_ = false; + break; + } + } + + ++( *_format ); + } + + SX_ASSERT( text_before_point, "Logic error parsing format string!" ); + if( ( 0 == text_before_point_size ) && ( 0 == text_after_point_size ) ) + { + format_settings.correct_ = false; + } + + if( ( !format_settings.missing_closing_bracket_ ) && format_settings.correct_ ) + { + if( ( 0 < text_before_point_size ) && ( ( X == text_before_point[ 0 ] ) || ( CAPS_X == text_before_point[ 0 ] ) ) ) + { + format_settings.hex_ = true; + ++text_before_point; + --text_before_point_size; + } + + if( ( 0 < text_before_point_size ) && ( ZERO == text_before_point[ 0 ] ) ) + { + format_settings.pad_zeros_ = true; + ++text_before_point; + --text_before_point_size; + } + + if( 0 < text_before_point_size ) + { + format_settings.places_set_ = true; + if( !string_to_int( text_before_point, format_settings.places_ ) ) + { + format_settings.correct_ = false; + } + } + + if( 0 < text_after_point_size ) + { + SX_ASSERT( text_after_point, "Logic error parsing format string!" ); + format_settings.decimal_places_set_ = true; + if( !string_to_int( text_after_point, format_settings.decimal_places_ ) ) + { + format_settings.correct_ = false; + } + } + } + + return( format_settings ); +} + + +#ifdef SX_CPP03_BOOST + + +void print_superfluous_parameters( std::ostream& _os, const value_types& _values, value_types::const_iterator& _position ) +{ + while( _position != _values.end() ) + { + print_superfluous_parameters( _os, *_position ); + ++_position; + } +} + + +#endif + + +void sxprintf( std::ostream& _os, const char* _format ) +{ + while( *_format ) + { + if( PLACE_HOLDER == *_format ) + { + if( PLACE_HOLDER == *( _format + 1 ) ) + { + ++_format; + } + else + { + _os << MISSING_PARAMETERS_MESSAGE; + } + } + _os << *_format++; + } +} + + +#ifdef SX_CPP03_BOOST + + +std::string sxprintf(const char* const _format) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9); + return( target_string_stream.str() ); +} + + +std::string sxprintf(const char* const _format, const value_type& _value1, const value_type& _value2, const value_type& _value3, + const value_type& _value4, const value_type& _value5, const value_type& _value6, const value_type& _value7, const value_type& _value8, + const value_type& _value9, const value_type& _value10) +{ + std::stringstream target_string_stream; + sxprintf(target_string_stream, _format, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10); + return( target_string_stream.str() ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1 ) +{ + value_types values; + values.push_back( _value1 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + values.push_back( _value9 ); + sxprintf( _os, _format, values ); +} + + +void sxprintf( std::ostream& _os, const char* const _format, const value_type& _value1, const value_type& _value2, + const value_type& _value3, const value_type& _value4, const value_type& _value5, const value_type& _value6, + const value_type& _value7, const value_type& _value8, const value_type& _value9, const value_type& _value10 ) +{ + value_types values; + values.push_back( _value1 ); + values.push_back( _value2 ); + values.push_back( _value3 ); + values.push_back( _value4 ); + values.push_back( _value5 ); + values.push_back( _value6 ); + values.push_back( _value7 ); + values.push_back( _value8 ); + values.push_back( _value9 ); + values.push_back( _value10 ); + sxprintf( _os, _format, values ); +} + + +const char* sxprintf_impl( std::ostream& _os, const char* _format, value_types::const_iterator& _position, + const value_types::const_iterator _end, bool& printed ) +{ + while (*_format) + { + if (PLACE_HOLDER == *_format) + { + if (PLACE_HOLDER == *( _format + 1 )) + { + ++_format; // skip first place holder + _os << *_format++; // output of the second place holder + } + else + { + if (OPENING_SQUARE_BRACKET == *( _format + 1 )) + { + ++_format; + const sxe::format_settings format_settings = sxe::parse_format_string(&_format); + const std::ios_base::fmtflags stream_flags = _os.flags(); + const char streafill_ = _os.fill(); + _os << format_settings; + print_value_type_value( _os, *_position ); + _os.flags(stream_flags); + _os.fill(streafill_); + printed = true; + if( !format_settings.missing_closing_bracket_ ) + { + if( CLOSING_SQUARE_BRACKET == *( _format ) ) + { + ++_format; + } + } + else + { + if( !format_settings.correct_ ) + { + ++_format; + } + } + } + else + { + print_value_type_value( _os, *_position ); + printed = true; + ++_format; + break; + } + + if( _position + 1 != _end ) + { + if( *_format != '\0' ) + { + ++_position; + _format = sxprintf_impl( _os, _format, _position, _end, printed ); + } + } + return( _format ); + } + } + else + { + _os << *_format++; + } + } + return ( _format ); +} + + +void sxprintf( std::ostream& _os, const char * const _format, const value_types& _values ) +{ + SX_ASSERT( _format, "No format string to parse was passed!" ); + const char* current_position = _format; + + value_types::const_iterator _end = _values.end(); + value_types::const_iterator _position = _values.begin(); + while( _position != _end ) + { + bool printed = false; + current_position = sxprintf_impl( _os, current_position, _position, _end, printed ); + if( printed ) + { + ++_position; + } + if( current_position[0] == '\0' ) + { + break; + } + } + + sxprintf( _os, current_position ); + + if( _position != _end ) + { + print_superfluous_parameters( _os, _values, _position ); + } +} + + +void print_value_type_value( std::ostream& _os, const value_type& _value ) +{ + const std::type_info& type_info = _value.type(); + + if( type_info == typeid ( bool ) ) + { + stream_writer< bool >::print( _os, boost::get< bool >( _value ) ); + } + else if( type_info == typeid ( int ) ) + { + stream_writer< int >::print( _os, boost::get< int >( _value ) ); + } + else if( type_info == typeid ( unsigned int ) ) + { + stream_writer< unsigned int >::print( _os, boost::get< unsigned int >( _value ) ); + } + else if( type_info == typeid ( sxe::int8_t ) ) + { + stream_writer< sxe::int8_t >::print( _os, boost::get< sxe::int8_t >( _value ) ); + } + else if (type_info == typeid ( sxe::uint8_t )) + { + stream_writer< sxe::uint8_t >::print(_os, boost::get< sxe::uint8_t >(_value)); + } + else if( type_info == typeid ( sxe::uint16_t ) ) + { + stream_writer< sxe::uint16_t >::print( _os, boost::get< sxe::uint16_t >( _value ) ); + } + else if( type_info == typeid ( sxe::uint32_t ) ) + { + stream_writer< sxe::uint32_t >::print( _os, boost::get< sxe::uint32_t >( _value ) ); + } + else if( type_info == typeid ( std::string ) ) + { + stream_writer< std::string >::print( _os, boost::get< std::string >( _value ) ); + } + else if( type_info == typeid ( std::size_t ) ) + { + stream_writer< std::size_t >::print( _os, boost::get< std::size_t >( _value ) ); + } + else if( type_info == typeid ( const char* ) ) + { + stream_writer< const char* >::print( _os, boost::get< const char* >( _value ) ); + } + else if( type_info == typeid ( boost::int_least64_t ) ) + { + stream_writer< boost::int_least64_t >::print( _os, boost::get< boost::int_least64_t >( _value ) ); + } + else if( type_info == typeid ( double ) ) + { + stream_writer< double >::print( _os, boost::get< double >( _value ) ); + } +} + + +#endif + + +} diff --git a/externals/hermes/source/externals/essentials/source/essentials/source/uri.cpp b/externals/hermes/source/externals/essentials/source/essentials/source/uri.cpp new file mode 100644 index 0000000..1460efb --- /dev/null +++ b/externals/hermes/source/externals/essentials/source/essentials/source/uri.cpp @@ -0,0 +1,136 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex essentials library (http://essentials.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://essentials.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "essentials/uri.hpp" + +#include +#include + +#include "essentials/base.hpp" + + +namespace sxe +{ + + +uri::uri( const std::string& _uri ) + : uri_() +{ + split_string_to_uri_segments( _uri ); +} + + +uri::~uri() SX_NOEXCEPT +{ + // Nothing to do... +} + + +bool uri::is_empty() const +{ + return( uri_.empty() ); +} + + +const std::string uri::to_string() const +{ + return( build_uri() ); +} + + +const std::string& uri::get_front() const +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + return( uri_.front() ); +} + + +const std::string& uri::get_back() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + return( uri_.back() ); +} + + +void uri::push_front( const std::string& _segment ) +{ + uri_.push_front( _segment ); +} + + +void uri::push_back( const std::string& _segment ) +{ + uri_.push_back( _segment ); +} + + +void uri::pop_front() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + uri_.pop_front(); +} + + +void uri::pop_back() +{ + SX_ASSERT( !uri_.empty(), "Uri is empty!" ); + uri_.pop_back(); +} + + +size_t uri::size() const +{ + return( uri_.size() ); +} + + +const std::string uri::build_uri() const +{ + std::stringstream uri; + + SX_FOR( const std::string& uri_element, uri_ ) + { + uri << URI_DELIMITER << uri_element; + } + + return( uri.str() ); +} + + +void uri::split_string_to_uri_segments( const std::string& _uri ) +{ + std::string uri = _uri; + if( !_uri.empty() ) + { + if( URI_DELIMITER == _uri[ 0 ] ) + { + uri = _uri.substr( 1 ); + } + + std::string::size_type start = 0; + std::string::size_type end = uri.find( URI_DELIMITER ); + while( end != std::string::npos ) + { + const std::string& segment = uri.substr( start, end - start ); + uri_.push_back( segment ); + start = ++end; + end = uri.find( URI_DELIMITER, end ); + } + + const std::string& last_segment = uri.substr( start ); + if( last_segment[ 0 ] != URI_DELIMITER ) + { + uri_.push_back( last_segment ); + } + } +} + + +} diff --git a/externals/hermes/source/hermes.sln b/externals/hermes/source/hermes.sln new file mode 100644 index 0000000..223e332 --- /dev/null +++ b/externals/hermes/source/hermes.sln @@ -0,0 +1,109 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27004.2009 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hermes", "hermes\hermes.vcxproj", "{392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}" + ProjectSection(ProjectDependencies) = postProject + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{4A4EEC79-D055-4331-B446-D8A58CC659D5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials", "externals\essentials\source\essentials\essentials.vcxproj", "{132F81F8-46DA-49D0-9071-D70BC087B38C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build_tools", "build_tools", "{FE101D23-F70F-4393-A1AB-0BAF06E53A5A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CMake", "CMake", "{C0BCEDFB-2D5B-4E91-92C1-1B577B58FB38}" + ProjectSection(SolutionItems) = preProject + CMakeLists.txt = CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{3A9DA4AB-5D0F-41F6-BDDC-6847B99F209A}" + ProjectSection(SolutionItems) = preProject + CMakeLists.txt = CMakeLists.txt + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hermes", "hermes", "{E3E33A7D-DB29-4F8A-BB90-37B506136EBD}" + ProjectSection(SolutionItems) = preProject + hermes\CMakeLists.txt = hermes\CMakeLists.txt + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - C++ 03|x64 = Debug - C++ 03|x64 + Debug - C++ 03|x86 = Debug - C++ 03|x86 + Debug - VS 2015|x64 = Debug - VS 2015|x64 + Debug - VS 2015|x86 = Debug - VS 2015|x86 + Debug - VS 2017|x64 = Debug - VS 2017|x64 + Debug - VS 2017|x86 = Debug - VS 2017|x86 + Release - C++ 03|x64 = Release - C++ 03|x64 + Release - C++ 03|x86 = Release - C++ 03|x86 + Release - VS 2015|x64 = Release - VS 2015|x64 + Release - VS 2015|x86 = Release - VS 2015|x86 + Release - VS 2017|x64 = Release - VS 2017|x64 + Release - VS 2017|x86 = Release - VS 2017|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x86.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x86.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x86.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x86.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x86.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x86.Build.0 = Release - VS 2017|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {4A4EEC79-D055-4331-B446-D8A58CC659D5} + {C0BCEDFB-2D5B-4E91-92C1-1B577B58FB38} = {FE101D23-F70F-4393-A1AB-0BAF06E53A5A} + {3A9DA4AB-5D0F-41F6-BDDC-6847B99F209A} = {C0BCEDFB-2D5B-4E91-92C1-1B577B58FB38} + {E3E33A7D-DB29-4F8A-BB90-37B506136EBD} = {3A9DA4AB-5D0F-41F6-BDDC-6847B99F209A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DADC4E4C-C2F5-414A-9C22-D455C46495D0} + EndGlobalSection +EndGlobal diff --git a/externals/hermes/source/hermes/CMakeLists.txt b/externals/hermes/source/hermes/CMakeLists.txt new file mode 100644 index 0000000..8cbf683 --- /dev/null +++ b/externals/hermes/source/hermes/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 2.8) + +project(hermes) + +set(CMAKE_VERBOSE_MAKEFILE, 1) + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + +file(GLOB hermes_SRC "./include/hermes/*.hpp" "./source/*.cpp") + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +include(./../CMakeHelpers/addSpecificFlags.cmake) +include(./../CMakeHelpers/addSeadexOptions.cmake) + +include_directories("./include") +include_directories("./../externals/essentials/source/essentials/include") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") + +set(link_libraries_list "") + +if("${CPP_VERSION}" STREQUAL "03") + use_boost_libraries(link_libraries_list) +endif() + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library_for_linking(link_libraries_list libessentials) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library_for_linking(link_libraries_list essentials) +endif() + +message(STATUS "hermes linking to libraries: ${link_libraries_list}" ) + + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library(libhermes ${LINK_TYPE} ${hermes_SRC}) + target_link_libraries(libhermes LINK_PUBLIC ${link_libraries_list}) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library(hermes STATIC ${hermes_SRC}) + target_link_libraries(hermes LINK_PUBLIC ${link_libraries_list}) +endif() + +file(GLOB hermes_hpp "./include/*.hpp") +install(FILES ${hermes_hpp} DESTINATION include/hermes/include) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + install(TARGETS libhermes DESTINATION lib) + set_target_properties(libhermes PROPERTIES PREFIX "") +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + install(TARGETS hermes DESTINATION lib) + set_target_properties(hermes PROPERTIES PREFIX "") +endif() diff --git a/externals/hermes/source/hermes/hermes.vcxproj b/externals/hermes/source/hermes/hermes.vcxproj new file mode 100644 index 0000000..9cf6406 --- /dev/null +++ b/externals/hermes/source/hermes/hermes.vcxproj @@ -0,0 +1,566 @@ + + + + + Debug - C++ 03 + Win32 + + + Debug - C++ 03 + x64 + + + Debug - Clang + Win32 + + + Debug - Clang + x64 + + + Debug - VS 2013 + Win32 + + + Debug - VS 2013 + x64 + + + Debug - VS 2015 + Win32 + + + Debug - VS 2015 + x64 + + + Debug - VS 2017 + Win32 + + + Release - C++ 03 + Win32 + + + Release - C++ 03 + x64 + + + Release - Clang + Win32 + + + Release - Clang + x64 + + + Release - VS 2015 + Win32 + + + Release - VS 2015 + x64 + + + Release - VS 2017 + Win32 + + + Debug - VS 2017 + x64 + + + Release - VS 2017 + x64 + + + + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} + hermes + 8.1 + + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + true + v141_clang_c2 + MultiByte + + + StaticLibrary + true + v140 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + true + v120 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + false + v141_clang_c2 + true + MultiByte + + + StaticLibrary + false + v140 + true + MultiByte + + + StaticLibrary + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + Disabled + true + + + true + + + + + MaxSpeed + true + true + true + + + true + true + true + + + + + MaxSpeed + true + true + true + + + true + true + true + + + + + MaxSpeed + true + true + true + + + true + true + true + + + + + MaxSpeed + true + true + true + + + true + true + true + + + + + MaxSpeed + true + true + true + + + true + true + true + MachineX64 + + + + + MaxSpeed + true + true + true + + + true + true + true + MachineX64 + + + + + MaxSpeed + true + true + true + + + true + true + true + MachineX64 + + + + + MaxSpeed + true + true + true + + + true + true + true + MachineX64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/externals/hermes/source/hermes/hermes.vcxproj.filters b/externals/hermes/source/hermes/hermes.vcxproj.filters new file mode 100644 index 0000000..f4db087 --- /dev/null +++ b/externals/hermes/source/hermes/hermes.vcxproj.filters @@ -0,0 +1,146 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d2e47838-b932-42ce-a439-fff0ae19104b} + + + {31402a15-9737-4135-87ad-db03f0f6d7a2} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + licenses\hermes + + + licenses\hermes + + + licenses\hermes + + + licenses\hermes + + + licenses\hermes + + + \ No newline at end of file diff --git a/externals/hermes/include/hermes/build_number.hpp b/externals/hermes/source/hermes/include/hermes/build_number.hpp similarity index 93% rename from externals/hermes/include/hermes/build_number.hpp rename to externals/hermes/source/hermes/include/hermes/build_number.hpp index 61892f9..abc516c 100644 --- a/externals/hermes/include/hermes/build_number.hpp +++ b/externals/hermes/source/hermes/include/hermes/build_number.hpp @@ -1,35 +1,35 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef BUILD_NUMBER_D6FF600D_5F67_43E8_A8CD_7BEE789F3AD4 -#define BUILD_NUMBER_D6FF600D_5F67_43E8_A8CD_7BEE789F3AD4 - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -namespace version -{ - - - const sxe::uint16_t BUILD_NUMBER( 66 ); - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef BUILD_NUMBER_D6FF600D_5F67_43E8_A8CD_7BEE789F3AD4 +#define BUILD_NUMBER_D6FF600D_5F67_43E8_A8CD_7BEE789F3AD4 + + +#include "essentials/compatibility/compatibility.hpp" + + +namespace hermes +{ + + +namespace version +{ + + + const sxe::uint16_t BUILD_NUMBER( 101 ); + + +} + + +} + + +#endif diff --git a/externals/hermes/include/hermes/color.hpp b/externals/hermes/source/hermes/include/hermes/color.hpp similarity index 96% rename from externals/hermes/include/hermes/color.hpp rename to externals/hermes/source/hermes/include/hermes/color.hpp index 085e25b..7869745 100644 --- a/externals/hermes/include/hermes/color.hpp +++ b/externals/hermes/source/hermes/include/hermes/color.hpp @@ -1,95 +1,95 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef COLOR_63B5B1DB_D383_404D_93EF_AB2BC3A0D286 -#define COLOR_63B5B1DB_D383_404D_93EF_AB2BC3A0D286 - -#include "hermes_backward_compatibility.hpp" - -#ifndef SX_NO_LOGGING - -namespace hermes -{ - - -#ifndef SX_CPP03_BOOST - - - //!\enum color - //!\brief Enumeration for predefined colors. - enum class color - { - C_BLACK = 0, C_WHITE = 15, C_DARK_WHITE = 7, C_BLUE = 9, C_DARK_BLUE = 1, C_GREEN = 10, C_DARK_GREEN = 2, C_RED = 12, - C_DARK_RED = 4, C_YELLOW = 14, C_DARK_YELLOW = 6, C_AQUA = 3, C_GRAY = 8, C_MAGENTA = 13, C_CYAN = 11 - }; - - -#else - - - //!\struct color - //!\brief Structure representing a predefined color (enum wrapper for C++11 enum class like behavior). - struct color - { - //!\enum color - //!\brief Enumeration for predefined colors. - enum inner - { - C_BLACK = 0, C_WHITE = 15, C_DARK_WHITE = 7, C_BLUE = 9, C_DARK_BLUE = 1, C_GREEN = 10, C_DARK_GREEN = 2, C_RED = 12, - C_DARK_RED = 4, C_YELLOW = 14, C_DARK_YELLOW = 6, C_AQUA = 3, C_GRAY = 8, C_MAGENTA = 13, C_CYAN = 11 - }; - - - //!\brief Constructor. Default value is white. - color() : value_( C_WHITE ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _value Given color value that is represented by the structure. - color( const inner _value ) : value_( _value ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _color Given color structure containing the color that is represented by the structure. - color( const color& _color ) : value_( _color.value_ ) - { - // Nothing to do... - } - - - //!\brief Get the color value represented by the structure. - operator inner() const - { - return ( value_ ); - } - - - //!\brief Color represented by the structure. - inner value_; - - }; - - -#endif - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef COLOR_63B5B1DB_D383_404D_93EF_AB2BC3A0D286 +#define COLOR_63B5B1DB_D383_404D_93EF_AB2BC3A0D286 + +#include "hermes_backward_compatibility.hpp" + +#ifndef SX_NO_LOGGING + +namespace hermes +{ + + +#ifndef SX_CPP03_BOOST + + + //!\enum color + //!\brief Enumeration for predefined colors. + enum class color + { + C_BLACK = 0, C_WHITE = 15, C_DARK_WHITE = 7, C_BLUE = 9, C_DARK_BLUE = 1, C_GREEN = 10, C_DARK_GREEN = 2, C_RED = 12, + C_DARK_RED = 4, C_YELLOW = 14, C_DARK_YELLOW = 6, C_AQUA = 3, C_GRAY = 8, C_MAGENTA = 13, C_CYAN = 11 + }; + + +#else + + + //!\struct color + //!\brief Structure representing a predefined color (enum wrapper for C++11 enum class like behavior). + struct color + { + //!\enum color + //!\brief Enumeration for predefined colors. + enum inner + { + C_BLACK = 0, C_WHITE = 15, C_DARK_WHITE = 7, C_BLUE = 9, C_DARK_BLUE = 1, C_GREEN = 10, C_DARK_GREEN = 2, C_RED = 12, + C_DARK_RED = 4, C_YELLOW = 14, C_DARK_YELLOW = 6, C_AQUA = 3, C_GRAY = 8, C_MAGENTA = 13, C_CYAN = 11 + }; + + + //!\brief Constructor. Default value is white. + color() : value_( C_WHITE ) + { + // Nothing to do... + } + + + //!\brief Constructor + //!\param _value Given color value that is represented by the structure. + color( const inner _value ) : value_( _value ) + { + // Nothing to do... + } + + + //!\brief Constructor + //!\param _color Given color structure containing the color that is represented by the structure. + color( const color& _color ) : value_( _color.value_ ) + { + // Nothing to do... + } + + + //!\brief Get the color value represented by the structure. + operator inner() const + { + return ( value_ ); + } + + + //!\brief Color represented by the structure. + inner value_; + + }; + + +#endif + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/color_mapping.hpp b/externals/hermes/source/hermes/include/hermes/color_mapping.hpp similarity index 96% rename from externals/hermes/include/hermes/color_mapping.hpp rename to externals/hermes/source/hermes/include/hermes/color_mapping.hpp index 12cd0eb..ba0c9a3 100644 --- a/externals/hermes/include/hermes/color_mapping.hpp +++ b/externals/hermes/source/hermes/include/hermes/color_mapping.hpp @@ -1,62 +1,62 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef COLOR_MAPPING_A8F877D1_966B_463B_AE26_BD54CB2FEC35 -#define COLOR_MAPPING_A8F877D1_966B_463B_AE26_BD54CB2FEC35 - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include - -#include "essentials/non_copyable.hpp" -#include "color.hpp" -#include "log_level.hpp" - - -namespace hermes -{ - - -//!\class color_mapping -//!\brief Class for mapping colors to log levels. -class color_mapping SX_FINAL -{ -public: - //!\typedef color_map - //!\brief Alias for the map of log levels to colors. - typedef std::map< log_level, color > color_map; - - //!\brief Constructor. - color_mapping(); - ~color_mapping() SX_NOEXCEPT; - SX_NO_COPY(color_mapping) - - //!\brief Method for getting the color associated with the given log level. - //!\param _log_level The log level for which the color is requested. - //!\return Color value associated with the given log level. - color get_color( const log_level _log_level ) const; - - -private: - color_map color_map_; -}; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef COLOR_MAPPING_A8F877D1_966B_463B_AE26_BD54CB2FEC35 +#define COLOR_MAPPING_A8F877D1_966B_463B_AE26_BD54CB2FEC35 + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include + +#include "essentials/non_copyable.hpp" +#include "color.hpp" +#include "log_level.hpp" + + +namespace hermes +{ + + +//!\class color_mapping +//!\brief Class for mapping colors to log levels. +class color_mapping SX_FINAL +{ +public: + //!\typedef color_map + //!\brief Alias for the map of log levels to colors. + typedef std::map< log_level, color > color_map; + + //!\brief Constructor. + color_mapping(); + ~color_mapping() SX_NOEXCEPT; + SX_NO_COPY(color_mapping) + + //!\brief Method for getting the color associated with the given log level. + //!\param _log_level The log level for which the color is requested. + //!\return Color value associated with the given log level. + color get_color( const log_level _log_level ) const; + + +private: + color_map color_map_; +}; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/cout_logger.hpp b/externals/hermes/source/hermes/include/hermes/cout_logger.hpp similarity index 96% rename from externals/hermes/include/hermes/cout_logger.hpp rename to externals/hermes/source/hermes/include/hermes/cout_logger.hpp index cd6d111..1355a3b 100644 --- a/externals/hermes/include/hermes/cout_logger.hpp +++ b/externals/hermes/source/hermes/include/hermes/cout_logger.hpp @@ -1,63 +1,63 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef COUT_LOGGER_170B8470_DB09_43CF_A547_D6C928D5121F -#define COUT_LOGGER_170B8470_DB09_43CF_A547_D6C928D5121F - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include "logger.hpp" -#include "color_mapping.hpp" - - -namespace hermes -{ - - -//!\class cout_logger -//!\brief Class for printing messages in the console via cout. -class cout_logger: - public logger -{ -public: - //!\brief Constructor - cout_logger(); - virtual ~cout_logger() SX_NOEXCEPT SX_OVERRIDE - { - // Nothing to do... - } - - - SX_NO_COPY(cout_logger) - - //!\brief Prints the message. - //!\param _log_message Log message that will be printed. - //!\return void - virtual void log( const log_message& _log_message ) SX_OVERRIDE; - - -private: - void log_level_as_message( const hermes::log_level _log_level ) const; - - color_mapping color_mapping_; -}; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef COUT_LOGGER_170B8470_DB09_43CF_A547_D6C928D5121F +#define COUT_LOGGER_170B8470_DB09_43CF_A547_D6C928D5121F + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include "logger.hpp" +#include "color_mapping.hpp" + + +namespace hermes +{ + + +//!\class cout_logger +//!\brief Class for printing messages in the console via cout. +class cout_logger: + public logger +{ +public: + //!\brief Constructor + cout_logger(); + virtual ~cout_logger() SX_NOEXCEPT SX_OVERRIDE + { + // Nothing to do... + } + + + SX_NO_COPY(cout_logger) + + //!\brief Prints the message. + //!\param _log_message Log message that will be printed. + //!\return void + virtual void log( const log_message& _log_message ) SX_OVERRIDE; + + +private: + void log_level_as_message( const hermes::log_level _log_level ) const; + + color_mapping color_mapping_; +}; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/file_logger.hpp b/externals/hermes/source/hermes/include/hermes/file_logger.hpp similarity index 97% rename from externals/hermes/include/hermes/file_logger.hpp rename to externals/hermes/source/hermes/include/hermes/file_logger.hpp index f563a9c..145e6df 100644 --- a/externals/hermes/include/hermes/file_logger.hpp +++ b/externals/hermes/source/hermes/include/hermes/file_logger.hpp @@ -1,84 +1,84 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef FILE_LOGGER_0EE18DBE_D91D_407D_BF95_0EBC8A84EBD4 -#define FILE_LOGGER_0EE18DBE_D91D_407D_BF95_0EBC8A84EBD4 - - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include "logger.hpp" -#include "essentials/exception_template.hpp" - - -namespace hermes -{ - - -//!\class file_logger -//!\brief Class for writing messages to a log file. It rotates the log file if a certain size limit is met. Naming and -//!location of the log files can be customized. Also the number of log files in rotation can be set. -class file_logger: - public logger -{ -public: - //!\brief Exception class of the file_logger. - SX_EXCEPTION( exception ) - - //!\brief Constructor - //!\param _max_file_size_in_bytes Maximum size of a log file in bytes. - //!\param _log_files_directory Folder where the log files are stored. - //!\param _name_suffix The suffix for the log files. - //!\param _name_extension The extension of the log files. - //!\param _max_file_number The maximum number of log files. - //!\param _throw_on_error Flag for throwing an exception on error. Default is true. - explicit file_logger( const size_t _max_file_size_in_bytes, const std::string& _log_files_directory, - const std::string& _name_suffix, const std::string& _name_extension, const unsigned _max_file_number, - const bool _throw_on_error = true ); - virtual ~file_logger() SX_NOEXCEPT SX_OVERRIDE; - SX_NO_COPY(file_logger) - - //!\brief Writes the message. - //!\param _log_message Log message that will be written. - //!\return void - virtual void log( const log_message& _log_message ) SX_OVERRIDE; - - -private: - std::string get_log_file_name_with_index( const unsigned _index ) const; - std::string get_working_log_file_name() const; - void log_into_file( const std::string& _message ) const; - void rotate_if_necessary() const; - void rename_files() const; - void rename_file_if_exists( const std::string& _old_name, const std::string& _new_name ) const; - void delete_file( const std::string& _file_name ) const; - - - const size_t max_file_size_in_bytes_; - const std::string log_files_directory_; - const std::string name_sufix_; - const std::string name_extension_; - const unsigned max_file_number_; - const bool throw_on_error_; - std::string working_file_; -}; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef FILE_LOGGER_0EE18DBE_D91D_407D_BF95_0EBC8A84EBD4 +#define FILE_LOGGER_0EE18DBE_D91D_407D_BF95_0EBC8A84EBD4 + + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include "logger.hpp" +#include "essentials/exception_template.hpp" + + +namespace hermes +{ + + +//!\class file_logger +//!\brief Class for writing messages to a log file. It rotates the log file if a certain size limit is met. Naming and +//!location of the log files can be customized. Also the number of log files in rotation can be set. +class file_logger: + public logger +{ +public: + //!\brief Exception class of the file_logger. + SX_EXCEPTION( exception ) + + //!\brief Constructor + //!\param _max_file_size_in_bytes Maximum size of a log file in bytes. + //!\param _log_files_directory Folder where the log files are stored. + //!\param _name_suffix The suffix for the log files. + //!\param _name_extension The extension of the log files. + //!\param _max_file_number The maximum number of log files. + //!\param _throw_on_error Flag for throwing an exception on error. Default is true. + explicit file_logger( const size_t _max_file_size_in_bytes, const std::string& _log_files_directory, + const std::string& _name_suffix, const std::string& _name_extension, const unsigned _max_file_number, + const bool _throw_on_error = true ); + virtual ~file_logger() SX_NOEXCEPT SX_OVERRIDE; + SX_NO_COPY(file_logger) + + //!\brief Writes the message. + //!\param _log_message Log message that will be written. + //!\return void + virtual void log( const log_message& _log_message ) SX_OVERRIDE; + + +private: + std::string get_log_file_name_with_index( const unsigned _index ) const; + std::string get_working_log_file_name() const; + void log_into_file( const std::string& _message ) const; + void rotate_if_necessary() const; + void rename_files() const; + void rename_file_if_exists( const std::string& _old_name, const std::string& _new_name ) const; + void delete_file( const std::string& _file_name ) const; + + + const size_t max_file_size_in_bytes_; + const std::string log_files_directory_; + const std::string name_sufix_; + const std::string name_extension_; + const unsigned max_file_number_; + const bool throw_on_error_; + std::string working_file_; +}; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/file_system.hpp b/externals/hermes/source/hermes/include/hermes/file_system.hpp similarity index 97% rename from externals/hermes/include/hermes/file_system.hpp rename to externals/hermes/source/hermes/include/hermes/file_system.hpp index 2ec9753..3b4dd1e 100644 --- a/externals/hermes/include/hermes/file_system.hpp +++ b/externals/hermes/source/hermes/include/hermes/file_system.hpp @@ -1,45 +1,45 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef FILE_SYSTEM_E5395B2B_BD8A_46B9_831A_B9A24E8CEDC2 -#define FILE_SYSTEM_E5395B2B_BD8A_46B9_831A_B9A24E8CEDC2 - - -#include -#include - - -namespace hermes -{ - - -//!\fn get_file_size -//!\brief Get the size of the file with the given name. -//!\param _file_name Name of file for which the size is requested. -//!\return Size of the given file. -size_t get_file_size( const std::string& _file_name ); - -//!\fn does_file_exist -//!\brief Checks if the file with the given name exists. -//!\param _file_name Name of the file to be checked. -//!\return True if the given file exists, false otherwise. -bool does_file_exist( const std::string& _file_name ); - -//!\fn add_trailing_slash_to_directory_path -//!\brief Add trailing slash to the given path. -//!\param _path Path to which the trailing slash is added. -//!\return Path with trailing slash at the end. -std::string add_trailing_slash_to_directory_path( const std::string& _path ); - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef FILE_SYSTEM_E5395B2B_BD8A_46B9_831A_B9A24E8CEDC2 +#define FILE_SYSTEM_E5395B2B_BD8A_46B9_831A_B9A24E8CEDC2 + + +#include +#include + + +namespace hermes +{ + + +//!\fn get_file_size +//!\brief Get the size of the file with the given name. +//!\param _file_name Name of file for which the size is requested. +//!\return Size of the given file. +size_t get_file_size( const std::string& _file_name ); + +//!\fn does_file_exist +//!\brief Checks if the file with the given name exists. +//!\param _file_name Name of the file to be checked. +//!\return True if the given file exists, false otherwise. +bool does_file_exist( const std::string& _file_name ); + +//!\fn add_trailing_slash_to_directory_path +//!\brief Add trailing slash to the given path. +//!\param _path Path to which the trailing slash is added. +//!\return Path with trailing slash at the end. +std::string add_trailing_slash_to_directory_path( const std::string& _path ); + + +} + + +#endif diff --git a/externals/hermes/include/hermes/globals.hpp b/externals/hermes/source/hermes/include/hermes/globals.hpp similarity index 97% rename from externals/hermes/include/hermes/globals.hpp rename to externals/hermes/source/hermes/include/hermes/globals.hpp index 74ac1d4..3cb71a6 100644 --- a/externals/hermes/include/hermes/globals.hpp +++ b/externals/hermes/source/hermes/include/hermes/globals.hpp @@ -1,26 +1,26 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef GLOBALS_A818BE8A_F8B8_44CA_9596_D6F248E8A175 -#define GLOBALS_A818BE8A_F8B8_44CA_9596_D6F248E8A175 - - -namespace hermes -{ - - -//!\brief Constant for width of the log level block. The log level block has a fixed width for better readability. -extern const int LOG_LEVEL_BLOCK_WIDTH; - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef GLOBALS_A818BE8A_F8B8_44CA_9596_D6F248E8A175 +#define GLOBALS_A818BE8A_F8B8_44CA_9596_D6F248E8A175 + + +namespace hermes +{ + + +//!\brief Constant for width of the log level block. The log level block has a fixed width for better readability. +extern const int LOG_LEVEL_BLOCK_WIDTH; + + +} + + +#endif diff --git a/externals/hermes/include/hermes/hermes_backward_compatibility.hpp b/externals/hermes/source/hermes/include/hermes/hermes_backward_compatibility.hpp similarity index 97% rename from externals/hermes/include/hermes/hermes_backward_compatibility.hpp rename to externals/hermes/source/hermes/include/hermes/hermes_backward_compatibility.hpp index 7780cd7..6fe7c84 100644 --- a/externals/hermes/include/hermes/hermes_backward_compatibility.hpp +++ b/externals/hermes/source/hermes/include/hermes/hermes_backward_compatibility.hpp @@ -1,29 +1,29 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef HERMES_BACKWARD_COMPATIBILITY_0C85D23F_60F8_43E6_A0AE_ABB9F0365630 -#define HERMES_BACKWARD_COMPATIBILITY_0C85D23F_60F8_43E6_A0AE_ABB9F0365630 - - -#ifdef Y_NO_LOGGING -#define SX_NO_LOGGING -#endif - - -#ifdef Y_NO_WINDOWS_H -#define SX_NO_WINDOWS_H -#endif - - -#define Y_LOG SX_LOG -#define Y_LOG_HEX SX_LOG_HEX - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef HERMES_BACKWARD_COMPATIBILITY_0C85D23F_60F8_43E6_A0AE_ABB9F0365630 +#define HERMES_BACKWARD_COMPATIBILITY_0C85D23F_60F8_43E6_A0AE_ABB9F0365630 + + +#ifdef Y_NO_LOGGING +#define SX_NO_LOGGING +#endif + + +#ifdef Y_NO_WINDOWS_H +#define SX_NO_WINDOWS_H +#endif + + +#define Y_LOG SX_LOG +#define Y_LOG_HEX SX_LOG_HEX + + +#endif diff --git a/externals/hermes/include/hermes/hermes_version.hpp b/externals/hermes/source/hermes/include/hermes/hermes_version.hpp similarity index 96% rename from externals/hermes/include/hermes/hermes_version.hpp rename to externals/hermes/source/hermes/include/hermes/hermes_version.hpp index fb0ec05..1192482 100644 --- a/externals/hermes/include/hermes/hermes_version.hpp +++ b/externals/hermes/source/hermes/include/hermes/hermes_version.hpp @@ -1,41 +1,41 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef VERSION_3B8BFD66_4CAA_4921_88C4_D49899FE2C59 -#define VERSION_3B8BFD66_4CAA_4921_88C4_D49899FE2C59 - - -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -namespace version -{ - - -void log_version(); - - -sxe::uint16_t get_major_version(); -sxe::uint16_t get_minor_version(); -sxe::uint16_t get_patch_version(); -sxe::uint16_t get_build_number(); - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef VERSION_3B8BFD66_4CAA_4921_88C4_D49899FE2C59 +#define VERSION_3B8BFD66_4CAA_4921_88C4_D49899FE2C59 + + +#include "essentials/compatibility/compatibility.hpp" + + +namespace hermes +{ + + +namespace version +{ + + +void log_version(); + + +sxe::uint16_t get_major_version(); +sxe::uint16_t get_minor_version(); +sxe::uint16_t get_patch_version(); +sxe::uint16_t get_build_number(); + + +} + + +} + + +#endif diff --git a/externals/hermes/include/hermes/log.hpp b/externals/hermes/source/hermes/include/hermes/log.hpp similarity index 96% rename from externals/hermes/include/hermes/log.hpp rename to externals/hermes/source/hermes/include/hermes/log.hpp index 0665dd7..b424043 100644 --- a/externals/hermes/include/hermes/log.hpp +++ b/externals/hermes/source/hermes/include/hermes/log.hpp @@ -1,152 +1,152 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_5AD3F1F5_0FC9_4D0E_8101_D9D70B8B1486 -#define LOG_5AD3F1F5_0FC9_4D0E_8101_D9D70B8B1486 - -#include "hermes_backward_compatibility.hpp" - - -#ifdef SX_NO_LOGGING - - -inline void parameter_muncher() -{ - // Nothing to do... -} - - -template< typename T, typename ... args > -void parameter_muncher( T, args ... _args ) -{ - parameter_muncher( _args... ); -} - - -//!\brief Macro that is used when SX_NO_LOGGING is defined and thus there should be no logging. Consumes all parameters -//!so no warnings occur because of unused parameters. The code does nothing and can (will) be removed by the optimizer. -//!\sa sxprintf -#define SX_LOG( _dummy, ... ) \ - do \ - {\ - parameter_muncher( __VA_ARGS__ ); \ - } \ - while( false ) - - -//!\brief Macro that is used when SX_NO_LOGGING is defined and thus there should be no logging. Consumes all parameters -//!so no warnings occur because of unused parameters. The code does nothing and can (will) be removed by the optimizer. -//!\sa sxprintf -#define SX_LOG_HEX( _dummy, ... ) \ - do \ - {\ - parameter_muncher( __VA_ARGS__ ); \ - } \ - while( false ) - - -#else - - -#ifndef SX_CPP03_BOOST - -//!\brief Create a log message. -//!\param _level The log level of the message. -//!\param ... Parameters that are inserted into the message. -//!\sa sxprintf -#define SX_LOG( _level, ... ) \ - do \ - { \ - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ - if( _level <= l_log_manager.get_log_level() ) \ - { \ - l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, __VA_ARGS__ ); \ - } \ - } \ - while( false ) - - -//!\brief Create a hex log message. -//!\param _level The log level of the message. -//!\param _heading The heading of the message. -//!\param _data The message of the log. -//!\param ... Parameters that are inserted into the message. -//!\sa sxprintf -#define SX_LOG_HEX( _level, _heading, _data, ... ) \ - do \ - { \ - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ - if( _level <= l_log_manager.get_log_level() ) \ - { \ - const std::string l_heading(_heading);\ - const std::string l_data(_data);\ - const std::string l_message = l_heading + "\n" + l_data;\ - l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, l_message, __VA_ARGS__ ); \ - } \ - } \ - while( false ) - - -//!\brief Create a log message and wait for the message to be written by the logger. -//!\param _level The log level of the message. -//!\param ... Parameters that are inserted into the message. -//!\sa sxprintf -#define SX_LOG_AND_WAIT( _level, ... ) \ - do \ - { \ - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ - if( _level <= l_log_manager.get_log_level() ) \ - { \ - l_log_manager.log_and_wait( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, __VA_ARGS__ ); \ - } \ - } \ - while( false ) - - -#else - - -#define SX_LOG hermes::log_helper( __FILE__, __LINE__).log -#define SX_LOG_AND_WAIT hermes::log_helper( __FILE__, __LINE__).log_and_wait - - -#endif - - -#endif - - -#ifndef SX_NO_LOGGING - - -#include "log_manager_template.hpp" -#include "std_timestamp_policy.hpp" - - -namespace hermes -{ - - -//!\brief An alias-declaration for the log manager template. -typedef hermes::log_manager_template< hermes::std_timestamp_policy > log_manager; - - -} - - -#ifdef SX_CPP03_BOOST -#include "log_helper.hpp" -#endif - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_5AD3F1F5_0FC9_4D0E_8101_D9D70B8B1486 +#define LOG_5AD3F1F5_0FC9_4D0E_8101_D9D70B8B1486 + +#include "hermes_backward_compatibility.hpp" + + +#ifdef SX_NO_LOGGING + + +inline void parameter_muncher() +{ + // Nothing to do... +} + + +template< typename T, typename ... args > +void parameter_muncher( T, args ... _args ) +{ + parameter_muncher( _args... ); +} + + +//!\brief Macro that is used when SX_NO_LOGGING is defined and thus there should be no logging. Consumes all parameters +//!so no warnings occur because of unused parameters. The code does nothing and can (will) be removed by the optimizer. +//!\sa sxprintf +#define SX_LOG( _dummy, ... ) \ + do \ + {\ + parameter_muncher( __VA_ARGS__ ); \ + } \ + while( false ) + + +//!\brief Macro that is used when SX_NO_LOGGING is defined and thus there should be no logging. Consumes all parameters +//!so no warnings occur because of unused parameters. The code does nothing and can (will) be removed by the optimizer. +//!\sa sxprintf +#define SX_LOG_HEX( _dummy, ... ) \ + do \ + {\ + parameter_muncher( __VA_ARGS__ ); \ + } \ + while( false ) + + +#else + + +#ifndef SX_CPP03_BOOST + +//!\brief Create a log message. +//!\param _level The log level of the message. +//!\param ... Parameters that are inserted into the message. +//!\sa sxprintf +#define SX_LOG( _level, ... ) \ + do \ + { \ + hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ + if( _level <= l_log_manager.get_log_level() ) \ + { \ + l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, __VA_ARGS__ ); \ + } \ + } \ + while( false ) + + +//!\brief Create a hex log message. +//!\param _level The log level of the message. +//!\param _heading The heading of the message. +//!\param _data The message of the log. +//!\param ... Parameters that are inserted into the message. +//!\sa sxprintf +#define SX_LOG_HEX( _level, _heading, _data, ... ) \ + do \ + { \ + hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ + if( _level <= l_log_manager.get_log_level() ) \ + { \ + const std::string l_heading(_heading);\ + const std::string l_data(_data);\ + const std::string l_message = l_heading + "\n" + l_data;\ + l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, l_message, __VA_ARGS__ ); \ + } \ + } \ + while( false ) + + +//!\brief Create a log message and wait for the message to be written by the logger. +//!\param _level The log level of the message. +//!\param ... Parameters that are inserted into the message. +//!\sa sxprintf +#define SX_LOG_AND_WAIT( _level, ... ) \ + do \ + { \ + hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); \ + if( _level <= l_log_manager.get_log_level() ) \ + { \ + l_log_manager.log_and_wait( _level, hermes::log_manager::get_instance().get_timestamp(), __FILE__, __LINE__, __VA_ARGS__ ); \ + } \ + } \ + while( false ) + + +#else + + +#define SX_LOG hermes::log_helper( __FILE__, __LINE__).log +#define SX_LOG_AND_WAIT hermes::log_helper( __FILE__, __LINE__).log_and_wait + + +#endif + + +#endif + + +#ifndef SX_NO_LOGGING + + +#include "log_manager_template.hpp" +#include "std_timestamp_policy.hpp" + + +namespace hermes +{ + + +//!\brief An alias-declaration for the log manager template. +typedef hermes::log_manager_template< hermes::std_timestamp_policy > log_manager; + + +} + + +#ifdef SX_CPP03_BOOST +#include "log_helper.hpp" +#endif + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/log_and_throw.hpp b/externals/hermes/source/hermes/include/hermes/log_and_throw.hpp similarity index 97% rename from externals/hermes/include/hermes/log_and_throw.hpp rename to externals/hermes/source/hermes/include/hermes/log_and_throw.hpp index bf7a688..fa0f5ed 100644 --- a/externals/hermes/include/hermes/log_and_throw.hpp +++ b/externals/hermes/source/hermes/include/hermes/log_and_throw.hpp @@ -1,124 +1,124 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_AND_THROW_A0ED92EB_7368_43EA_BB73_822E62AB4E66 -#define LOG_AND_THROW_A0ED92EB_7368_43EA_BB73_822E62AB4E66 - - -#include "log.hpp" -#include "essentials/exception.hpp" - - -#ifdef SX_CPP03_BOOST - #ifdef SX_NO_VARIADIC_MACRO - #include "log_and_throw_helper.hpp" - #else - #include "essentials/macro_helpers.hpp" - #endif -#endif - - -namespace hermes -{ - - -#ifndef SX_CPP03_BOOST - - -//!\def LOG_AND_THROW( _log_level, ... ) -//!\brief Log a message and then throw an exception with the same message. -#define LOG_AND_THROW( _log_level, ... ) \ - SX_LOG( _log_level, __VA_ARGS__ ); \ - throw sxe::exception( __VA_ARGS__ ); - - -#else - - -#ifndef SX_NO_VARIADIC_MACRO - -#define HERMES_VA_SELECT( NAME, _level, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )( _level, __VA_ARGS__) ) - -//!\def LOG_AND_THROW( _level, ... ) -//!\brief Log a message and then throw an exception with the same message. -#define LOG_AND_THROW( _level, ... ) EXPAND( HERMES_VA_SELECT( LOG_AND_THROW_PARAM, _level, __VA_ARGS__ ) ) - - -#define LOG_AND_THROW_PARAM_1( _log_level, _what ) \ - SX_LOG( _log_level, _what ); \ - throw sxe::exception( _what ); - - -#define LOG_AND_THROW_PARAM_2( _log_level, _what, _value ) \ - SX_LOG( _log_level, _what, _value ); \ - throw sxe::exception( _what, _value ); - - -#define LOG_AND_THROW_PARAM_3( _log_level, _what, _value1, _value2 ) \ - SX_LOG( _log_level, _what, _value1, _value2 ); \ - throw sxe::exception( _what, _value1, _value2 ); - - -#define LOG_AND_THROW_PARAM_4( _log_level, _what, _value1, _value2, _value3 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3 ); \ - throw sxe::exception( _what, _value1, _value2, _value3 ); - - -#define LOG_AND_THROW_PARAM_5( _log_level, _what, _value1, _value2, _value3, _value4 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4 ); - - -#define LOG_AND_THROW_PARAM_6( _log_level, _what, _value1, _value2, _value3, _value4, _value5 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5 ); - - -#define LOG_AND_THROW_PARAM_7( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6 ); - - -#define LOG_AND_THROW_PARAM_8( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - - -#define LOG_AND_THROW_PARAM_9( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - - -#define LOG_AND_THROW_PARAM_10( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - - -#define LOG_AND_THROW_PARAM_11( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) \ - SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); \ - throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - - -#else - - -#define LOG_AND_THROW hermes::log_and_throw_helper( __FILE__, __LINE__ ).log - - -#endif - - -#endif - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_AND_THROW_A0ED92EB_7368_43EA_BB73_822E62AB4E66 +#define LOG_AND_THROW_A0ED92EB_7368_43EA_BB73_822E62AB4E66 + + +#include "log.hpp" +#include "essentials/exception.hpp" + + +#ifdef SX_CPP03_BOOST + #ifdef SX_NO_VARIADIC_MACRO + #include "log_and_throw_helper.hpp" + #else + #include "essentials/macro_helpers.hpp" + #endif +#endif + + +namespace hermes +{ + + +#ifndef SX_CPP03_BOOST + + +//!\def LOG_AND_THROW( _log_level, ... ) +//!\brief Log a message and then throw an exception with the same message. +#define LOG_AND_THROW( _log_level, ... ) \ + SX_LOG( _log_level, __VA_ARGS__ ); \ + throw sxe::exception( __VA_ARGS__ ); + + +#else + + +#ifndef SX_NO_VARIADIC_MACRO + +#define HERMES_VA_SELECT( NAME, _level, ... ) EXPAND( SELECT( NAME, VA_SIZE(__VA_ARGS__) )( _level, __VA_ARGS__) ) + +//!\def LOG_AND_THROW( _level, ... ) +//!\brief Log a message and then throw an exception with the same message. +#define LOG_AND_THROW( _level, ... ) EXPAND( HERMES_VA_SELECT( LOG_AND_THROW_PARAM, _level, __VA_ARGS__ ) ) + + +#define LOG_AND_THROW_PARAM_1( _log_level, _what ) \ + SX_LOG( _log_level, _what ); \ + throw sxe::exception( _what ); + + +#define LOG_AND_THROW_PARAM_2( _log_level, _what, _value ) \ + SX_LOG( _log_level, _what, _value ); \ + throw sxe::exception( _what, _value ); + + +#define LOG_AND_THROW_PARAM_3( _log_level, _what, _value1, _value2 ) \ + SX_LOG( _log_level, _what, _value1, _value2 ); \ + throw sxe::exception( _what, _value1, _value2 ); + + +#define LOG_AND_THROW_PARAM_4( _log_level, _what, _value1, _value2, _value3 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3 ); \ + throw sxe::exception( _what, _value1, _value2, _value3 ); + + +#define LOG_AND_THROW_PARAM_5( _log_level, _what, _value1, _value2, _value3, _value4 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4 ); \ + throw sxe::exception( _what, _value1, _value2, _value3, _value4 ); + + +#define LOG_AND_THROW_PARAM_6( _log_level, _what, _value1, _value2, _value3, _value4, _value5 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5 ); \ + throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5 ); + + +#define LOG_AND_THROW_PARAM_7( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6 ); \ + throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6 ); + + +#define LOG_AND_THROW_PARAM_8( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); \ + throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); + + +#define LOG_AND_THROW_PARAM_9( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); \ + throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); + + +#define LOG_AND_THROW_PARAM_10( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); \ + throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); + + +#define LOG_AND_THROW_PARAM_11( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) \ + SX_LOG( _log_level, _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); \ + throw sxe::exception( _what, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); + + +#else + + +#define LOG_AND_THROW hermes::log_and_throw_helper( __FILE__, __LINE__ ).log + + +#endif + + +#endif + + +} + + +#endif diff --git a/externals/hermes/include/hermes/log_and_throw_helper.hpp b/externals/hermes/source/hermes/include/hermes/log_and_throw_helper.hpp similarity index 97% rename from externals/hermes/include/hermes/log_and_throw_helper.hpp rename to externals/hermes/source/hermes/include/hermes/log_and_throw_helper.hpp index 898ab1e..9cd04b3 100644 --- a/externals/hermes/include/hermes/log_and_throw_helper.hpp +++ b/externals/hermes/source/hermes/include/hermes/log_and_throw_helper.hpp @@ -1,210 +1,210 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_AND_THROW_HELPER_048D9A04_8BD3_49F0_97EA_7DCB3D6E08FC -#define LOG_AND_THROW_HELPER_048D9A04_8BD3_49F0_97EA_7DCB3D6E08FC - - -#ifdef SX_CPP03_BOOST - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/non_copyable.hpp" -#include "essentials/exception.hpp" -#include "log.hpp" - - -namespace hermes -{ - - - struct log_level; - - - class log_and_throw_helper SX_FINAL - { - public: - log_and_throw_helper( const std::string& _file_name, const int _line ); - ~log_and_throw_helper() SX_NOEXCEPT; - SX_NO_COPY( log_and_throw_helper ) - - void log( const log_level& _level, const std::string& _message ) const; - - template< typename _parameter_type1 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1 ); - } - throw sxe::exception( _message, _value1 ); - } - - - template< typename _parameter_type1, typename _parameter_type2 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2 ); - } - throw sxe::exception( _message, _value1, _value2 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3 ); - } - throw sxe::exception( _message, _value1, _value2, _value3 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, - typename _parameter_type8 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, - typename _parameter_type8, typename _parameter_type9 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, - typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, - typename _parameter_type8, typename _parameter_type9, typename _parameter_type10 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, - _parameter_type10 _value10 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - } - throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, - _value10 ); - } - - private: - const std::string& file_name_; - const int line_; - - - }; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_AND_THROW_HELPER_048D9A04_8BD3_49F0_97EA_7DCB3D6E08FC +#define LOG_AND_THROW_HELPER_048D9A04_8BD3_49F0_97EA_7DCB3D6E08FC + + +#ifdef SX_CPP03_BOOST + + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/non_copyable.hpp" +#include "essentials/exception.hpp" +#include "log.hpp" + + +namespace hermes +{ + + + struct log_level; + + + class log_and_throw_helper SX_FINAL + { + public: + log_and_throw_helper( const std::string& _file_name, const int _line ); + ~log_and_throw_helper() SX_NOEXCEPT; + SX_NO_COPY( log_and_throw_helper ) + + void log( const log_level& _level, const std::string& _message ) const; + + template< typename _parameter_type1 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1 ); + } + throw sxe::exception( _message, _value1 ); + } + + + template< typename _parameter_type1, typename _parameter_type2 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, + _value2 ); + } + throw sxe::exception( _message, _value1, _value2 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, + _value2, _value3 ); + } + throw sxe::exception( _message, _value1, _value2, _value3 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, + typename _parameter_type4 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, + _value2, _value3, _value4 ); + } + throw sxe::exception( _message, _value1, _value2, _value3, _value4 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, + typename _parameter_type4, typename _parameter_type5 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5 ); + } + throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, + typename _parameter_type4, typename _parameter_type5, typename _parameter_type6 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6 ); + } + throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, + typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); + } + throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, + typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, + typename _parameter_type8 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, + _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); + } + throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, + typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, + typename _parameter_type8, typename _parameter_type9 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); + } + throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, + typename _parameter_type4, typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, + typename _parameter_type8, typename _parameter_type9, typename _parameter_type10 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, + _parameter_type10 _value10 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); + } + throw sxe::exception( _message, _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, + _value10 ); + } + + private: + const std::string& file_name_; + const int line_; + + + }; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/log_callback.hpp b/externals/hermes/source/hermes/include/hermes/log_callback.hpp similarity index 96% rename from externals/hermes/include/hermes/log_callback.hpp rename to externals/hermes/source/hermes/include/hermes/log_callback.hpp index dae84de..6ef5ff7 100644 --- a/externals/hermes/include/hermes/log_callback.hpp +++ b/externals/hermes/source/hermes/include/hermes/log_callback.hpp @@ -1,59 +1,59 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_CALLBACK_B451A9E6_FCDE_44DB_B821_5F838D942994 -#define LOG_CALLBACK_B451A9E6_FCDE_44DB_B821_5F838D942994 - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - -#include "essentials/compatibility/compatibility.hpp" - -namespace hermes -{ - - -//!\interface log_callback -//!\brief Interface that adds wait functionality to the class that implements it. -class log_callback -{ -public: - log_callback() - { - // Nothing to do... - } - - - virtual ~log_callback() SX_NOEXCEPT - { - // Nothing to do... - } - - - //!\brief Wait for a condition. - virtual void wait() = 0; - - //!\brief The thing we are waiting for is done. - virtual void done() = 0; - - //!\brief Checks the thing we are waiting for is done. - virtual bool is_done() = 0; -}; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_CALLBACK_B451A9E6_FCDE_44DB_B821_5F838D942994 +#define LOG_CALLBACK_B451A9E6_FCDE_44DB_B821_5F838D942994 + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + +#include "essentials/compatibility/compatibility.hpp" + +namespace hermes +{ + + +//!\interface log_callback +//!\brief Interface that adds wait functionality to the class that implements it. +class log_callback +{ +public: + log_callback() + { + // Nothing to do... + } + + + virtual ~log_callback() SX_NOEXCEPT + { + // Nothing to do... + } + + + //!\brief Wait for a condition. + virtual void wait() = 0; + + //!\brief The thing we are waiting for is done. + virtual void done() = 0; + + //!\brief Checks the thing we are waiting for is done. + virtual bool is_done() = 0; +}; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/log_helper.hpp b/externals/hermes/source/hermes/include/hermes/log_helper.hpp similarity index 97% rename from externals/hermes/include/hermes/log_helper.hpp rename to externals/hermes/source/hermes/include/hermes/log_helper.hpp index 92623d1..efc8ef7 100644 --- a/externals/hermes/include/hermes/log_helper.hpp +++ b/externals/hermes/source/hermes/include/hermes/log_helper.hpp @@ -1,342 +1,342 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_HELPER_F1630103_70EA_469C_B378_32955DA9A018 -#define LOG_HELPER_F1630103_70EA_469C_B378_32955DA9A018 - - -#ifdef SX_CPP03_BOOST - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/non_copyable.hpp" -#include "log.hpp" - - -namespace hermes -{ - - -struct log_level; - - -class log_helper SX_FINAL -{ -public: - log_helper( const std::string& _file_name, const int _line ); - ~log_helper() SX_NOEXCEPT; - SX_NO_COPY( log_helper ) - - void log( const log_level& _level, const std::string& _message ) const; - - - template< typename _parameter_type1 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9, typename _parameter_type10 > - void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, - _parameter_type10 _value10 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - } - } - - - template< typename _parameter_type1 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, - _value2, _value3, _value4 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); - } - } - - - template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, - typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, - typename _parameter_type9, typename _parameter_type10 > - void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, - _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, - _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, - _parameter_type10 _value10 ) const - { - log_manager_template& l_log_manager = log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, - _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); - } - } - - -private: - const std::string& file_name_; - const int line_; - - -}; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_HELPER_F1630103_70EA_469C_B378_32955DA9A018 +#define LOG_HELPER_F1630103_70EA_469C_B378_32955DA9A018 + + +#ifdef SX_CPP03_BOOST + + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/non_copyable.hpp" +#include "log.hpp" + + +namespace hermes +{ + + +struct log_level; + + +class log_helper SX_FINAL +{ +public: + log_helper( const std::string& _file_name, const int _line ); + ~log_helper() SX_NOEXCEPT; + SX_NO_COPY( log_helper ) + + void log( const log_level& _level, const std::string& _message ) const; + + + template< typename _parameter_type1 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, + _value2, _value3, _value4 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, + typename _parameter_type9 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, + typename _parameter_type9, typename _parameter_type10 > + void log( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, + _parameter_type10 _value10 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); + } + } + + + template< typename _parameter_type1 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, _value1, + _value2, _value3, _value4 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, + typename _parameter_type9 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9 ); + } + } + + + template< typename _parameter_type1, typename _parameter_type2, typename _parameter_type3, typename _parameter_type4, + typename _parameter_type5, typename _parameter_type6, typename _parameter_type7, typename _parameter_type8, + typename _parameter_type9, typename _parameter_type10 > + void log_and_wait( const log_level& _level, const std::string& _message, _parameter_type1 _value1, + _parameter_type2 _value2, _parameter_type3 _value3, _parameter_type4 _value4, _parameter_type5 _value5, + _parameter_type6 _value6, _parameter_type7 _value7, _parameter_type8 _value8, _parameter_type9 _value9, + _parameter_type10 _value10 ) const + { + log_manager_template& l_log_manager = log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log_and_wait( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message, + _value1, _value2, _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ); + } + } + + +private: + const std::string& file_name_; + const int line_; + + +}; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/log_level.hpp b/externals/hermes/source/hermes/include/hermes/log_level.hpp similarity index 96% rename from externals/hermes/include/hermes/log_level.hpp rename to externals/hermes/source/hermes/include/hermes/log_level.hpp index 07b05f8..651d0a4 100644 --- a/externals/hermes/include/hermes/log_level.hpp +++ b/externals/hermes/source/hermes/include/hermes/log_level.hpp @@ -1,118 +1,118 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_LEVEL_5059A1FA_DC2D_4C94_AA8B_49B750B30F07 -#define LOG_LEVEL_5059A1FA_DC2D_4C94_AA8B_49B750B30F07 - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include - - -namespace hermes -{ - - -#ifndef SX_CPP03_BOOST - - -//!\enum log_level -//!\brief The log levels. -enum class log_level -{ - LL_OFF = -1, LL_ASSERT = 0, LL_FATAL = 1, LL_ERROR = 2, LL_WARN = 3, LL_INFO = 4, LL_DEBUG = 5, LL_TRACE = 6, LL_SPAM = 7 -}; - - -#else - - -//!\struct log_level -//!\brief Structure representing a log level (enum wrapper for C++11 enum class like behavior). -struct log_level -{ - //!\enum log_level - //!\brief The log levels. - enum inner - { - LL_OFF = -1, LL_ASSERT = 0, LL_FATAL = 1, LL_ERROR = 2, LL_WARN = 3, LL_INFO = 4, LL_DEBUG = 5, LL_TRACE = 6, LL_SPAM = 7 - }; - - - //!\brief Constructor - //!\param _value Given log level value that is represented by the structure. - log_level( inner _value ) : value_( _value ) - { - // Nothing to do... - } - - - //!\brief Constructor. Default value is LL_OFF. - log_level() : value_( LL_OFF ) - { - // Nothing to do... - } - - - //!\brief Constructor - //!\param _color Given log level structure containing the log level value that is represented by the structure. - log_level(const log_level& _log_level) : value_(_log_level.value_) - { - // Nothing to do... - } - - - //!\brief Function returning the log level value represented by the structure. - operator inner() const - { - return ( value_ ); - } - - - //!\brief Log level value represented by the structure. - inner value_; - -}; - - -#endif - - - -//!\brief Convert the given log level to a string. -//!\param _log_level The log level. -//!\return The log level as string. -std::string log_level_to_string( const log_level _log_level ); - - - -#ifdef SX_CPP03_BOOST - - -bool operator==( const hermes::log_level& _lhs, const hermes::log_level::inner _rhs ); -bool operator==( const hermes::log_level::inner _lhs, const hermes::log_level& _rhs ); -bool operator<(const hermes::log_level _lhs, const hermes::log_level _rhs); -bool operator<=( const hermes::log_level _lhs, const hermes::log_level _rhs ); - - -#endif - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_LEVEL_5059A1FA_DC2D_4C94_AA8B_49B750B30F07 +#define LOG_LEVEL_5059A1FA_DC2D_4C94_AA8B_49B750B30F07 + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include + + +namespace hermes +{ + + +#ifndef SX_CPP03_BOOST + + +//!\enum log_level +//!\brief The log levels. +enum class log_level +{ + LL_OFF = -1, LL_ASSERT = 0, LL_FATAL = 1, LL_ERROR = 2, LL_WARN = 3, LL_INFO = 4, LL_DEBUG = 5, LL_TRACE = 6, LL_SPAM = 7 +}; + + +#else + + +//!\struct log_level +//!\brief Structure representing a log level (enum wrapper for C++11 enum class like behavior). +struct log_level +{ + //!\enum log_level + //!\brief The log levels. + enum inner + { + LL_OFF = -1, LL_ASSERT = 0, LL_FATAL = 1, LL_ERROR = 2, LL_WARN = 3, LL_INFO = 4, LL_DEBUG = 5, LL_TRACE = 6, LL_SPAM = 7 + }; + + + //!\brief Constructor + //!\param _value Given log level value that is represented by the structure. + log_level( inner _value ) : value_( _value ) + { + // Nothing to do... + } + + + //!\brief Constructor. Default value is LL_OFF. + log_level() : value_( LL_OFF ) + { + // Nothing to do... + } + + + //!\brief Constructor + //!\param _color Given log level structure containing the log level value that is represented by the structure. + log_level(const log_level& _log_level) : value_(_log_level.value_) + { + // Nothing to do... + } + + + //!\brief Function returning the log level value represented by the structure. + operator inner() const + { + return ( value_ ); + } + + + //!\brief Log level value represented by the structure. + inner value_; + +}; + + +#endif + + + +//!\brief Convert the given log level to a string. +//!\param _log_level The log level. +//!\return The log level as string. +std::string log_level_to_string( const log_level _log_level ); + + + +#ifdef SX_CPP03_BOOST + + +bool operator==( const hermes::log_level& _lhs, const hermes::log_level::inner _rhs ); +bool operator==( const hermes::log_level::inner _lhs, const hermes::log_level& _rhs ); +bool operator<(const hermes::log_level _lhs, const hermes::log_level _rhs); +bool operator<=( const hermes::log_level _lhs, const hermes::log_level _rhs ); + + +#endif + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/log_manager_template.hpp b/externals/hermes/source/hermes/include/hermes/log_manager_template.hpp similarity index 97% rename from externals/hermes/include/hermes/log_manager_template.hpp rename to externals/hermes/source/hermes/include/hermes/log_manager_template.hpp index a080318..0b71d8d 100644 --- a/externals/hermes/include/hermes/log_manager_template.hpp +++ b/externals/hermes/source/hermes/include/hermes/log_manager_template.hpp @@ -1,594 +1,594 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_MANAGER_TEMPLATE_F6D33798_A43A_4C29_86F1_0FC821B92F9B -#define LOG_MANAGER_TEMPLATE_F6D33798_A43A_4C29_86F1_0FC821B92F9B - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include - -#include "essentials/base.hpp" -#include "logger.hpp" -#include "log_message.hpp" -#include "essentials/sxprintf.hpp" -#include "waiter.hpp" - - -namespace hermes -{ - - -namespace -{ - - -bool LOG_MANAGER_EXISTS = false; - - -} - -//!\class t_log_manager_template -//!\brief The log manager (a singleton) controls the different loggers, manages the current log level, and takes care -//!of dispatching log messages. -template< typename time_stamp_policy > -class log_manager_template SX_FINAL -{ -public: - //!\brief Get a reference to the single instance of the log manager template. - static log_manager_template& get_instance( void ) - { - static log_manager_template instance; - return( instance ); - } - - - SX_NO_COPY(log_manager_template) - - //!\brief Get the currently set log level. - //!\return Current log level. - log_level get_log_level() const - { - return( log_level_ ); - } - - - //!\brief Set a new log level. - //!\param _log_level Log level to be set. - //!\return void - void set_log_level( const log_level _log_level ) - { - log_level_ = _log_level; - } - - -#ifndef SX_CPP03_BOOST - - - //!\brief Add a message to the queue of messages that will be processed. - //!\param _log_level Log level of the message. - //!\param _time_stamp Date and time when the log message was created. - //!\param _file The file from where the log was called. - //!\param _line The line from where the log was called. - //!\param _message The message text for the log. - //!\param _args Parameters that are inserted in the message. - //!\return void - //!\sa log_and_wait, SX_LOG(), sxprintf - template< typename ... args > - void log( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, args ... _args ) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _args ... ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - } - - - //!\brief Add a message to the queue of messages and waits the message to be processed. - //!\param _log_level Log level of the message. - //!\param _time_stamp Date and time when the log message was created. - //!\param _file The file from where the log was called. - //!\param _line The line from where the log was called. - //!\param _message The message text for the log. - //!\param _args Parameters that are inserted in the message. - //!\return void - //!\sa log, SX_LOG(), sxprintf - template< typename ... args > - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, args ... _args ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _args ... ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - -#else - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str() ) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const hermes::log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, - _value2) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5 ) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6)); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8) ); - sxe::lock_guard< sxe::mutex > lock(mutex_); - messages_.push(message); - } - condition_.notify_one(); - } - - - void log( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9 ) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - } - - - void log( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ) - { - { - log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - } - - -//**************************************************log_and_wait**************************************************// - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str() ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, - const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, - const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, - const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ) - { - waiter waiter; - { - log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, - _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - messages_.push( message ); - } - condition_.notify_one(); - waiter.wait(); - } - - - -#endif - - - //!\brief Adds a logger to which the log will be written. - //!\param _logger - The logger to be added. - //!\return void - void add_logger( logger_uptr _logger ) - { - SX_ASSERT( stop_, "Logger cannot be added while running!" ); - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - loggers_.push_back( sxe::move( _logger ) ); - } - - - //!\brief Starts the logging. On starting, a new thread is created which processes the enqueued log message by - //!sending them to each logger. The thread has to be stopped and joined before the log manager is destroyed! - //!\return void - //!\sa halt, join - void run() - { - stop_ = false; - thread_ = sxe::thread( sxe::bind( &log_manager_template::work, this ) ); - } - - - //!\brief Stops the logging. The thread that processes the log messages is notified that it should stop. It still has - //!to be joined later. - //!\return void - //!\sa run, join, halt_and_join - void halt() - { - { - sxe::lock_guard< sxe::mutex > lock( mutex_ ); - stop_ = true; - } - condition_.notify_one(); - } - - - //!\brief Joins the thread that processed the log messages. Join has to be called after the halt function. - //!\return void - //!\sa halt, run, halt_and_join - void join() - { - thread_.join(); - } - - - //!\brief Stops the logging and joins the thread that processed the log messages. - //!\return void - //!\sa halt, run, join - void halt_and_join() - { - halt(); - join(); - } - - - //!\brief Get the current date and time as a string. - //!\return String containing the date and time. - static std::string get_timestamp() - { - return( time_stamp_policy::get_timestamp() ); - } - - -private: - log_manager_template() - : thread_(), - mutex_(), - condition_(), - stop_( true ), - loggers_(), - messages_(), - log_level_( log_level::LL_OFF ) - { - SX_ASSERT( !LOG_MANAGER_EXISTS, "Log manager already exists!" ); - LOG_MANAGER_EXISTS = true; - } - - - ~log_manager_template() - { - SX_ASSERT( stop_, "Thread is still running! It was not stopped." ); - } - - - bool should_be_running() const - { - return( stop_ || !messages_.empty() ); - } - - - bool finished() const - { - return( stop_ && messages_.empty() ); - } - - - void work() - { - while( true ) - { - log_message message; - { - sxe::unique_lock< sxe::mutex > lock( mutex_ ); - condition_.wait( lock, sxe::bind( &log_manager_template::should_be_running, this ) ); - - if( finished() ) - { - break; - } - - message = messages_.front(); - messages_.pop(); - } - - SX_FOR(const logger_uptr& logger, loggers_) - { - logger->log( message ); - message.done(); - } - } - } - - - sxe::thread thread_; - sxe::mutex mutex_; - sxe::condition_variable condition_; - bool stop_; - loggers loggers_; - std::queue< log_message > messages_; - log_level log_level_; -}; - - -} - - -#endif - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_MANAGER_TEMPLATE_F6D33798_A43A_4C29_86F1_0FC821B92F9B +#define LOG_MANAGER_TEMPLATE_F6D33798_A43A_4C29_86F1_0FC821B92F9B + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include + +#include "essentials/base.hpp" +#include "logger.hpp" +#include "log_message.hpp" +#include "essentials/sxprintf.hpp" +#include "waiter.hpp" + + +namespace hermes +{ + + +namespace +{ + + +bool LOG_MANAGER_EXISTS = false; + + +} + +//!\class t_log_manager_template +//!\brief The log manager (a singleton) controls the different loggers, manages the current log level, and takes care +//!of dispatching log messages. +template< typename time_stamp_policy > +class log_manager_template SX_FINAL +{ +public: + //!\brief Get a reference to the single instance of the log manager template. + static log_manager_template& get_instance( void ) + { + static log_manager_template instance; + return( instance ); + } + + + SX_NO_COPY(log_manager_template) + + //!\brief Get the currently set log level. + //!\return Current log level. + log_level get_log_level() const + { + return( log_level_ ); + } + + + //!\brief Set a new log level. + //!\param _log_level Log level to be set. + //!\return void + void set_log_level( const log_level _log_level ) + { + log_level_ = _log_level; + } + + +#ifndef SX_CPP03_BOOST + + + //!\brief Add a message to the queue of messages that will be processed. + //!\param _log_level Log level of the message. + //!\param _time_stamp Date and time when the log message was created. + //!\param _file The file from where the log was called. + //!\param _line The line from where the log was called. + //!\param _message The message text for the log. + //!\param _args Parameters that are inserted in the message. + //!\return void + //!\sa log_and_wait, SX_LOG(), sxprintf + template< typename ... args > + void log( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, args ... _args ) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _args ... ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + } + + + //!\brief Add a message to the queue of messages and waits the message to be processed. + //!\param _log_level Log level of the message. + //!\param _time_stamp Date and time when the log message was created. + //!\param _file The file from where the log was called. + //!\param _line The line from where the log was called. + //!\param _message The message text for the log. + //!\param _args Parameters that are inserted in the message. + //!\return void + //!\sa log, SX_LOG(), sxprintf + template< typename ... args > + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, args ... _args ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _args ... ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + +#else + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str() ) ); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const hermes::log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value) ); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, + _value2) ); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, + _value3)); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, + _value3, _value4)); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5 ) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, + _value3, _value4, _value5)); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6)); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7) ); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log(const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, + const sxe::value_type& _value8) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf(_message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7, _value8) ); + sxe::lock_guard< sxe::mutex > lock(mutex_); + messages_.push(message); + } + condition_.notify_one(); + } + + + void log( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, + const sxe::value_type& _value8, const sxe::value_type& _value9 ) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + } + + + void log( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, + const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ) + { + { + log_message message( SX_NULLPTR, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + } + + +//**************************************************log_and_wait**************************************************// + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str() ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, + const sxe::value_type& _value8 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7, _value8 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, + const sxe::value_type& _value8, const sxe::value_type& _value9 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7, _value8, _value9 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + void log_and_wait( const log_level _log_level, const std::string& _time_stamp, const std::string& _file, const int _line, + const std::string& _message, const sxe::value_type& _value1, const sxe::value_type& _value2, const sxe::value_type& _value3, + const sxe::value_type& _value4, const sxe::value_type& _value5, const sxe::value_type& _value6, const sxe::value_type& _value7, + const sxe::value_type& _value8, const sxe::value_type& _value9, const sxe::value_type& _value10 ) + { + waiter waiter; + { + log_message message( &waiter, _log_level, _time_stamp, _file, _line, sxe::sxprintf( _message.c_str(), _value1, _value2, + _value3, _value4, _value5, _value6, _value7, _value8, _value9, _value10 ) ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + messages_.push( message ); + } + condition_.notify_one(); + waiter.wait(); + } + + + +#endif + + + //!\brief Adds a logger to which the log will be written. + //!\param _logger - The logger to be added. + //!\return void + void add_logger( logger_uptr _logger ) + { + SX_ASSERT( stop_, "Logger cannot be added while running!" ); + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + loggers_.push_back( sxe::move( _logger ) ); + } + + + //!\brief Starts the logging. On starting, a new thread is created which processes the enqueued log message by + //!sending them to each logger. The thread has to be stopped and joined before the log manager is destroyed! + //!\return void + //!\sa halt, join + void run() + { + stop_ = false; + thread_ = sxe::thread( sxe::bind( &log_manager_template::work, this ) ); + } + + + //!\brief Stops the logging. The thread that processes the log messages is notified that it should stop. It still has + //!to be joined later. + //!\return void + //!\sa run, join, halt_and_join + void halt() + { + { + sxe::lock_guard< sxe::mutex > lock( mutex_ ); + stop_ = true; + } + condition_.notify_one(); + } + + + //!\brief Joins the thread that processed the log messages. Join has to be called after the halt function. + //!\return void + //!\sa halt, run, halt_and_join + void join() + { + thread_.join(); + } + + + //!\brief Stops the logging and joins the thread that processed the log messages. + //!\return void + //!\sa halt, run, join + void halt_and_join() + { + halt(); + join(); + } + + + //!\brief Get the current date and time as a string. + //!\return String containing the date and time. + static std::string get_timestamp() + { + return( time_stamp_policy::get_timestamp() ); + } + + +private: + log_manager_template() + : thread_(), + mutex_(), + condition_(), + stop_( true ), + loggers_(), + messages_(), + log_level_( log_level::LL_OFF ) + { + SX_ASSERT( !LOG_MANAGER_EXISTS, "Log manager already exists!" ); + LOG_MANAGER_EXISTS = true; + } + + + ~log_manager_template() + { + SX_ASSERT( stop_, "Thread is still running! It was not stopped." ); + } + + + bool should_be_running() const + { + return( stop_ || !messages_.empty() ); + } + + + bool finished() const + { + return( stop_ && messages_.empty() ); + } + + + void work() + { + while( true ) + { + log_message message; + { + sxe::unique_lock< sxe::mutex > lock( mutex_ ); + condition_.wait( lock, sxe::bind( &log_manager_template::should_be_running, this ) ); + + if( finished() ) + { + break; + } + + message = messages_.front(); + messages_.pop(); + } + + SX_FOR(const logger_uptr& logger, loggers_) + { + logger->log( message ); + message.done(); + } + } + } + + + sxe::thread thread_; + sxe::mutex mutex_; + sxe::condition_variable condition_; + bool stop_; + loggers loggers_; + std::queue< log_message > messages_; + log_level log_level_; +}; + + +} + + +#endif + +#endif diff --git a/externals/hermes/include/hermes/log_message.hpp b/externals/hermes/source/hermes/include/hermes/log_message.hpp similarity index 97% rename from externals/hermes/include/hermes/log_message.hpp rename to externals/hermes/source/hermes/include/hermes/log_message.hpp index d0585c7..fee8c1a 100644 --- a/externals/hermes/include/hermes/log_message.hpp +++ b/externals/hermes/source/hermes/include/hermes/log_message.hpp @@ -1,66 +1,66 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOG_MESSAGE_2F81F136_9F98_4FE3_A47A_9DEBB9538995 -#define LOG_MESSAGE_2F81F136_9F98_4FE3_A47A_9DEBB9538995 - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include "log_level.hpp" -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -class log_callback; - - -//!\struct log_message -//!\brief Structure of the message to be logged, containing all necessary elements: log callback (if it is used), -//!\log level, time stamp of the log, file and line where the log is generated and the message of the log. -struct log_message SX_FINAL -{ - //!\brief Constructor - log_message(); - - //!\brief Constructor - //!\param _log_callback Pointer to log callback. - //!\param _log_level Log level for this log message. - //!\param _time_stamp Time stamp of the log message. - //!\param _file File where the log message was generated. - //!\param _line Line of the file where the log message is generated. - //!\param _message The message of the log. - log_message( log_callback* _log_callback, const log_level _log_level, const std::string& _time_stamp, - const std::string& _file, const int _line, const std::string& _message ); - - //!\brief Function that notifies the log callback that we are done. - void done(); - - log_level log_level_; - std::string time_stamp_; - std::string file_; - int line_; - std::string message_; - log_callback* log_callback_; -}; - - -} - - -#endif - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOG_MESSAGE_2F81F136_9F98_4FE3_A47A_9DEBB9538995 +#define LOG_MESSAGE_2F81F136_9F98_4FE3_A47A_9DEBB9538995 + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include "log_level.hpp" +#include "essentials/compatibility/compatibility.hpp" + + +namespace hermes +{ + + +class log_callback; + + +//!\struct log_message +//!\brief Structure of the message to be logged, containing all necessary elements: log callback (if it is used), +//!\log level, time stamp of the log, file and line where the log is generated and the message of the log. +struct log_message SX_FINAL +{ + //!\brief Constructor + log_message(); + + //!\brief Constructor + //!\param _log_callback Pointer to log callback. + //!\param _log_level Log level for this log message. + //!\param _time_stamp Time stamp of the log message. + //!\param _file File where the log message was generated. + //!\param _line Line of the file where the log message is generated. + //!\param _message The message of the log. + log_message( log_callback* _log_callback, const log_level _log_level, const std::string& _time_stamp, + const std::string& _file, const int _line, const std::string& _message ); + + //!\brief Function that notifies the log callback that we are done. + void done(); + + log_level log_level_; + std::string time_stamp_; + std::string file_; + int line_; + std::string message_; + log_callback* log_callback_; +}; + + +} + + +#endif + +#endif diff --git a/externals/hermes/include/hermes/logger.hpp b/externals/hermes/source/hermes/include/hermes/logger.hpp similarity index 96% rename from externals/hermes/include/hermes/logger.hpp rename to externals/hermes/source/hermes/include/hermes/logger.hpp index 362e79c..9d3e998 100644 --- a/externals/hermes/include/hermes/logger.hpp +++ b/externals/hermes/source/hermes/include/hermes/logger.hpp @@ -1,64 +1,64 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOGGER_4207DA98_D8C1_41B4_B5B1_29E8C5A22DF3 -#define LOGGER_4207DA98_D8C1_41B4_B5B1_29E8C5A22DF3 - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include "logger_fwd.hpp" -#include "essentials/non_copyable.hpp" - - -namespace hermes -{ - - -struct log_message; - - -//!\interface logger -//!\brief Interface of the general logger. The specialized loggers derive from this interface. -class logger -{ -public: - //!\brief logger constructor. - logger() - { - // Nothing to do... - } - - - virtual ~logger() SX_NOEXCEPT - { - // Nothing to do... - } - - - SX_NO_COPY(logger) - - //!\brief Log the message to the target medium. - //!\param _log_message Message to be logged. - //!\return void - virtual void log( const log_message& _log_message ) = 0; -}; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOGGER_4207DA98_D8C1_41B4_B5B1_29E8C5A22DF3 +#define LOGGER_4207DA98_D8C1_41B4_B5B1_29E8C5A22DF3 + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include "logger_fwd.hpp" +#include "essentials/non_copyable.hpp" + + +namespace hermes +{ + + +struct log_message; + + +//!\interface logger +//!\brief Interface of the general logger. The specialized loggers derive from this interface. +class logger +{ +public: + //!\brief logger constructor. + logger() + { + // Nothing to do... + } + + + virtual ~logger() SX_NOEXCEPT + { + // Nothing to do... + } + + + SX_NO_COPY(logger) + + //!\brief Log the message to the target medium. + //!\param _log_message Message to be logged. + //!\return void + virtual void log( const log_message& _log_message ) = 0; +}; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/logger_fwd.hpp b/externals/hermes/source/hermes/include/hermes/logger_fwd.hpp similarity index 96% rename from externals/hermes/include/hermes/logger_fwd.hpp rename to externals/hermes/source/hermes/include/hermes/logger_fwd.hpp index 2d7704c..18d2e9d 100644 --- a/externals/hermes/include/hermes/logger_fwd.hpp +++ b/externals/hermes/source/hermes/include/hermes/logger_fwd.hpp @@ -1,44 +1,44 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef LOGGER_FWD_9F0DC46E_91EC_44AB_ADE0_7F223D30DE83 -#define LOGGER_FWD_9F0DC46E_91EC_44AB_ADE0_7F223D30DE83 - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include - -#include "essentials/compatibility/compatibility.hpp" - - -namespace hermes -{ - - -class logger; - -//!\typedef Alias for logger smart pointer. -typedef sxe::SX_UNIQUE_PTR< logger > logger_uptr; - -//!\typedef Alias for vector of logger smart pointers. -typedef std::vector< logger_uptr > loggers; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef LOGGER_FWD_9F0DC46E_91EC_44AB_ADE0_7F223D30DE83 +#define LOGGER_FWD_9F0DC46E_91EC_44AB_ADE0_7F223D30DE83 + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include + +#include "essentials/compatibility/compatibility.hpp" + + +namespace hermes +{ + + +class logger; + +//!\typedef Alias for logger smart pointer. +typedef sxe::SX_UNIQUE_PTR< logger > logger_uptr; + +//!\typedef Alias for vector of logger smart pointers. +typedef std::vector< logger_uptr > loggers; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/std_timestamp_policy.hpp b/externals/hermes/source/hermes/include/hermes/std_timestamp_policy.hpp similarity index 96% rename from externals/hermes/include/hermes/std_timestamp_policy.hpp rename to externals/hermes/source/hermes/include/hermes/std_timestamp_policy.hpp index 39eb9d6..3879b39 100644 --- a/externals/hermes/include/hermes/std_timestamp_policy.hpp +++ b/externals/hermes/source/hermes/include/hermes/std_timestamp_policy.hpp @@ -1,47 +1,47 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef STD_TIMESTAMP_POLICY_A0D64C16_D7D3_4E06_B647_F949D14BBBAB -#define STD_TIMESTAMP_POLICY_A0D64C16_D7D3_4E06_B647_F949D14BBBAB - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include - -#include "essentials/non_copyable.hpp" - - -namespace hermes -{ - -//!\class std_timestamp_policy -//!\brief Provides time stamps for the logger. -class std_timestamp_policy SX_FINAL -{ -public: - SX_NO_COPY(std_timestamp_policy) - - //!\ Provides time stamp as string. - //!\return Time stamp as string. - static std::string get_timestamp(); -}; - - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef STD_TIMESTAMP_POLICY_A0D64C16_D7D3_4E06_B647_F949D14BBBAB +#define STD_TIMESTAMP_POLICY_A0D64C16_D7D3_4E06_B647_F949D14BBBAB + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include + +#include "essentials/non_copyable.hpp" + + +namespace hermes +{ + +//!\class std_timestamp_policy +//!\brief Provides time stamps for the logger. +class std_timestamp_policy SX_FINAL +{ +public: + SX_NO_COPY(std_timestamp_policy) + + //!\ Provides time stamp as string. + //!\return Time stamp as string. + static std::string get_timestamp(); +}; + + +} + + +#endif + + +#endif diff --git a/externals/hermes/include/hermes/waiter.hpp b/externals/hermes/source/hermes/include/hermes/waiter.hpp similarity index 96% rename from externals/hermes/include/hermes/waiter.hpp rename to externals/hermes/source/hermes/include/hermes/waiter.hpp index 350920f..5b23b65 100644 --- a/externals/hermes/include/hermes/waiter.hpp +++ b/externals/hermes/source/hermes/include/hermes/waiter.hpp @@ -1,60 +1,60 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifndef WAITER_5E57D733_02DD_413D_A906_5047979A5DFD -#define WAITER_5E57D733_02DD_413D_A906_5047979A5DFD - -#include "hermes_backward_compatibility.hpp" - - -#ifndef SX_NO_LOGGING - - -#include "log_callback.hpp" -#include "essentials/compatibility/thread.hpp" - - -namespace hermes -{ - - //!\class waiter - //!\brief Class that implements the log callback and gives the logger the ability to wait for a message to be printed. This useful when - //!when we have to be sure writing a log message has definitely finished (e.g. before triggering an assert). - class waiter : public log_callback - { - public: - //!\brief Constructor - waiter(); - virtual ~waiter() SX_NOEXCEPT SX_OVERRIDE; - - //!\brief Wait for the process to finish. - virtual void wait() SX_OVERRIDE; - - //!\brief The thing we are waiting for is done. - virtual void done() SX_OVERRIDE; - - //!\brief Check if the thing we are waiting for is done. - //!\return True if it's done, false otherwise. - virtual bool is_done() SX_OVERRIDE; - - - private: - sxe::mutex done_mutex_; - sxe::condition_variable done_condition_variable_; - bool done_; - }; - -} - - -#endif - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifndef WAITER_5E57D733_02DD_413D_A906_5047979A5DFD +#define WAITER_5E57D733_02DD_413D_A906_5047979A5DFD + +#include "hermes_backward_compatibility.hpp" + + +#ifndef SX_NO_LOGGING + + +#include "log_callback.hpp" +#include "essentials/compatibility/thread.hpp" + + +namespace hermes +{ + + //!\class waiter + //!\brief Class that implements the log callback and gives the logger the ability to wait for a message to be printed. This useful when + //!when we have to be sure writing a log message has definitely finished (e.g. before triggering an assert). + class waiter : public log_callback + { + public: + //!\brief Constructor + waiter(); + virtual ~waiter() SX_NOEXCEPT SX_OVERRIDE; + + //!\brief Wait for the process to finish. + virtual void wait() SX_OVERRIDE; + + //!\brief The thing we are waiting for is done. + virtual void done() SX_OVERRIDE; + + //!\brief Check if the thing we are waiting for is done. + //!\return True if it's done, false otherwise. + virtual bool is_done() SX_OVERRIDE; + + + private: + sxe::mutex done_mutex_; + sxe::condition_variable done_condition_variable_; + bool done_; + }; + +} + + +#endif + + +#endif diff --git a/externals/hermes/source/color_mapping.cpp b/externals/hermes/source/hermes/source/color_mapping.cpp similarity index 96% rename from externals/hermes/source/color_mapping.cpp rename to externals/hermes/source/hermes/source/color_mapping.cpp index b290316..8a9d2b4 100644 --- a/externals/hermes/source/color_mapping.cpp +++ b/externals/hermes/source/hermes/source/color_mapping.cpp @@ -1,78 +1,78 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/color_mapping.hpp" - -#include -#include - - -namespace hermes -{ - -#ifndef SX_CPP03_BOOST - - -color_mapping::color_mapping() - : color_map_( - { - { log_level::LL_FATAL, color::C_RED }, { log_level::LL_ERROR, color::C_DARK_RED }, - { log_level::LL_ASSERT, color::C_DARK_RED }, { log_level::LL_WARN, color::C_YELLOW }, - { log_level::LL_INFO, color::C_DARK_YELLOW }, { log_level::LL_DEBUG, color::C_DARK_GREEN }, - { log_level::LL_TRACE,color::C_DARK_GREEN }, { log_level::LL_SPAM, color::C_GREEN } - } ) -{ - // Nothing to do... -} - - -#else - - - color_mapping::color_mapping() - { - color_map_[ log_level::LL_FATAL ] = color::C_RED; - color_map_[ log_level::LL_ERROR ] = color::C_DARK_RED; - color_map_[ log_level::LL_ASSERT ] = color::C_DARK_RED; - color_map_[ log_level::LL_WARN ] = color::C_YELLOW; - color_map_[ log_level::LL_INFO ] = color::C_DARK_YELLOW; - color_map_[ log_level::LL_DEBUG ] = color::C_DARK_GREEN; - color_map_[ log_level::LL_TRACE ] = color::C_DARK_GREEN; - color_map_[ log_level::LL_SPAM ] = color::C_GREEN; - } - - -#endif - - -color_mapping::~color_mapping() SX_NOEXCEPT -{ - // Nothing to do... -} - - -color color_mapping::get_color( const hermes::log_level _log_level ) const -{ - color color_to_use( color::C_WHITE ); - color_map::const_iterator search = color_map_.find( _log_level ); - if (search != color_map_.end()) - { - color_to_use = search->second; - } - return( color_to_use ); -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SX_NO_LOGGING + + +#include "hermes/color_mapping.hpp" + +#include +#include + + +namespace hermes +{ + +#ifndef SX_CPP03_BOOST + + +color_mapping::color_mapping() + : color_map_( + { + { log_level::LL_FATAL, color::C_RED }, { log_level::LL_ERROR, color::C_DARK_RED }, + { log_level::LL_ASSERT, color::C_DARK_RED }, { log_level::LL_WARN, color::C_YELLOW }, + { log_level::LL_INFO, color::C_DARK_YELLOW }, { log_level::LL_DEBUG, color::C_DARK_GREEN }, + { log_level::LL_TRACE,color::C_DARK_GREEN }, { log_level::LL_SPAM, color::C_GREEN } + } ) +{ + // Nothing to do... +} + + +#else + + + color_mapping::color_mapping() + { + color_map_[ log_level::LL_FATAL ] = color::C_RED; + color_map_[ log_level::LL_ERROR ] = color::C_DARK_RED; + color_map_[ log_level::LL_ASSERT ] = color::C_DARK_RED; + color_map_[ log_level::LL_WARN ] = color::C_YELLOW; + color_map_[ log_level::LL_INFO ] = color::C_DARK_YELLOW; + color_map_[ log_level::LL_DEBUG ] = color::C_DARK_GREEN; + color_map_[ log_level::LL_TRACE ] = color::C_DARK_GREEN; + color_map_[ log_level::LL_SPAM ] = color::C_GREEN; + } + + +#endif + + +color_mapping::~color_mapping() SX_NOEXCEPT +{ + // Nothing to do... +} + + +color color_mapping::get_color( const hermes::log_level _log_level ) const +{ + color color_to_use( color::C_WHITE ); + color_map::const_iterator search = color_map_.find( _log_level ); + if (search != color_map_.end()) + { + color_to_use = search->second; + } + return( color_to_use ); +} + + +} + + +#endif diff --git a/externals/hermes/source/cout_logger.cpp b/externals/hermes/source/hermes/source/cout_logger.cpp similarity index 96% rename from externals/hermes/source/cout_logger.cpp rename to externals/hermes/source/hermes/source/cout_logger.cpp index 23c6c03..9c4fb80 100644 --- a/externals/hermes/source/cout_logger.cpp +++ b/externals/hermes/source/hermes/source/cout_logger.cpp @@ -1,96 +1,96 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/cout_logger.hpp" - -#include -#include -#include - -#include "essentials/conversion.hpp" - -#include "hermes/log_message.hpp" - - -#ifdef WIN32 - - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -#ifndef SX_NO_WINDOWS_H - #include -#endif - - -#endif - -#include "hermes/globals.hpp" - - -namespace hermes -{ - - -cout_logger::cout_logger() - : logger(), - color_mapping_() -{ - // Nothing to do... -} - - -void cout_logger::log( const log_message& _log_message ) -{ - std::stringstream log_stream; - log_level_as_message( _log_message.log_level_ ); - log_stream << " " << _log_message.time_stamp_; - log_stream << " [" << _log_message.file_; - log_stream << "@" << sxe::to_string( _log_message.line_ ); - log_stream << "]: " << _log_message.message_; - std::cout << log_stream.str() << std::endl; -} - - -void cout_logger::log_level_as_message( const hermes::log_level _log_level ) const -{ - const std::string& log_level = log_level_to_string( _log_level ); - -#ifdef WIN32 - - CONSOLE_SCREEN_BUFFER_INFO console_screen_buffer_info; - HANDLE handle = GetStdHandle( STD_OUTPUT_HANDLE ); - GetConsoleScreenBufferInfo( handle, &console_screen_buffer_info ); - const color color_of_log_level = color_mapping_.get_color( _log_level ); -#ifndef SX_CPP03_BOOST - SetConsoleTextAttribute( handle, static_cast< WORD >( color_of_log_level ) ); -#else - SetConsoleTextAttribute(handle, static_cast< WORD >( color_of_log_level.value_ )); -#endif - std::cout << " " << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level; - SetConsoleTextAttribute( handle, console_screen_buffer_info.wAttributes ); - -#else - - std::cout << " " << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level; - -#endif - - -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SX_NO_LOGGING + + +#include "hermes/cout_logger.hpp" + +#include +#include +#include + +#include "essentials/conversion.hpp" + +#include "hermes/log_message.hpp" + + +#ifdef WIN32 + + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#ifndef SX_NO_WINDOWS_H + #include +#endif + + +#endif + +#include "hermes/globals.hpp" + + +namespace hermes +{ + + +cout_logger::cout_logger() + : logger(), + color_mapping_() +{ + // Nothing to do... +} + + +void cout_logger::log( const log_message& _log_message ) +{ + std::stringstream log_stream; + log_level_as_message( _log_message.log_level_ ); + log_stream << " " << _log_message.time_stamp_; + log_stream << " [" << _log_message.file_; + log_stream << "@" << sxe::to_string( _log_message.line_ ); + log_stream << "]: " << _log_message.message_; + std::cout << log_stream.str() << std::endl; +} + + +void cout_logger::log_level_as_message( const hermes::log_level _log_level ) const +{ + const std::string& log_level = log_level_to_string( _log_level ); + +#ifdef WIN32 + + CONSOLE_SCREEN_BUFFER_INFO console_screen_buffer_info; + HANDLE handle = GetStdHandle( STD_OUTPUT_HANDLE ); + GetConsoleScreenBufferInfo( handle, &console_screen_buffer_info ); + const color color_of_log_level = color_mapping_.get_color( _log_level ); +#ifndef SX_CPP03_BOOST + SetConsoleTextAttribute( handle, static_cast< WORD >( color_of_log_level ) ); +#else + SetConsoleTextAttribute(handle, static_cast< WORD >( color_of_log_level.value_ )); +#endif + std::cout << " " << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level; + SetConsoleTextAttribute( handle, console_screen_buffer_info.wAttributes ); + +#else + + std::cout << " " << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level; + +#endif + + +} + + +} + + +#endif diff --git a/externals/hermes/source/file_logger.cpp b/externals/hermes/source/hermes/source/file_logger.cpp similarity index 96% rename from externals/hermes/source/file_logger.cpp rename to externals/hermes/source/hermes/source/file_logger.cpp index 205bac0..ea66d69 100644 --- a/externals/hermes/source/file_logger.cpp +++ b/externals/hermes/source/hermes/source/file_logger.cpp @@ -1,186 +1,186 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/file_logger.hpp" - -#include -#include -#include - -#include "essentials/conversion.hpp" - -#include "hermes/file_system.hpp" -#include "hermes/globals.hpp" -#include "hermes/log_message.hpp" - - -namespace hermes -{ - - -file_logger::file_logger( const size_t _max_file_size_in_bytes, const std::string& _log_files_directory, - const std::string& _name_suffix, const std::string& _name_extension, const unsigned _max_file_number, - const bool _throw_on_error ) : - max_file_size_in_bytes_( _max_file_size_in_bytes ), - log_files_directory_( add_trailing_slash_to_directory_path( _log_files_directory ) ), - name_sufix_( _name_suffix ), - name_extension_( _name_extension ), - max_file_number_( _max_file_number ), - throw_on_error_( _throw_on_error ), - working_file_() -{ - // Set member here to avoid future trouble with initialization order. - working_file_ = get_working_log_file_name(); - rotate_if_necessary(); -} - - -file_logger::~file_logger() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void file_logger::log( const log_message& _log_message ) -{ - const std::string log_level = log_level_to_string( _log_message.log_level_ ); - std::stringstream log_message_stream; - log_message_stream << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level << - " " << _log_message.time_stamp_ << " [" << _log_message.file_ << "@" << _log_message.line_ << - "]: " << _log_message.message_; - log_into_file( log_message_stream.str() ); - rotate_if_necessary(); -} - - -void file_logger::log_into_file( const std::string& _message ) const -{ - const bool append = does_file_exist( working_file_ ); - std::ios_base::openmode open_mode_flag; - if( append ) - { - open_mode_flag = std::ios::app; - } - else - { - open_mode_flag = std::ios::trunc; - } - -#ifndef SX_CPP03_BOOST - std::ofstream file( working_file_, open_mode_flag ); -#else - std::ofstream file( working_file_.c_str(), open_mode_flag ); -#endif - if( !file ) - { - const std::string error_message = sxe::sxprintf( "Failed to open file '%'.", working_file_ ); - if( throw_on_error_ ) - { - throw exception( error_message ); - } - else - { - std::cerr << error_message; - } - } - - file << _message << std::endl; - file.close(); -} - - -std::string file_logger::get_log_file_name_with_index( const unsigned _index ) const -{ - std::stringstream file_name_stream; - file_name_stream << log_files_directory_ << name_sufix_ << sxe::to_string( _index ) << "." << name_extension_; - return( file_name_stream.str() ); -} - - -std::string file_logger::get_working_log_file_name() const -{ - return( log_files_directory_ + name_sufix_ + "." + name_extension_ ); -} - - -void file_logger::rotate_if_necessary() const -{ - const size_t file_size = get_file_size( working_file_ ); - if( file_size > max_file_size_in_bytes_ ) - { - rename_files(); - } -} - - -void file_logger::rename_files() const -{ - for( unsigned i = max_file_number_ - 1; i > 0; --i ) - { - const std::string old_name = get_log_file_name_with_index( i - 1 ); - const std::string new_name = get_log_file_name_with_index( i ); - rename_file_if_exists( old_name, new_name ); - } - - // rename from foo.log to foo0.log - rename_file_if_exists( working_file_, get_log_file_name_with_index( 0 ) ); -} - - -void file_logger::rename_file_if_exists( const std::string& _old_name, const std::string& _new_name ) const -{ - if( does_file_exist( _old_name ) ) - { - if( does_file_exist( _new_name ) ) - { - delete_file( _new_name ); - } - - const int renamed = std::rename( _old_name.c_str(), _new_name.c_str() ); - if( renamed ) - { - const std::string error_message = sxe::sxprintf( "File '%' could not be renamed!", _old_name ); - if( throw_on_error_ ) - { - throw exception( error_message ); - } - else - { - std::cerr << error_message; - } - } - } -} - - -void file_logger::delete_file( const std::string& _file_name ) const -{ - const int removed = std::remove( _file_name.c_str() ); - if( removed > 0 ) - { - const std::string error_message = sxe::sxprintf( "File '%' could not be deleted!\n", _file_name ); - if( throw_on_error_ ) - { - throw exception( error_message ); - } - else - { - std::cerr << error_message; - } - } -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SX_NO_LOGGING + + +#include "hermes/file_logger.hpp" + +#include +#include +#include + +#include "essentials/conversion.hpp" + +#include "hermes/file_system.hpp" +#include "hermes/globals.hpp" +#include "hermes/log_message.hpp" + + +namespace hermes +{ + + +file_logger::file_logger( const size_t _max_file_size_in_bytes, const std::string& _log_files_directory, + const std::string& _name_suffix, const std::string& _name_extension, const unsigned _max_file_number, + const bool _throw_on_error ) : + max_file_size_in_bytes_( _max_file_size_in_bytes ), + log_files_directory_( add_trailing_slash_to_directory_path( _log_files_directory ) ), + name_sufix_( _name_suffix ), + name_extension_( _name_extension ), + max_file_number_( _max_file_number ), + throw_on_error_( _throw_on_error ), + working_file_() +{ + // Set member here to avoid future trouble with initialization order. + working_file_ = get_working_log_file_name(); + rotate_if_necessary(); +} + + +file_logger::~file_logger() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void file_logger::log( const log_message& _log_message ) +{ + const std::string log_level = log_level_to_string( _log_message.log_level_ ); + std::stringstream log_message_stream; + log_message_stream << std::setw( LOG_LEVEL_BLOCK_WIDTH ) << std::setfill( ' ' ) << std::left << log_level << + " " << _log_message.time_stamp_ << " [" << _log_message.file_ << "@" << _log_message.line_ << + "]: " << _log_message.message_; + log_into_file( log_message_stream.str() ); + rotate_if_necessary(); +} + + +void file_logger::log_into_file( const std::string& _message ) const +{ + const bool append = does_file_exist( working_file_ ); + std::ios_base::openmode open_mode_flag; + if( append ) + { + open_mode_flag = std::ios::app; + } + else + { + open_mode_flag = std::ios::trunc; + } + +#ifndef SX_CPP03_BOOST + std::ofstream file( working_file_, open_mode_flag ); +#else + std::ofstream file( working_file_.c_str(), open_mode_flag ); +#endif + if( !file ) + { + const std::string error_message = sxe::sxprintf( "Failed to open file '%'.", working_file_ ); + if( throw_on_error_ ) + { + throw exception( error_message ); + } + else + { + std::cerr << error_message; + } + } + + file << _message << std::endl; + file.close(); +} + + +std::string file_logger::get_log_file_name_with_index( const unsigned _index ) const +{ + std::stringstream file_name_stream; + file_name_stream << log_files_directory_ << name_sufix_ << sxe::to_string( _index ) << "." << name_extension_; + return( file_name_stream.str() ); +} + + +std::string file_logger::get_working_log_file_name() const +{ + return( log_files_directory_ + name_sufix_ + "." + name_extension_ ); +} + + +void file_logger::rotate_if_necessary() const +{ + const size_t file_size = get_file_size( working_file_ ); + if( file_size > max_file_size_in_bytes_ ) + { + rename_files(); + } +} + + +void file_logger::rename_files() const +{ + for( unsigned i = max_file_number_ - 1; i > 0; --i ) + { + const std::string old_name = get_log_file_name_with_index( i - 1 ); + const std::string new_name = get_log_file_name_with_index( i ); + rename_file_if_exists( old_name, new_name ); + } + + // rename from foo.log to foo0.log + rename_file_if_exists( working_file_, get_log_file_name_with_index( 0 ) ); +} + + +void file_logger::rename_file_if_exists( const std::string& _old_name, const std::string& _new_name ) const +{ + if( does_file_exist( _old_name ) ) + { + if( does_file_exist( _new_name ) ) + { + delete_file( _new_name ); + } + + const int renamed = std::rename( _old_name.c_str(), _new_name.c_str() ); + if( renamed ) + { + const std::string error_message = sxe::sxprintf( "File '%' could not be renamed!", _old_name ); + if( throw_on_error_ ) + { + throw exception( error_message ); + } + else + { + std::cerr << error_message; + } + } + } +} + + +void file_logger::delete_file( const std::string& _file_name ) const +{ + const int removed = std::remove( _file_name.c_str() ); + if( removed > 0 ) + { + const std::string error_message = sxe::sxprintf( "File '%' could not be deleted!\n", _file_name ); + if( throw_on_error_ ) + { + throw exception( error_message ); + } + else + { + std::cerr << error_message; + } + } +} + + +} + + +#endif diff --git a/externals/hermes/source/file_system.cpp b/externals/hermes/source/hermes/source/file_system.cpp similarity index 96% rename from externals/hermes/source/file_system.cpp rename to externals/hermes/source/hermes/source/file_system.cpp index 2e0022e..d4017f3 100644 --- a/externals/hermes/source/file_system.cpp +++ b/externals/hermes/source/hermes/source/file_system.cpp @@ -1,70 +1,70 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "hermes/file_system.hpp" - - -namespace hermes -{ - - -size_t get_file_size( const std::string& _file_name ) -{ -#ifndef SX_CPP03_BOOST - std::ifstream in( _file_name, std::ios::binary | std::ios::ate ); -#else - std::ifstream in( _file_name.c_str(), std::ios::binary | std::ios::ate ); -#endif - return( static_cast< size_t >( in.tellg() ) ); -} - - -bool does_file_exist( const std::string& _file_name ) -{ - bool file_exists = false; -#ifndef SX_CPP03_BOOST - std::ifstream in( _file_name ); -#else - std::ifstream in( _file_name.c_str() ); -#endif - if( in ) - { - file_exists = true; - in.close(); - } - - return( file_exists ); -} - - -std::string add_trailing_slash_to_directory_path( const std::string& _path ) -{ - std::string log_file_directory_with_trailing_slash = _path; - if( !log_file_directory_with_trailing_slash.empty() && ( *log_file_directory_with_trailing_slash.rbegin() != '/' ) && - ( *log_file_directory_with_trailing_slash.rbegin() != '\\' ) ) - { - log_file_directory_with_trailing_slash += '/'; - } - - if( !log_file_directory_with_trailing_slash.empty() && ( *log_file_directory_with_trailing_slash.rbegin() != '\\' ) ) - { - *log_file_directory_with_trailing_slash.rbegin() = '/'; - } - - if( log_file_directory_with_trailing_slash.empty() ) - { - log_file_directory_with_trailing_slash = "./"; - } - - return( log_file_directory_with_trailing_slash ); -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "hermes/file_system.hpp" + + +namespace hermes +{ + + +size_t get_file_size( const std::string& _file_name ) +{ +#ifndef SX_CPP03_BOOST + std::ifstream in( _file_name, std::ios::binary | std::ios::ate ); +#else + std::ifstream in( _file_name.c_str(), std::ios::binary | std::ios::ate ); +#endif + return( static_cast< size_t >( in.tellg() ) ); +} + + +bool does_file_exist( const std::string& _file_name ) +{ + bool file_exists = false; +#ifndef SX_CPP03_BOOST + std::ifstream in( _file_name ); +#else + std::ifstream in( _file_name.c_str() ); +#endif + if( in ) + { + file_exists = true; + in.close(); + } + + return( file_exists ); +} + + +std::string add_trailing_slash_to_directory_path( const std::string& _path ) +{ + std::string log_file_directory_with_trailing_slash = _path; + if( !log_file_directory_with_trailing_slash.empty() && ( *log_file_directory_with_trailing_slash.rbegin() != '/' ) && + ( *log_file_directory_with_trailing_slash.rbegin() != '\\' ) ) + { + log_file_directory_with_trailing_slash += '/'; + } + + if( !log_file_directory_with_trailing_slash.empty() && ( *log_file_directory_with_trailing_slash.rbegin() != '\\' ) ) + { + *log_file_directory_with_trailing_slash.rbegin() = '/'; + } + + if( log_file_directory_with_trailing_slash.empty() ) + { + log_file_directory_with_trailing_slash = "./"; + } + + return( log_file_directory_with_trailing_slash ); +} + + +} diff --git a/externals/hermes/source/globals.cpp b/externals/hermes/source/hermes/source/globals.cpp similarity index 97% rename from externals/hermes/source/globals.cpp rename to externals/hermes/source/hermes/source/globals.cpp index fe75321..927f891 100644 --- a/externals/hermes/source/globals.cpp +++ b/externals/hermes/source/hermes/source/globals.cpp @@ -1,21 +1,21 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include "hermes/globals.hpp" - - -namespace hermes -{ - - -const int LOG_LEVEL_BLOCK_WIDTH = 7; - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include "hermes/globals.hpp" + + +namespace hermes +{ + + +const int LOG_LEVEL_BLOCK_WIDTH = 7; + + +} diff --git a/externals/hermes/source/hermes_version.cpp b/externals/hermes/source/hermes/source/hermes_version.cpp similarity index 91% rename from externals/hermes/source/hermes_version.cpp rename to externals/hermes/source/hermes/source/hermes_version.cpp index e699fa3..61a6770 100644 --- a/externals/hermes/source/hermes_version.cpp +++ b/externals/hermes/source/hermes/source/hermes_version.cpp @@ -1,76 +1,76 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#include - -#include "essentials/compatibility/compatibility.hpp" -#include "essentials/sxprintf.hpp" - -#include "hermes/hermes_version.hpp" -#include "hermes/build_number.hpp" - - -namespace hermes -{ - - -namespace version -{ - - -namespace -{ - - -const sxe::uint16_t VERSION_MAJOR( 1 ); -const sxe::uint16_t VERSION_MINOR( 1 ); -const sxe::uint16_t VERSION_PATCH( 2 ); - - -} - - -// cppcheck-suppress unusedFunction -void log_version() -{ - std::cout << sxe::sxprintf( "hermes library version %.%.%.%.", hermes::version::get_major_version(), - hermes::version::get_minor_version(), hermes::version::get_patch_version(), hermes::version::get_build_number() ) - << std::endl; -} - - -sxe::uint16_t get_major_version() -{ - return( VERSION_MAJOR ); -} - - -sxe::uint16_t get_minor_version() -{ - return( VERSION_MINOR ); -} - - -sxe::uint16_t get_patch_version() -{ - return( VERSION_PATCH ); -} - - -sxe::uint16_t get_build_number() -{ - return( hermes::version::BUILD_NUMBER ); -} - - -} - - -} +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#include + +#include "essentials/compatibility/compatibility.hpp" +#include "essentials/sxprintf.hpp" + +#include "hermes/hermes_version.hpp" +#include "hermes/build_number.hpp" + + +namespace hermes +{ + + +namespace version +{ + + +namespace +{ + + +const sxe::uint16_t VERSION_MAJOR( 1 ); +const sxe::uint16_t VERSION_MINOR( 2 ); +const sxe::uint16_t VERSION_PATCH( 0 ); + + +} + + +// cppcheck-suppress unusedFunction +void log_version() +{ + std::cout << sxe::sxprintf( "hermes library version %.%.%.%.", hermes::version::get_major_version(), + hermes::version::get_minor_version(), hermes::version::get_patch_version(), hermes::version::get_build_number() ) + << std::endl; +} + + +sxe::uint16_t get_major_version() +{ + return( VERSION_MAJOR ); +} + + +sxe::uint16_t get_minor_version() +{ + return( VERSION_MINOR ); +} + + +sxe::uint16_t get_patch_version() +{ + return( VERSION_PATCH ); +} + + +sxe::uint16_t get_build_number() +{ + return( hermes::version::BUILD_NUMBER ); +} + + +} + + +} diff --git a/externals/hermes/source/log_and_throw_helper.cpp b/externals/hermes/source/hermes/source/log_and_throw_helper.cpp similarity index 97% rename from externals/hermes/source/log_and_throw_helper.cpp rename to externals/hermes/source/hermes/source/log_and_throw_helper.cpp index 5ead8a2..c7ee22d 100644 --- a/externals/hermes/source/log_and_throw_helper.cpp +++ b/externals/hermes/source/hermes/source/log_and_throw_helper.cpp @@ -1,50 +1,50 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - - -#ifdef SX_CPP03_BOOST - - -#include "hermes/log_and_throw_helper.hpp" - -#include "essentials/sxprintf.hpp" - - -namespace hermes -{ - - - log_and_throw_helper::log_and_throw_helper( const std::string& _file_name, const int _line ) - : file_name_( _file_name ), - line_( _line ) - { - // Nothing to do... - } - - - log_and_throw_helper::~log_and_throw_helper() SX_NOEXCEPT - { - // Nothing to do... - } - - - void log_and_throw_helper::log( const log_level& _level, const std::string& _message ) const - { - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), file_name_, line_, _message ); - } - throw sxe::exception( _message ); - } - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + + +#ifdef SX_CPP03_BOOST + + +#include "hermes/log_and_throw_helper.hpp" + +#include "essentials/sxprintf.hpp" + + +namespace hermes +{ + + + log_and_throw_helper::log_and_throw_helper( const std::string& _file_name, const int _line ) + : file_name_( _file_name ), + line_( _line ) + { + // Nothing to do... + } + + + log_and_throw_helper::~log_and_throw_helper() SX_NOEXCEPT + { + // Nothing to do... + } + + + void log_and_throw_helper::log( const log_level& _level, const std::string& _message ) const + { + hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, hermes::log_manager::get_instance().get_timestamp(), file_name_, line_, _message ); + } + throw sxe::exception( _message ); + } + +} + + +#endif diff --git a/externals/hermes/source/log_helper.cpp b/externals/hermes/source/hermes/source/log_helper.cpp similarity index 97% rename from externals/hermes/source/log_helper.cpp rename to externals/hermes/source/hermes/source/log_helper.cpp index 79c86e3..ee95df0 100644 --- a/externals/hermes/source/log_helper.cpp +++ b/externals/hermes/source/hermes/source/log_helper.cpp @@ -1,47 +1,47 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef SX_CPP03_BOOST - -#include "hermes/log_helper.hpp" - -#include "essentials/sxprintf.hpp" - - -namespace hermes -{ - - - log_helper::log_helper( const std::string& _file_name, const int _line ) - : file_name_(_file_name), - line_(_line) - { - // Nothing to do... - } - - - log_helper::~log_helper() SX_NOEXCEPT - { - // Nothing to do... - } - - - void log_helper::log( const log_level& _level, const std::string& _message ) const - { - hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); - if( _level <= l_log_manager.get_log_level() ) - { - l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message ); - } - } - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef SX_CPP03_BOOST + +#include "hermes/log_helper.hpp" + +#include "essentials/sxprintf.hpp" + + +namespace hermes +{ + + + log_helper::log_helper( const std::string& _file_name, const int _line ) + : file_name_(_file_name), + line_(_line) + { + // Nothing to do... + } + + + log_helper::~log_helper() SX_NOEXCEPT + { + // Nothing to do... + } + + + void log_helper::log( const log_level& _level, const std::string& _message ) const + { + hermes::log_manager_template& l_log_manager = hermes::log_manager::get_instance(); + if( _level <= l_log_manager.get_log_level() ) + { + l_log_manager.log( _level, log_manager::get_instance().get_timestamp(), file_name_, line_, _message ); + } + } + +} + + +#endif diff --git a/externals/hermes/source/log_level.cpp b/externals/hermes/source/hermes/source/log_level.cpp similarity index 95% rename from externals/hermes/source/log_level.cpp rename to externals/hermes/source/hermes/source/log_level.cpp index 854b7db..4e50ed9 100644 --- a/externals/hermes/source/log_level.cpp +++ b/externals/hermes/source/hermes/source/log_level.cpp @@ -1,126 +1,126 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/log_level.hpp" - -#include "essentials/base.hpp" - - -namespace hermes -{ - - -std::string log_level_to_string( const log_level _log_level ) -{ - std::string log_level_string = "???"; - -#ifndef SX_CPP03_BOOST - switch( _log_level ) -#else - switch (_log_level.value_) -#endif - { - case ( log_level::LL_FATAL ): - { - log_level_string = "FATAL"; - } - break; - - case ( log_level::LL_ERROR ): - { - log_level_string = "ERROR"; - } - break; - - case ( log_level::LL_ASSERT ): - { - log_level_string = "ASSERT"; - } - break; - - case ( log_level::LL_WARN ): - { - log_level_string = "WARN"; - } - break; - - case ( log_level::LL_INFO ): - { - log_level_string = "INFO"; - } - break; - - case ( log_level::LL_DEBUG ): - { - log_level_string = "DEBUG"; - } - break; - - case ( log_level::LL_TRACE ): - { - log_level_string = "TRACE"; - } - break; - - case ( log_level::LL_SPAM ): - { - log_level_string = "SPAM"; - } - break; - - default: - SX_ASSERT( false, "Unknown log level!" ); - break; - } - - - return( log_level_string ); -} - - -#ifdef SX_CPP03_BOOST - - -// cppcheck-suppress unusedFunction -bool operator==(const hermes::log_level& _lhs, const hermes::log_level::inner _rhs) -{ - return( _lhs.value_ == _rhs ); -} - - -bool operator==(const hermes::log_level::inner _lhs, const hermes::log_level& _rhs) -{ - return( _lhs == _rhs.value_ ); -} - - -// cppcheck-suppress unusedFunction -bool operator<(const hermes::log_level _lhs, const hermes::log_level _rhs) -{ - return ( _lhs.value_ < _rhs.value_ ); -} - - -// cppcheck-suppress unusedFunction -bool operator<=( const hermes::log_level _lhs, const hermes::log_level _rhs ) -{ - return ( _lhs.value_ <= _rhs.value_ ); -} - - -#endif - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SX_NO_LOGGING + + +#include "hermes/log_level.hpp" + +#include "essentials/base.hpp" + + +namespace hermes +{ + + +std::string log_level_to_string( const log_level _log_level ) +{ + std::string log_level_string = "???"; + +#ifndef SX_CPP03_BOOST + switch( _log_level ) +#else + switch (_log_level.value_) +#endif + { + case ( log_level::LL_FATAL ): + { + log_level_string = "FATAL"; + } + break; + + case ( log_level::LL_ERROR ): + { + log_level_string = "ERROR"; + } + break; + + case ( log_level::LL_ASSERT ): + { + log_level_string = "ASSERT"; + } + break; + + case ( log_level::LL_WARN ): + { + log_level_string = "WARN"; + } + break; + + case ( log_level::LL_INFO ): + { + log_level_string = "INFO"; + } + break; + + case ( log_level::LL_DEBUG ): + { + log_level_string = "DEBUG"; + } + break; + + case ( log_level::LL_TRACE ): + { + log_level_string = "TRACE"; + } + break; + + case ( log_level::LL_SPAM ): + { + log_level_string = "SPAM"; + } + break; + + default: + SX_ASSERT( false, "Unknown log level!" ); + break; + } + + + return( log_level_string ); +} + + +#ifdef SX_CPP03_BOOST + + +// cppcheck-suppress unusedFunction +bool operator==(const hermes::log_level& _lhs, const hermes::log_level::inner _rhs) +{ + return( _lhs.value_ == _rhs ); +} + + +bool operator==(const hermes::log_level::inner _lhs, const hermes::log_level& _rhs) +{ + return( _lhs == _rhs.value_ ); +} + + +// cppcheck-suppress unusedFunction +bool operator<(const hermes::log_level _lhs, const hermes::log_level _rhs) +{ + return ( _lhs.value_ < _rhs.value_ ); +} + + +// cppcheck-suppress unusedFunction +bool operator<=( const hermes::log_level _lhs, const hermes::log_level _rhs ) +{ + return ( _lhs.value_ <= _rhs.value_ ); +} + + +#endif + + +} + + +#endif diff --git a/externals/hermes/source/log_message.cpp b/externals/hermes/source/hermes/source/log_message.cpp similarity index 96% rename from externals/hermes/source/log_message.cpp rename to externals/hermes/source/hermes/source/log_message.cpp index 9c859b6..cb3ef45 100644 --- a/externals/hermes/source/log_message.cpp +++ b/externals/hermes/source/hermes/source/log_message.cpp @@ -1,58 +1,58 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/log_message.hpp" -#include "hermes/log_callback.hpp" - - -namespace hermes -{ - - -log_message::log_message() - : log_level_(), - time_stamp_(), - file_(), - line_(), - message_(), - log_callback_() -{ - // Nothing to do... -} - - -log_message::log_message( log_callback* _log_callback, const log_level _log_level, const std::string& _time_stamp, - const std::string& _file, const int _line, const std::string& _message ) - : log_level_( _log_level ), - time_stamp_( _time_stamp ), - file_( _file ), - line_( _line ), - message_( _message ), - log_callback_( _log_callback ) -{ - // Nothing to do... -} - - -void log_message::done() -{ - if( log_callback_ ) - { - log_callback_->done(); - } -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SX_NO_LOGGING + + +#include "hermes/log_message.hpp" +#include "hermes/log_callback.hpp" + + +namespace hermes +{ + + +log_message::log_message() + : log_level_(), + time_stamp_(), + file_(), + line_(), + message_(), + log_callback_() +{ + // Nothing to do... +} + + +log_message::log_message( log_callback* _log_callback, const log_level _log_level, const std::string& _time_stamp, + const std::string& _file, const int _line, const std::string& _message ) + : log_level_( _log_level ), + time_stamp_( _time_stamp ), + file_( _file ), + line_( _line ), + message_( _message ), + log_callback_( _log_callback ) +{ + // Nothing to do... +} + + +void log_message::done() +{ + if( log_callback_ ) + { + log_callback_->done(); + } +} + + +} + + +#endif diff --git a/externals/hermes/source/std_timestamp_policy.cpp b/externals/hermes/source/hermes/source/std_timestamp_policy.cpp similarity index 97% rename from externals/hermes/source/std_timestamp_policy.cpp rename to externals/hermes/source/hermes/source/std_timestamp_policy.cpp index 001eec9..439d959 100644 --- a/externals/hermes/source/std_timestamp_policy.cpp +++ b/externals/hermes/source/hermes/source/std_timestamp_policy.cpp @@ -1,60 +1,60 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/std_timestamp_policy.hpp" - -#include -#include - -#include - - -namespace hermes -{ - - -namespace -{ - - -const unsigned int WIDTH_YEAR( 4 ); -const unsigned int WIDTH_CLOCK( 2 ); -const char FILL_VALUE( '0' ); -const unsigned int YEAR_1900( 1900 ); -const char DATE_DELIMITER( '/' ); -const char TIME_DELIMITER( ':' ); -const char SPACE_SEPARATOR( ' ' ); - - -} - - -std::string std_timestamp_policy::get_timestamp() -{ - std::stringstream date_time_stream; - time_t rawtime; - time( &rawtime ); - tm timeinfo = *localtime( &rawtime ); - date_time_stream << std::setfill( FILL_VALUE ) << std::setw( WIDTH_YEAR ) << ( YEAR_1900 + timeinfo.tm_year ) << - DATE_DELIMITER << std::setfill( FILL_VALUE ) << std::setw( WIDTH_CLOCK ) << ++timeinfo.tm_mon << DATE_DELIMITER << - std::setfill( FILL_VALUE ) << std::setw( WIDTH_CLOCK ) << timeinfo.tm_mday << SPACE_SEPARATOR << std::setfill( FILL_VALUE ) << - std::setw( WIDTH_CLOCK ) << timeinfo.tm_hour << TIME_DELIMITER << std::setfill( FILL_VALUE ) << - std::setw( WIDTH_CLOCK ) << timeinfo.tm_min << TIME_DELIMITER << std::setfill( FILL_VALUE ) << - std::setw( WIDTH_CLOCK ) << timeinfo.tm_sec; - return( date_time_stream.str() ); -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SX_NO_LOGGING + + +#include "hermes/std_timestamp_policy.hpp" + +#include +#include + +#include + + +namespace hermes +{ + + +namespace +{ + + +const unsigned int WIDTH_YEAR( 4 ); +const unsigned int WIDTH_CLOCK( 2 ); +const char FILL_VALUE( '0' ); +const unsigned int YEAR_1900( 1900 ); +const char DATE_DELIMITER( '/' ); +const char TIME_DELIMITER( ':' ); +const char SPACE_SEPARATOR( ' ' ); + + +} + + +std::string std_timestamp_policy::get_timestamp() +{ + std::stringstream date_time_stream; + time_t rawtime; + time( &rawtime ); + tm timeinfo = *localtime( &rawtime ); + date_time_stream << std::setfill( FILL_VALUE ) << std::setw( WIDTH_YEAR ) << ( YEAR_1900 + timeinfo.tm_year ) << + DATE_DELIMITER << std::setfill( FILL_VALUE ) << std::setw( WIDTH_CLOCK ) << ++timeinfo.tm_mon << DATE_DELIMITER << + std::setfill( FILL_VALUE ) << std::setw( WIDTH_CLOCK ) << timeinfo.tm_mday << SPACE_SEPARATOR << std::setfill( FILL_VALUE ) << + std::setw( WIDTH_CLOCK ) << timeinfo.tm_hour << TIME_DELIMITER << std::setfill( FILL_VALUE ) << + std::setw( WIDTH_CLOCK ) << timeinfo.tm_min << TIME_DELIMITER << std::setfill( FILL_VALUE ) << + std::setw( WIDTH_CLOCK ) << timeinfo.tm_sec; + return( date_time_stream.str() ); +} + + +} + + +#endif diff --git a/externals/hermes/source/waiter.cpp b/externals/hermes/source/hermes/source/waiter.cpp similarity index 96% rename from externals/hermes/source/waiter.cpp rename to externals/hermes/source/hermes/source/waiter.cpp index ebd8498..9f519a8 100644 --- a/externals/hermes/source/waiter.cpp +++ b/externals/hermes/source/hermes/source/waiter.cpp @@ -1,59 +1,59 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////// -// // -// This file is part of the Seadex hermes library (http://hermes.seadex.de). // -// Copyright( C ) 2017 Seadex GmbH // -// Licensing information is available in the folder "license" which is part of this distribution. // -// The same information is available on the www @ http://hermes.seadex.de/License.html. // -// // -////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef SX_NO_LOGGING - - -#include "hermes/waiter.hpp" - - -namespace hermes -{ - - -waiter::waiter() - : done_mutex_(), - done_condition_variable_(), - done_() -{ - // Nothing to do... -} - - -waiter::~waiter() SX_NOEXCEPT -{ - // Nothing to do... -} - - -void waiter::wait() -{ - sxe::unique_lock lock( done_mutex_ ); - done_condition_variable_.wait( lock, sxe::bind( &waiter::is_done, this ) ); -} - - -void waiter::done() -{ - sxe::lock_guard lock( done_mutex_ ); - done_ = true; -} - - -bool waiter::is_done() -{ - // no locking necessary, only used within wait of condition variable - return( done_ ); -} - - -} - - -#endif +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex hermes library (http://hermes.seadex.de). // +// Copyright( C ) 2017 Seadex GmbH // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://hermes.seadex.de/License.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef SX_NO_LOGGING + + +#include "hermes/waiter.hpp" + + +namespace hermes +{ + + +waiter::waiter() + : done_mutex_(), + done_condition_variable_(), + done_() +{ + // Nothing to do... +} + + +waiter::~waiter() SX_NOEXCEPT +{ + // Nothing to do... +} + + +void waiter::wait() +{ + sxe::unique_lock lock( done_mutex_ ); + done_condition_variable_.wait( lock, sxe::bind( &waiter::is_done, this ) ); +} + + +void waiter::done() +{ + sxe::lock_guard lock( done_mutex_ ); + done_ = true; +} + + +bool waiter::is_done() +{ + // no locking necessary, only used within wait of condition variable + return( done_ ); +} + + +} + + +#endif diff --git a/genesis/changelog.txt b/genesis/changelog.txt deleted file mode 100644 index e46c774..0000000 --- a/genesis/changelog.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Change log -All notable changes to this project are documented in this file. - - -##[0.3.0] - 2017-09-21 - -### Added -• Support for Visual Studio 2017 builds - -### Fixed -• added missing override specifier to template_block::create method - - -##[0.2.0] - 2017-04-24 - -### Added -• C++03 compatibility - - -##[0.1.0] - 2017-04-24 - -• The very first release version of genesis diff --git a/libyasmine/CMakeLists.txt b/libyasmine/CMakeLists.txt index ec87305..d01545d 100644 --- a/libyasmine/CMakeLists.txt +++ b/libyasmine/CMakeLists.txt @@ -8,13 +8,15 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -file(GLOB yasmine_SRC "include/*.hpp" "include_impl/*.hpp" "source/*.cpp" "../externals/essentials/include/essentials/*.hpp" "../externals/essentials/include/essentials/compatibility/*.hpp" "../externals/hermes/include/hermes/*.hpp" "../externals/essentials/source/*.cpp" "../externals/hermes/source/*.cpp") +file(GLOB yasmine_SRC "include/*.hpp" "include_impl/*.hpp" "source/*.cpp") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -include_directories("./include" "./include_impl" "../externals/essentials/include" "../externals/hermes/include") +include_directories("./include" "./include_impl") +include_directories("./../externals/essentials" "./../externals/essentials/source/essentials/include") +include_directories("./../externals/hermes" "./../externals/hermes/source/hermes/include") include(./../CMakeHelpers/addSpecificFlags.cmake) include(./../CMakeHelpers/addYasmineOptions.cmake) @@ -27,6 +29,18 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_library(libyasmine STATIC ${yasmine_SRC}) endif() +set(link_libraries_list "") +use_pthread(link_libraries_list) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library_for_linking(link_libraries_list libessentials) + add_library_for_linking(link_libraries_list libhermes) +else() + add_library_for_linking(link_libraries_list essentials) + add_library_for_linking(link_libraries_list hermes) +endif() +message(STATUS "libyasmine linking to libraries: ${link_libraries_list}" ) +target_link_libraries(libyasmine LINK_PUBLIC ${link_libraries_list}) + SET_TARGET_PROPERTIES ( libyasmine PROPERTIES VERSION 1.3.1 SOVERSION 1.3 ) diff --git a/libyasmine/changelog.txt b/libyasmine/changelog.txt index 4fb16ec..b90ecfe 100644 --- a/libyasmine/changelog.txt +++ b/libyasmine/changelog.txt @@ -1,6 +1,19 @@ # Change log All notable changes to this project are documented in this file. +##[1.3.4] - 2017-12-18 + +### Added +• (C++03) BOOST_BIND_OVER_9 - removes the limit of 7 methods/free functions as parameters for creating behaviors/guards using the assembly macros. The limit is because of boost::bind limitation to 9 arguments. +• (C++11) Y_BEHAVIOR_FREE_ACTION macro for using a free function as a behavior +• (C++11) Y_GUARD_FREE_ACTION macro for using a free function as guard + +### Changed +• Y_INVALID_EVENT_CREATION_REQUEST_HANDLE is now „external“ +• use essentials and hermes as libraries +• CMake: Adapt to use essentials and hermes as libraries. Applies to examples as well. + + ##[1.3.3] - 2017-11-10 ### Added @@ -357,4 +370,4 @@ and Y_EVENT_1PARAM_WITH_ID_PRIORITY to Y_EVENT_10PARAM_WITH_ID_PRIORITY) ##[0.1.0] - 2016-06-20 -• The very first released version of yasmine \ No newline at end of file +• The very first released version of yasmine diff --git a/libyasmine/include/assembly_common.hpp b/libyasmine/include/assembly_common.hpp index 1d2500a..024e831 100644 --- a/libyasmine/include/assembly_common.hpp +++ b/libyasmine/include/assembly_common.hpp @@ -34,9 +34,18 @@ #define Y_BEHAVIOR_METHOD2_SELECT_5( _object, _method1, _method2, _method3, _method4, _method5 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ) ) #define Y_BEHAVIOR_METHOD2_SELECT_6( _object, _method1, _method2, _method3, _method4, _method5, _method6 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ) ) #define Y_BEHAVIOR_METHOD2_SELECT_7( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ) ) -#define Y_BEHAVIOR_METHOD2_SELECT_8( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ) ) -#define Y_BEHAVIOR_METHOD2_SELECT_9( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ) ) -#define Y_BEHAVIOR_METHOD2_SELECT_10( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9, _method10 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ), sxy::adapt( _object, _method10 ) ) + +#ifndef SX_CPP03_BOOST + #define Y_BEHAVIOR_METHOD2_SELECT_8( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ) ) + #define Y_BEHAVIOR_METHOD2_SELECT_9( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ) ) + #define Y_BEHAVIOR_METHOD2_SELECT_10( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9, _method10 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ), sxy::adapt( _object, _method10 ) ) +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_BEHAVIOR_METHOD2_SELECT_8( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ) ) + #define Y_BEHAVIOR_METHOD2_SELECT_9( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ) ) + #define Y_BEHAVIOR_METHOD2_SELECT_10( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9, _method10 ) sxy::create_behavior_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ), sxy::adapt( _object, _method10 ) ) + #endif +#endif #define Y_GUARD_METHOD2_SELECT_1( _object, _method ) sxy::create_guard_function( sxy::adapt( _object, _method ) ) @@ -46,9 +55,17 @@ #define Y_GUARD_METHOD2_SELECT_5( _object, _method1, _method2, _method3, _method4, _method5 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ) ) #define Y_GUARD_METHOD2_SELECT_6( _object, _method1, _method2, _method3, _method4, _method5, _method6 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ) ) #define Y_GUARD_METHOD2_SELECT_7( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ) ) -#define Y_GUARD_METHOD2_SELECT_8( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ) ) -#define Y_GUARD_METHOD2_SELECT_9( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ) ) -#define Y_GUARD_METHOD2_SELECT_10( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9, _method10 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ), sxy::adapt( _object, _method10 ) ) +#ifndef SX_CPP03_BOOST + #define Y_GUARD_METHOD2_SELECT_8( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ) ) + #define Y_GUARD_METHOD2_SELECT_9( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ) ) + #define Y_GUARD_METHOD2_SELECT_10( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9, _method10 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ), sxy::adapt( _object, _method10 ) ) +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_GUARD_METHOD2_SELECT_8( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ) ) + #define Y_GUARD_METHOD2_SELECT_9( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ) ) + #define Y_GUARD_METHOD2_SELECT_10( _object, _method1, _method2, _method3, _method4, _method5, _method6, _method7, _method8, _method9, _method10 ) sxy::create_guard_function( sxy::adapt( _object, _method1 ), sxy::adapt( _object, _method2 ), sxy::adapt( _object, _method3 ), sxy::adapt( _object, _method4 ), sxy::adapt( _object, _method5 ), sxy::adapt( _object, _method6 ), sxy::adapt( _object, _method7 ), sxy::adapt( _object, _method8 ), sxy::adapt( _object, _method9 ), sxy::adapt( _object, _method10 ) ) + #endif +#endif #define Y_BEHAVIOR_FUNCTION2_SELECT_1( _function ) sxy::create_behavior_function( sxy::adapt_function( _function ) ) @@ -58,9 +75,17 @@ #define Y_BEHAVIOR_FUNCTION2_SELECT_5( _function1, _function2, _function3, _function4, _function5 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ) ) #define Y_BEHAVIOR_FUNCTION2_SELECT_6( _function1, _function2, _function3, _function4, _function5, _function6 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ) ) #define Y_BEHAVIOR_FUNCTION2_SELECT_7( _function1, _function2, _function3, _function4, _function5, _function6, _function7 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ) ) -#define Y_BEHAVIOR_FUNCTION2_SELECT_8( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ) ) -#define Y_BEHAVIOR_FUNCTION2_SELECT_9( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ) ) -#define Y_BEHAVIOR_FUNCTION2_SELECT_10( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9, _function10 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ), sxy::adapt_function( _function10 ) ) +#ifndef SX_CPP03_BOOST + #define Y_BEHAVIOR_FUNCTION2_SELECT_8( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ) ) + #define Y_BEHAVIOR_FUNCTION2_SELECT_9( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ) ) + #define Y_BEHAVIOR_FUNCTION2_SELECT_10( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9, _function10 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ), sxy::adapt_function( _function10 ) ) +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_BEHAVIOR_FUNCTION2_SELECT_8( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ) ) + #define Y_BEHAVIOR_FUNCTION2_SELECT_9( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ) ) + #define Y_BEHAVIOR_FUNCTION2_SELECT_10( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9, _function10 ) sxy::create_behavior_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ), sxy::adapt_function( _function10 ) ) + #endif +#endif #define Y_GUARD_FUNCTION2_SELECT_1( _function ) sxy::create_guard_function( sxy::adapt_function( _function ) ) @@ -70,9 +95,17 @@ #define Y_GUARD_FUNCTION2_SELECT_5( _function1, _function2, _function3, _function4, _function5 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ) ) #define Y_GUARD_FUNCTION2_SELECT_6( _function1, _function2, _function3, _function4, _function5, _function6 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ) ) #define Y_GUARD_FUNCTION2_SELECT_7( _function1, _function2, _function3, _function4, _function5, _function6, _function7 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ) ) -#define Y_GUARD_FUNCTION2_SELECT_8( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ) ) -#define Y_GUARD_FUNCTION2_SELECT_9( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ) ) -#define Y_GUARD_FUNCTION2_SELECT_10( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9, _function10 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ), sxy::adapt_function( _function10 ) ) +#ifndef SX_CPP03_BOOST + #define Y_GUARD_FUNCTION2_SELECT_8( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ) ) + #define Y_GUARD_FUNCTION2_SELECT_9( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ) ) + #define Y_GUARD_FUNCTION2_SELECT_10( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9, _function10 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ), sxy::adapt_function( _function10 ) ) +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_GUARD_FUNCTION2_SELECT_8( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ) ) + #define Y_GUARD_FUNCTION2_SELECT_9( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ) ) + #define Y_GUARD_FUNCTION2_SELECT_10( _function1, _function2, _function3, _function4, _function5, _function6, _function7, _function8, _function9, _function10 ) sxy::create_guard_function( sxy::adapt_function( _function1 ), sxy::adapt_function( _function2 ), sxy::adapt_function( _function3 ), sxy::adapt_function( _function4 ), sxy::adapt_function( _function5 ), sxy::adapt_function( _function6 ), sxy::adapt_function( _function7 ), sxy::adapt_function( _function8 ), sxy::adapt_function( _function9 ), sxy::adapt_function( _function10 ) ) + #endif +#endif #define Y_BEHAVIOR_METHOD2_1 Y_BEHAVIOR_METHOD2_SELECT_1 @@ -82,9 +115,17 @@ #define Y_BEHAVIOR_METHOD2_5 Y_BEHAVIOR_METHOD2_SELECT_5 #define Y_BEHAVIOR_METHOD2_6 Y_BEHAVIOR_METHOD2_SELECT_6 #define Y_BEHAVIOR_METHOD2_7 Y_BEHAVIOR_METHOD2_SELECT_7 -#define Y_BEHAVIOR_METHOD2_8 Y_BEHAVIOR_METHOD2_SELECT_8 -#define Y_BEHAVIOR_METHOD2_9 Y_BEHAVIOR_METHOD2_SELECT_9 -#define Y_BEHAVIOR_METHOD2_10 Y_BEHAVIOR_METHOD2_SELECT_10 +#ifndef SX_CPP03_BOOST + #define Y_BEHAVIOR_METHOD2_8 Y_BEHAVIOR_METHOD2_SELECT_8 + #define Y_BEHAVIOR_METHOD2_9 Y_BEHAVIOR_METHOD2_SELECT_9 + #define Y_BEHAVIOR_METHOD2_10 Y_BEHAVIOR_METHOD2_SELECT_10 +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_BEHAVIOR_METHOD2_8 Y_BEHAVIOR_METHOD2_SELECT_8 + #define Y_BEHAVIOR_METHOD2_9 Y_BEHAVIOR_METHOD2_SELECT_9 + #define Y_BEHAVIOR_METHOD2_10 Y_BEHAVIOR_METHOD2_SELECT_10 + #endif +#endif #define Y_GUARD_METHOD2_1 Y_GUARD_METHOD2_SELECT_1 @@ -94,9 +135,17 @@ #define Y_GUARD_METHOD2_5 Y_GUARD_METHOD2_SELECT_5 #define Y_GUARD_METHOD2_6 Y_GUARD_METHOD2_SELECT_6 #define Y_GUARD_METHOD2_7 Y_GUARD_METHOD2_SELECT_7 -#define Y_GUARD_METHOD2_8 Y_GUARD_METHOD2_SELECT_8 -#define Y_GUARD_METHOD2_9 Y_GUARD_METHOD2_SELECT_9 -#define Y_GUARD_METHOD2_10 Y_GUARD_METHOD2_SELECT_10 +#ifndef SX_CPP03_BOOST + #define Y_GUARD_METHOD2_8 Y_GUARD_METHOD2_SELECT_8 + #define Y_GUARD_METHOD2_9 Y_GUARD_METHOD2_SELECT_9 + #define Y_GUARD_METHOD2_10 Y_GUARD_METHOD2_SELECT_10 +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_GUARD_METHOD2_8 Y_GUARD_METHOD2_SELECT_8 + #define Y_GUARD_METHOD2_9 Y_GUARD_METHOD2_SELECT_9 + #define Y_GUARD_METHOD2_10 Y_GUARD_METHOD2_SELECT_10 + #endif +#endif #define Y_BEHAVIOR_FUNCTION2_1 Y_BEHAVIOR_FUNCTION2_SELECT_1 @@ -106,9 +155,17 @@ #define Y_BEHAVIOR_FUNCTION2_5 Y_BEHAVIOR_FUNCTION2_SELECT_5 #define Y_BEHAVIOR_FUNCTION2_6 Y_BEHAVIOR_FUNCTION2_SELECT_6 #define Y_BEHAVIOR_FUNCTION2_7 Y_BEHAVIOR_FUNCTION2_SELECT_7 -#define Y_BEHAVIOR_FUNCTION2_8 Y_BEHAVIOR_FUNCTION2_SELECT_8 -#define Y_BEHAVIOR_FUNCTION2_9 Y_BEHAVIOR_FUNCTION2_SELECT_9 -#define Y_BEHAVIOR_FUNCTION2_10 Y_BEHAVIOR_FUNCTION2_SELECT_10 +#ifndef SX_CPP03_BOOST + #define Y_BEHAVIOR_FUNCTION2_8 Y_BEHAVIOR_FUNCTION2_SELECT_8 + #define Y_BEHAVIOR_FUNCTION2_9 Y_BEHAVIOR_FUNCTION2_SELECT_9 + #define Y_BEHAVIOR_FUNCTION2_10 Y_BEHAVIOR_FUNCTION2_SELECT_10 +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_BEHAVIOR_FUNCTION2_8 Y_BEHAVIOR_FUNCTION2_SELECT_8 + #define Y_BEHAVIOR_FUNCTION2_9 Y_BEHAVIOR_FUNCTION2_SELECT_9 + #define Y_BEHAVIOR_FUNCTION2_10 Y_BEHAVIOR_FUNCTION2_SELECT_10 + #endif +#endif #define Y_GUARD_FUNCTION2_1 Y_GUARD_FUNCTION2_SELECT_1 @@ -118,9 +175,17 @@ #define Y_GUARD_FUNCTION2_5 Y_GUARD_FUNCTION2_SELECT_5 #define Y_GUARD_FUNCTION2_6 Y_GUARD_FUNCTION2_SELECT_6 #define Y_GUARD_FUNCTION2_7 Y_GUARD_FUNCTION2_SELECT_7 -#define Y_GUARD_FUNCTION2_8 Y_GUARD_FUNCTION2_SELECT_8 -#define Y_GUARD_FUNCTION2_9 Y_GUARD_FUNCTION2_SELECT_9 -#define Y_GUARD_FUNCTION2_10 Y_GUARD_FUNCTION2_SELECT_10 +#ifndef SX_CPP03_BOOST + #define Y_GUARD_FUNCTION2_8 Y_GUARD_FUNCTION2_SELECT_8 + #define Y_GUARD_FUNCTION2_9 Y_GUARD_FUNCTION2_SELECT_9 + #define Y_GUARD_FUNCTION2_10 Y_GUARD_FUNCTION2_SELECT_10 +#else + #ifdef BOOST_BIND_OVER_9 + #define Y_GUARD_FUNCTION2_8 Y_GUARD_FUNCTION2_SELECT_8 + #define Y_GUARD_FUNCTION2_9 Y_GUARD_FUNCTION2_SELECT_9 + #define Y_GUARD_FUNCTION2_10 Y_GUARD_FUNCTION2_SELECT_10 + #endif +#endif #endif // include guard diff --git a/libyasmine/include/assembly_cpp11.hpp b/libyasmine/include/assembly_cpp11.hpp index 394406e..b9dbfd8 100644 --- a/libyasmine/include/assembly_cpp11.hpp +++ b/libyasmine/include/assembly_cpp11.hpp @@ -21,27 +21,21 @@ #include "essentials/macro_helpers.hpp" -//!\brief Macro for using any type of action as a behavior. -#define Y_BEHAVIOR_ACTION( ... ) EXPAND( VA_SELECT( Y_BEHAVIOR_ACTION_SELECT, __VA_ARGS__ ) ) +//!\brief Macro for using a method as a behavior. +#define Y_BEHAVIOR_ACTION( _action ) \ + sxy::behavior_function( [this]( const sxy::event& _event, sxy::event_collector& _event_collector ){ SX_UNUSED_PARAMETER( _event ); SX_UNUSED_PARAMETER( _event_collector ); _action } ) -//!\brief Macro for using any type of action returning bool as a guard. -#define Y_GUARD_ACTION( ... ) EXPAND( VA_SELECT( Y_GUARD_ACTION_SELECT, __VA_ARGS__ ) ) - -//!\brief Macro for using any type of action as a behavior. -#define Y_BEHAVIOR_ACTION_SELECT_1( _action ) \ - sxy::behavior_function( [ this ]( const sxy::event& _event ){ SX_UNUSED_PARAMETER(_event); _action } ) - -//!\brief Macro for using any type of action as a behavior. -#define Y_BEHAVIOR_ACTION_SELECT_2( _class_name, _action ) \ - sxy::behavior_function( [ this ]( const sxy::event& _event ){ SX_UNUSED_PARAMETER(_event); _action } ) +//!\brief Macro for using a free function as a behavior. +#define Y_BEHAVIOR_FREE_ACTION( _action ) \ + sxy::behavior_function( []( const sxy::event& _event, sxy::event_collector& _event_collector ){ SX_UNUSED_PARAMETER( _event ); SX_UNUSED_PARAMETER( _event_collector ); _action } ) -//!\brief Macro for using any type of action returning bool as a guard. -#define Y_GUARD_ACTION_SELECT_1( _action ) \ - sxy::constraint_function( [ this ]( const sxy::event& _event ){ SX_UNUSED_PARAMETER(_event); _action } ) +//!\brief Macro for using a method as a guard. +#define Y_GUARD_ACTION( _action ) \ + sxy::constraint_function( [ this ]( const sxy::event& _event, sxy::event_collector& _event_collector ){ SX_UNUSED_PARAMETER(_event); SX_UNUSED_PARAMETER( _event_collector ); _action } ) -//!\brief Macro for using any type of action returning bool as a guard. -#define Y_GUARD_ACTION_SELECT_2( _class_name, _action ) \ - sxy::constraint_function( [ this ]( const sxy::event& _event ){ SX_UNUSED_PARAMETER(_event); _action } ) +//!\brief Macro for using a free function as a guard. +#define Y_GUARD_FREE_ACTION( _action ) \ + sxy::constraint_function( []( const sxy::event& _event, sxy::event_collector& _event_collector ){ SX_UNUSED_PARAMETER(_event); SX_UNUSED_PARAMETER( _event_collector ); _action } ) // Macros for passing handlers as behavior diff --git a/libyasmine/include/async_state_machine.hpp b/libyasmine/include/async_state_machine.hpp index e2f892b..aa06975 100644 --- a/libyasmine/include/async_state_machine.hpp +++ b/libyasmine/include/async_state_machine.hpp @@ -38,7 +38,7 @@ class async_state_machine SX_FINAL: //!\param _name Name of the state machine. //!\param _event_processing_callback Event processing callback interface pointer. It can be a nullptr if no callback //!interface should be used. - explicit async_state_machine( const std::string& _name, + explicit async_state_machine( const std::string& _name, event_processing_callback* const _event_processing_callback = SX_NULLPTR ); virtual ~async_state_machine() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY(async_state_machine) @@ -50,7 +50,7 @@ class async_state_machine SX_FINAL: //!Firing the event enqueues the event for being processed. virtual bool fire_event( const event_sptr& _event ) SX_OVERRIDE; - //!\brief Starts the state machine. When starting the state machine, the initial transitions are searched and + //!\brief Starts the state machine. When starting the state machine, the initial transitions are searched and //!executed. Without running the state machine, it is not possible to fire events. //!\return If the state machine reaches a terminate pseudostate after starting (on calling run), returns false. Else //!if the state machine is started and running, returns true. @@ -60,7 +60,7 @@ class async_state_machine SX_FINAL: //!\brief Stops and joins the state machine. When stopping the state machine, all the events remaining in the queue //!of events will be processed and the event processing thread will be then stopped and joined. The state machine //!will also check for active asynchronous simple states and will stop the do behavior for all of them. - //!\return void + //!\return void //!\sa halt, join, run void halt_and_join(); @@ -80,16 +80,16 @@ class async_state_machine SX_FINAL: //!\brief Waiting given amount of time for the state machine to terminate (or to stop). //!\param _timeoutInMs Time in milliseconds to wait for the state machine to terminate. //!\return bool true if the state machine is terminated or stopped, false otherwise. - //!\sa halt_and_join, halt, run, wait + //!\sa halt_and_join, halt, run, wait bool wait( const sxe::milliseconds _timeoutInMs ) const; - //!\brief Wait for the machine to terminate (or to stop). + //!\brief Wait for the machine to terminate (or to stop). //!\return void //!\sa halt_and_join, halt, run, wait void wait() const; //!\brief Check if the state machine is terminated or stopped. - //!\return bool true if the state machine is terminated or stopped, false otherwise. + //!\return bool true if the state machine is terminated or stopped, false otherwise. //!\sa halt_and_join, halt, run, wait bool terminated() const; @@ -106,17 +106,16 @@ class async_state_machine SX_FINAL: void start_state_machine(); -private: - bool insert( const event_sptr& _event ); +private: + bool insert( const event_sptr& _event ); void insert_impl( const event_sptr& _event ); bool wait_predicate() const; bool wait_stop_condition() const; - void work(); - + void work(); + //!\brief Sends a priority (internal) event and add it in the front of the event list, so it will be processed before other events. //!\return void virtual void on_event( const event_sptr& _event ) SX_OVERRIDE; - virtual void interrupt_impl() SX_OVERRIDE; diff --git a/libyasmine/include/event_handle.hpp b/libyasmine/include/event_handle.hpp index 3f2e0b2..bb55577 100644 --- a/libyasmine/include/event_handle.hpp +++ b/libyasmine/include/event_handle.hpp @@ -22,16 +22,11 @@ namespace sxy { - //!\brief The type alias for yasmine's event handle. - typedef sxe::uint32_t handle_type; +//!\brief The type alias for yasmine's event handle. +typedef sxe::uint32_t handle_type; -#ifndef SX_CPP03_BOOST - extern const handle_type Y_INVALID_EVENT_CREATION_REQUEST_HANDLE; -#else - #define Y_INVALID_EVENT_CREATION_REQUEST_HANDLE UINT_MAX -#endif - - extern const handle_type Y_DEFAULT_HANDLE; +extern const handle_type Y_INVALID_EVENT_CREATION_REQUEST_HANDLE; +extern const handle_type Y_DEFAULT_HANDLE; } diff --git a/libyasmine/include/event_template.hpp b/libyasmine/include/event_template.hpp index dcf70fc..b4a1467 100644 --- a/libyasmine/include/event_template.hpp +++ b/libyasmine/include/event_template.hpp @@ -104,7 +104,7 @@ public: \ //!\param _class_name Name of the event class. //!\param _event_id Event's id. #define Y_EVENT_WITH_ID( _class_name, _event_id ) Y_EVENT_WITH_ID_PRIORITY( _class_name, _event_id, Y_AUX_DEFAULT_EVENT_PRIORITY ) - + //!\brief Macro for creating an event class that inherits the specialized_event. The event has an ID, a priority and a given type parameter. //!\param _class_name Name of the event class. diff --git a/libyasmine/include/simple_state_base.hpp b/libyasmine/include/simple_state_base.hpp index 2b9ab90..46b77f8 100644 --- a/libyasmine/include/simple_state_base.hpp +++ b/libyasmine/include/simple_state_base.hpp @@ -27,7 +27,7 @@ class simple_state_base: public: - simple_state_base( const std::string& _name, behavior_uptr _entry_action, behavior_uptr _exit_action, + simple_state_base( const std::string& _name, behavior_uptr _entry_action, behavior_uptr _exit_action, const event_ids& _deferred_events, event_sptr _error_event ); virtual ~simple_state_base() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY(simple_state_base) @@ -36,7 +36,7 @@ class simple_state_base: virtual void accept_vertex_visitor( const_vertex_visitor& _visitor ) const SX_OVERRIDE; virtual void accept_vertex_visitor( vertex_visitor& _visitor ) SX_OVERRIDE; virtual void accept_complex_state_visitor( complex_state_visitor& _visitor ) const SX_OVERRIDE; - virtual void accept_state_visitor( state_visitor& _visitor ) const SX_OVERRIDE; + virtual void accept_state_visitor( state_visitor& _visitor ) const SX_OVERRIDE; virtual bool check( state_machine_defects& _defects ) const SX_OVERRIDE; virtual bool has_error_event() const SX_OVERRIDE; virtual event_sptr get_error_event() const SX_OVERRIDE; diff --git a/libyasmine/include/state_machine_base.hpp b/libyasmine/include/state_machine_base.hpp index 76c9b66..d6c47f1 100644 --- a/libyasmine/include/state_machine_base.hpp +++ b/libyasmine/include/state_machine_base.hpp @@ -166,7 +166,6 @@ namespace sxy //!\return A reference to the newly created transition. virtual transition& add_transition( const event_ids& _event_ids, vertex& _source, vertex& _target, const behavior_function& _behavior, const sxy::transition_kind _kind = transition_kind::EXTERNAL ); - virtual bool fire_event( const event_sptr& _event ) = 0; //!\brief Check the state machine for defects by checking the constraints of each component. @@ -211,9 +210,7 @@ namespace sxy private: virtual const events& get_deferred_events() const SX_OVERRIDE; - public: virtual raw_const_states get_active_state_configuration() const SX_OVERRIDE; - private: void get_active_states_from_region( raw_const_states& _active_state_configuration, const region& _region ) const; void check_regions_for_active_states( raw_const_states& _active_state_configuration, const state& _state ) const; void add_deferred_event( const event_sptr& _event_id ); diff --git a/libyasmine/include_impl/build_number.hpp b/libyasmine/include_impl/build_number.hpp index 24beab9..8b7c2da 100644 --- a/libyasmine/include_impl/build_number.hpp +++ b/libyasmine/include_impl/build_number.hpp @@ -24,7 +24,7 @@ namespace version { -const sxe::uint16_t BUILD_NUMBER( 810 ); +const sxe::uint16_t BUILD_NUMBER( 850 ); } diff --git a/libyasmine/libyasmine.vcxproj b/libyasmine/libyasmine.vcxproj index d2c78c2..51ddbab 100644 --- a/libyasmine/libyasmine.vcxproj +++ b/libyasmine/libyasmine.vcxproj @@ -83,42 +83,6 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -298,23 +262,6 @@ - - - - - - - - - - - - - - - - - diff --git a/libyasmine/libyasmine.vcxproj.filters b/libyasmine/libyasmine.vcxproj.filters index 42712f3..b43a800 100644 --- a/libyasmine/libyasmine.vcxproj.filters +++ b/libyasmine/libyasmine.vcxproj.filters @@ -121,27 +121,6 @@ {300a4103-75a9-433d-8fb0-a35791d8b2f5} - - {89ff470c-dd9c-4284-bc52-275caa35c0d5} - - - {0dc53fda-1061-474b-8825-e13872f8ddca} - - - {913833e0-01d4-48dd-8653-e64e51a760ab} - - - {19cda7e2-3e79-406b-b75f-5317e322840d} - - - {545fa18b-8716-46ed-a927-815ac91d2529} - - - {7ac2a40a-81b8-48a6-aeca-8d3c40566748} - - - {fc016843-b9e5-4795-bd00-2638aa1487cf} - {313d08d9-3c57-469d-918d-6dd8155e00e9} @@ -582,117 +561,9 @@ Headerdateien\infrastructure - - Headerdateien\external\essentials\compatibility - - - Headerdateien\external\essentials\compatibility - - - Headerdateien\external\essentials\compatibility - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - Headerdateien\infrastructure - - Headerdateien\external\essentials - - - Headerdateien\external\essentials - - - Headerdateien\external\hermes - - - Headerdateien\external\hermes - - - Headerdateien\external\essentials - - - Headerdateien\external\essentials\compatibility - - - Headerdateien\external\hermes - Headerdateien\infrastructure @@ -914,57 +785,6 @@ Quelldateien\core\state machine - - Quelldateien\external\essentials - - - Quelldateien\external\essentials - - - Quelldateien\external\essentials - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\hermes - - - Quelldateien\external\essentials - - - Quelldateien\external\hermes - - - Quelldateien\external\essentials - Quelldateien\core\state machine diff --git a/libyasmine/source/event_handle.cpp b/libyasmine/source/event_handle.cpp index 572d962..5ed3976 100644 --- a/libyasmine/source/event_handle.cpp +++ b/libyasmine/source/event_handle.cpp @@ -14,11 +14,15 @@ namespace sxy { - -#ifndef SX_CPP03_BOOST + + +#ifdef SX_CPP03_BOOST + const handle_type Y_INVALID_EVENT_CREATION_REQUEST_HANDLE = UINT_MAX; +#else const handle_type Y_INVALID_EVENT_CREATION_REQUEST_HANDLE = std::numeric_limits< handle_type >::max(); #endif - const handle_type Y_DEFAULT_HANDLE = 0; +const handle_type Y_DEFAULT_HANDLE = 0; + } diff --git a/libyasmine/source/version.cpp b/libyasmine/source/version.cpp index a4f4822..1233df1 100644 --- a/libyasmine/source/version.cpp +++ b/libyasmine/source/version.cpp @@ -28,7 +28,7 @@ namespace const sxe::uint16_t VERSION_MAJOR( 1 ); const sxe::uint16_t VERSION_MINOR( 3 ); -const sxe::uint16_t VERSION_PATCH( 3 ); +const sxe::uint16_t VERSION_PATCH( 4 ); } @@ -37,6 +37,7 @@ const sxe::uint16_t VERSION_PATCH( 3 ); #ifndef SX_NO_LOGGING +// cppcheck-suppress unusedFunction void log_version() { SX_LOG( hermes::log_level::LL_INFO, "yasmine library version %.%.%.%.", get_major_version(), diff --git a/libygen/CMakeLists.txt b/libygen/CMakeLists.txt index bddd971..bc73b4d 100644 --- a/libygen/CMakeLists.txt +++ b/libygen/CMakeLists.txt @@ -20,10 +20,10 @@ include(./../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") include_directories("./include") -include_directories("./../libyasmine" "./../genesis" "./../yasmine_model") -include_directories("./../libyasmine/include" "./../genesis/include" "./../yasmine_model/include") -include_directories("./../externals/essentials/include") - +include_directories("./../libyasmine/include") +include_directories("./../yasmine_model/include") +include_directories("./../externals/essentials/source/essentials/include") +include_directories("./../externals/genesis/source/genesis/include") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") @@ -39,9 +39,19 @@ if("${CPP_VERSION}" STREQUAL "03") endif() use_pthread(link_libraries_list) + add_library_for_linking(link_libraries_list libyasmine) -add_library_for_linking(link_libraries_list libgenesis) -add_library_for_linking(link_libraries_list libyasmine_model) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library_for_linking(link_libraries_list libessentials) + add_library_for_linking(link_libraries_list libgenesis) + add_library_for_linking(link_libraries_list libyasmine_model) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library_for_linking(link_libraries_list essentials) + add_library_for_linking(link_libraries_list genesis) + add_library_for_linking(link_libraries_list yasmine_model) +endif() + message(STATUS "libygen linking to libraries: ${link_libraries_list}" ) target_link_libraries(libygen LINK_PUBLIC ${link_libraries_list}) diff --git a/libygen/changelog.txt b/libygen/changelog.txt index 526b851..7cc076e 100644 --- a/libygen/changelog.txt +++ b/libygen/changelog.txt @@ -1,6 +1,14 @@ # Change log All notable changes to this project are documented in this file. +##[0.1.3] - 2017-12-18 + +### Changed +• use essentials as library +• CMake: use external CMakeHelpers files +• CMake: refactoring of build scripts + + ##[0.1.0] - 2017-04-24 -• The very first released version of libygen \ No newline at end of file +• The very first released version of libygen diff --git a/libygen/include/libygen_build_number.hpp b/libygen/include/libygen_build_number.hpp index 8b1863c..9bcfefa 100644 --- a/libygen/include/libygen_build_number.hpp +++ b/libygen/include/libygen_build_number.hpp @@ -24,7 +24,7 @@ namespace version { - const sxe::uint16_t BUILD_NUMBER( 810 ); + const sxe::uint16_t BUILD_NUMBER( 850 ); } diff --git a/libygen/source/libygen_version.cpp b/libygen/source/libygen_version.cpp index de9d145..70f8472 100644 --- a/libygen/source/libygen_version.cpp +++ b/libygen/source/libygen_version.cpp @@ -31,8 +31,8 @@ namespace const sxe::uint16_t VERSION_MAJOR( 0 ); -const sxe::uint16_t VERSION_MINOR( 2 ); -const sxe::uint16_t VERSION_PATCH( 1 ); +const sxe::uint16_t VERSION_MINOR( 1 ); +const sxe::uint16_t VERSION_PATCH( 3 ); } diff --git a/libygen/source/recipe_callback_impl.cpp b/libygen/source/recipe_callback_impl.cpp index 2b076ff..8fe72e9 100644 --- a/libygen/source/recipe_callback_impl.cpp +++ b/libygen/source/recipe_callback_impl.cpp @@ -24,7 +24,7 @@ #include "composite_state_model_impl.hpp" #include "region_model.hpp" #include "state_model_impl.hpp" -#include "pseudostate_model.hpp" +#include "pseudostate_model_impl.hpp" namespace sxy @@ -534,7 +534,7 @@ std::string recipe_callback_impl::get_pseudostate_property( const std::string& _ { std::string result( "" ); const sxy::model::region_model* region_to_check = regions_stack_.top(); - const sxy::model::pseudostate_model* pseudostate = region_to_check->get_pseudostates()[pseudostate_index_]; + const sxy::model::pseudostate_model_impl* pseudostate = region_to_check->get_pseudostates()[pseudostate_index_]; if( pseudostate_index_ < region_to_check->get_pseudostates().size() ) { if( _property == VARIABLE_PSEUDOSTATE_NAME ) @@ -589,20 +589,18 @@ std::string recipe_callback_impl::get_event_property( const std::string& _proper std::string result( "" ); if( event_index_ < state_machine_model_.get_events().size() ) { - //const sxy::model::state_machine_model::events& events_ = state_machine_model_.get_events(); - //const auto ev = events_[event_index_]; - sxy::model::event_model event = state_machine_model_.get_events()[event_index_]; + sxy::model::event_sptr event = state_machine_model_.get_events()[event_index_]; if( _property == VARIABLE_EVENT_ID ) { - result = sxe::to_string( event.id ); + result = sxe::to_string( event->get_id() ); } else if( _property == VARIABLE_EVENT_NAME ) { - result = event.name; + result = event->get_name(); } else if( _property == VARIABLE_EVENT_PRIORITY ) { - result = sxe::to_string( event.priority ); + result = sxe::to_string( event->get_priority() ); } else { diff --git a/version.txt b/version.txt index a4689ae..765b833 100644 --- a/version.txt +++ b/version.txt @@ -1,5 +1,15 @@ Versions +• yasmine 1.5.0 released 2017-12-18 + • libyasmine 1.3.4 + • essentials 1.3.2 + • hermes 1.2.0 + • genesis 0.3.2 + • yasmine_model 0.2.0 + • libygen 0.1.3 + • ygen 0.1.5 + + • yasmine 1.4.3 released 2017-11-10 • libyasmine 1.3.3 • essentials 1.3.1 diff --git a/yasmine.sln b/yasmine.sln index c957089..cd88e38 100644 --- a/yasmine.sln +++ b/yasmine.sln @@ -1,9 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26730.16 +VisualStudioVersion = 15.0.27130.2010 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libyasmine", "libyasmine\libyasmine.vcxproj", "{A728DDFB-BE51-49B5-8593-4E89E024A500}" + ProjectSection(ProjectDependencies) = postProject + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} = {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hello_yasmine", "examples\hello_yasmine\hello_yasmine.vcxproj", "{C231C585-F237-4F08-8BF5-8DC7106599D4}" ProjectSection(ProjectDependencies) = postProject @@ -74,8 +78,10 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "model", "model", "{68F3A738-05B2-48AE-AF75-B8E9FE63660E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yasmine_model", "yasmine_model\yasmine_model.vcxproj", "{2069AE83-AE26-484A-A6E7-E872E0045020}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genesis", "genesis\genesis.vcxproj", "{466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}" + ProjectSection(ProjectDependencies) = postProject + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} = {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libygen", "libygen\libygen.vcxproj", "{CED23388-105D-46FA-9EC3-AD923C209AED}" ProjectSection(ProjectDependencies) = postProject @@ -85,6 +91,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libygen", "libygen\libygen. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ygen", "ygen\ygen.vcxproj", "{E70CC0C5-256B-41E2-A852-B1904C2D84D3}" ProjectSection(ProjectDependencies) = postProject + {2069AE83-AE26-484A-A6E7-E872E0045020} = {2069AE83-AE26-484A-A6E7-E872E0045020} {CED23388-105D-46FA-9EC3-AD923C209AED} = {CED23388-105D-46FA-9EC3-AD923C209AED} EndProjectSection EndProject @@ -114,6 +121,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unhandled_event_handler_exa {A728DDFB-BE51-49B5-8593-4E89E024A500} = {A728DDFB-BE51-49B5-8593-4E89E024A500} EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "externals", "externals", "{102C094E-DCBA-46DF-ABCC-7A29380154D4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "essentials", "externals\essentials\source\essentials\essentials.vcxproj", "{132F81F8-46DA-49D0-9071-D70BC087B38C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hermes", "externals\hermes\source\hermes\hermes.vcxproj", "{392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}" + ProjectSection(ProjectDependencies) = postProject + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genesis", "externals\genesis\source\genesis\genesis.vcxproj", "{466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}" + ProjectSection(ProjectDependencies) = postProject + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} = {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {132F81F8-46DA-49D0-9071-D70BC087B38C} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug - C++ 03|Win32 = Debug - C++ 03|Win32 @@ -197,6 +219,7 @@ Global {C231C585-F237-4F08-8BF5-8DC7106599D4}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 {C231C585-F237-4F08-8BF5-8DC7106599D4}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 {C231C585-F237-4F08-8BF5-8DC7106599D4}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {C231C585-F237-4F08-8BF5-8DC7106599D4}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 {C231C585-F237-4F08-8BF5-8DC7106599D4}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 {C231C585-F237-4F08-8BF5-8DC7106599D4}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 {C231C585-F237-4F08-8BF5-8DC7106599D4}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 @@ -457,46 +480,6 @@ Global {2069AE83-AE26-484A-A6E7-E872E0045020}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 {2069AE83-AE26-484A-A6E7-E872E0045020}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 {2069AE83-AE26-484A-A6E7-E872E0045020}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|Win32.ActiveCfg = Debug - Clang|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|Win32.Build.0 = Debug - Clang|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|x64.ActiveCfg = Debug - Clang|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|x64.Build.0 = Debug - Clang|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|Win32.ActiveCfg = Debug - VS 2013|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|Win32.Build.0 = Debug - VS 2013|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|x64.ActiveCfg = Debug - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|x64.Build.0 = Debug - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|Win32.ActiveCfg = Release - Clang|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|Win32.Build.0 = Release - Clang|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|x64.ActiveCfg = Release - Clang|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|x64.Build.0 = Release - Clang|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|Win32.ActiveCfg = Release - VS 2013|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|Win32.Build.0 = Release - VS 2013|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|x64.ActiveCfg = Release - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|x64.Build.0 = Release - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 {CED23388-105D-46FA-9EC3-AD923C209AED}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 {CED23388-105D-46FA-9EC3-AD923C209AED}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 {CED23388-105D-46FA-9EC3-AD923C209AED}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 @@ -653,6 +636,126 @@ Global {AE8A7631-2145-4356-B430-FD40416B9523}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 {AE8A7631-2145-4356-B430-FD40416B9523}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 {AE8A7631-2145-4356-B430-FD40416B9523}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - Clang|Win32.ActiveCfg = Debug - Clang|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - Clang|Win32.Build.0 = Debug - Clang|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - Clang|x64.ActiveCfg = Debug - Clang|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - Clang|x64.Build.0 = Debug - Clang|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2013|Win32.ActiveCfg = Debug - VS 2013|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2013|Win32.Build.0 = Debug - VS 2013|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2013|x64.ActiveCfg = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2013|x64.Build.0 = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - Clang|Win32.ActiveCfg = Release - Clang|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - Clang|Win32.Build.0 = Release - Clang|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - Clang|x64.ActiveCfg = Release - Clang|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - Clang|x64.Build.0 = Release - Clang|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2013|Win32.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2013|Win32.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2013|x64.ActiveCfg = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2013|x64.Build.0 = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {132F81F8-46DA-49D0-9071-D70BC087B38C}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - Clang|Win32.ActiveCfg = Debug - Clang|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - Clang|Win32.Build.0 = Debug - Clang|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - Clang|x64.ActiveCfg = Debug - Clang|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - Clang|x64.Build.0 = Debug - Clang|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2013|Win32.ActiveCfg = Debug - VS 2013|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2013|Win32.Build.0 = Debug - VS 2013|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2013|x64.ActiveCfg = Debug - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2013|x64.Build.0 = Debug - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - Clang|Win32.ActiveCfg = Release - Clang|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - Clang|Win32.Build.0 = Release - Clang|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - Clang|x64.ActiveCfg = Release - Clang|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - Clang|x64.Build.0 = Release - Clang|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2013|Win32.ActiveCfg = Release - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2013|Win32.Build.0 = Release - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2013|x64.ActiveCfg = Release - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2013|x64.Build.0 = Release - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|Win32.ActiveCfg = Debug - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|Win32.Build.0 = Debug - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|x64.ActiveCfg = Debug - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - C++ 03|x64.Build.0 = Debug - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|Win32.ActiveCfg = Debug - Clang|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|Win32.Build.0 = Debug - Clang|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|x64.ActiveCfg = Debug - Clang|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - Clang|x64.Build.0 = Debug - Clang|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|Win32.ActiveCfg = Debug - VS 2013|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|Win32.Build.0 = Debug - VS 2013|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|x64.ActiveCfg = Debug - VS 2013|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2013|x64.Build.0 = Debug - VS 2013|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|Win32.ActiveCfg = Debug - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|Win32.Build.0 = Debug - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|x64.ActiveCfg = Debug - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2015|x64.Build.0 = Debug - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|Win32.ActiveCfg = Debug - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|Win32.Build.0 = Debug - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|x64.ActiveCfg = Debug - VS 2017|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Debug - VS 2017|x64.Build.0 = Debug - VS 2017|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|Win32.ActiveCfg = Release - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|Win32.Build.0 = Release - C++ 03|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|x64.ActiveCfg = Release - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - C++ 03|x64.Build.0 = Release - C++ 03|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|Win32.ActiveCfg = Release - Clang|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|Win32.Build.0 = Release - Clang|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|x64.ActiveCfg = Release - Clang|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - Clang|x64.Build.0 = Release - Clang|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|Win32.ActiveCfg = Release - VS 2013|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|Win32.Build.0 = Release - VS 2013|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|x64.ActiveCfg = Release - VS 2013|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2013|x64.Build.0 = Release - VS 2013|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|Win32.ActiveCfg = Release - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|Win32.Build.0 = Release - VS 2015|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|x64.ActiveCfg = Release - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2015|x64.Build.0 = Release - VS 2015|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|Win32.ActiveCfg = Release - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|Win32.Build.0 = Release - VS 2017|Win32 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|x64.ActiveCfg = Release - VS 2017|x64 + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357}.Release - VS 2017|x64.Build.0 = Release - VS 2017|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -670,13 +773,15 @@ Global {47973C26-88C1-4C07-8B31-6D448D7BD387} = {FBC833F8-033B-4400-8CBA-C71A32CF62B4} {790287FF-8ECB-440C-8D3D-343AF0951E7B} = {FBC833F8-033B-4400-8CBA-C71A32CF62B4} {2069AE83-AE26-484A-A6E7-E872E0045020} = {68F3A738-05B2-48AE-AF75-B8E9FE63660E} - {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357} = {AF9A9587-13D2-4D16-9C3A-AB3061E3FEF3} {CED23388-105D-46FA-9EC3-AD923C209AED} = {AF9A9587-13D2-4D16-9C3A-AB3061E3FEF3} {E70CC0C5-256B-41E2-A852-B1904C2D84D3} = {AF9A9587-13D2-4D16-9C3A-AB3061E3FEF3} {B883C29E-485C-4C8F-ACB1-A1602378BF5C} = {AF9A9587-13D2-4D16-9C3A-AB3061E3FEF3} {CA16ABEE-C6DE-4BD4-9DE4-5C2F1D149A68} = {B883C29E-485C-4C8F-ACB1-A1602378BF5C} {A23DCF32-F7CB-450B-B4A0-59AD7BACFDD4} = {FBC833F8-033B-4400-8CBA-C71A32CF62B4} {AE8A7631-2145-4356-B430-FD40416B9523} = {B7DF480E-DC38-410F-86E7-330696F7D5AB} + {132F81F8-46DA-49D0-9071-D70BC087B38C} = {102C094E-DCBA-46DF-ABCC-7A29380154D4} + {392D14A1-D26A-4A7F-80F5-9CE9EA3171C9} = {102C094E-DCBA-46DF-ABCC-7A29380154D4} + {466B53F7-FF2E-4A0D-94C1-48E1ACC7D357} = {102C094E-DCBA-46DF-ABCC-7A29380154D4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {08130CC8-A1F0-4919-A481-F79DED03E207} diff --git a/yasmine_model/CMakeLists.txt b/yasmine_model/CMakeLists.txt index e221ef5..419aa24 100644 --- a/yasmine_model/CMakeLists.txt +++ b/yasmine_model/CMakeLists.txt @@ -20,7 +20,7 @@ include(./../CMakeHelpers/addYasmineOptions.cmake) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${extra_flags}") include_directories("./../yasmine_model/include") -include_directories("./../externals/essentials/include") +include_directories("./../externals/essentials" "./../externals/essentials/source/essentials/include") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") add_library(libyasmine_model ${LINK_TYPE} ${yasmine_model_SRC}) @@ -31,6 +31,12 @@ endif() set(link_libraries_list "") use_pthread(link_libraries_list) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_library_for_linking(link_libraries_list libessentials) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + add_library_for_linking(link_libraries_list essentials) +endif() + if("${CPP_VERSION}" STREQUAL "03") use_boost_libraries(link_libraries_list) endif() diff --git a/yasmine_model/changelog.txt b/yasmine_model/changelog.txt index ec19aad..c8482d8 100644 --- a/yasmine_model/changelog.txt +++ b/yasmine_model/changelog.txt @@ -1,6 +1,30 @@ # Change log All notable changes to this project are documented in this file. +##[0.2.0] - 2017-12-18 + +### Added +• new methods to interact with the elements (e.g. get_child, set_parent, ...) +• new methods to interact with the state machine (e.g. remove_event, get_event, remove_transition, get_transition, ...) +• rapidjson_document.hpp as a wrapper for rapidjson/document.h and rapidjson/prettywriter.h +• delete_visitor for deleting elements +• has_error_event to simple state model +• add_deferred_event and remove_deferred_event to state model +• constuctor to easily construct an async simple state model +• setters in transition_model for behavior, guard, triggers, target, source, and kind +• methods to get the element that deferes an event and to check if an element deferes an event +• list of external vertices + +### Changed +• internally use rapidjson_document.hpp instead of document.h +• event_model is now a class and has getters and setters for its properties +• use essentials as a library +• CMake: use external CMakeHelpers files + +### Fixed +• read/write error event from/to model file +• read/write region from/to model file: 'pseudostates' list is read for backward compatibility. Just 'vertices' is written. + ##[0.1.5] - 2017-11-10 diff --git a/yasmine_model/include/build_number.hpp b/yasmine_model/include/build_number.hpp index 5dd6fa1..f823114 100644 --- a/yasmine_model/include/build_number.hpp +++ b/yasmine_model/include/build_number.hpp @@ -24,7 +24,7 @@ namespace version { - const sxe::uint16_t BUILD_NUMBER( 810 ); + const sxe::uint16_t BUILD_NUMBER( 850 ); } diff --git a/yasmine_model/include/choice_model_fwd.hpp b/yasmine_model/include/choice_model_fwd.hpp index afa4166..23deabc 100644 --- a/yasmine_model/include/choice_model_fwd.hpp +++ b/yasmine_model/include/choice_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class choice_model; +class choice_model_impl; -typedef sxe::SX_UNIQUE_PTR choice_model_uptr; +typedef sxe::SX_UNIQUE_PTR choice_model_uptr; } diff --git a/yasmine_model/include/choice_model_impl.hpp b/yasmine_model/include/choice_model_impl.hpp index f6eb94c..3853613 100644 --- a/yasmine_model/include/choice_model_impl.hpp +++ b/yasmine_model/include/choice_model_impl.hpp @@ -36,6 +36,7 @@ class choice_model_impl SX_FINAL: virtual ~choice_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( choice_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/composite_state_model.hpp b/yasmine_model/include/composite_state_model.hpp index a05a8ec..a5775e1 100644 --- a/yasmine_model/include/composite_state_model.hpp +++ b/yasmine_model/include/composite_state_model.hpp @@ -48,8 +48,13 @@ class composite_state_model: SX_NO_COPY( composite_state_model ) virtual void add_region( region_model_uptr _region ) = 0; + virtual region_model& get_region( const size_t _index ) = 0; + virtual void remove_region( const size_t _index ) = 0; virtual raw_const_pseduostate_models get_state_pseudostates() const = 0; + virtual const size_t get_state_pseudostates_count() const = 0; + virtual pseudostate_model& get_state_pseudostate( const size_t _index ) = 0; virtual void add_state_pseudostate( pseudostate_model_uptr _pseudostate ) = 0; + virtual void remove_state_pseudostate( const size_t _index ) = 0; }; diff --git a/yasmine_model/include/composite_state_model_impl.hpp b/yasmine_model/include/composite_state_model_impl.hpp index eab43eb..0164ee7 100644 --- a/yasmine_model/include/composite_state_model_impl.hpp +++ b/yasmine_model/include/composite_state_model_impl.hpp @@ -43,23 +43,63 @@ class composite_state_model_impl SX_FINAL: SX_NO_COPY( composite_state_model_impl ) virtual const std::string& get_do_behavior() const SX_OVERRIDE; virtual void set_do_behavior( const std::string& _do_behavior ) SX_OVERRIDE; + //!\brief Get the entry behavior of the composite state. virtual const std::string& get_enter_behavior() const SX_OVERRIDE; + //!\brief Set the entry behavior of the composite state. void set_enter_behavior( const std::string& _enter_behavior ) SX_OVERRIDE; + //!\brief Get the exit behavior of the composite state. virtual const std::string& get_exit_behavior() const SX_OVERRIDE; + //!\brief Set the exit behavior of the composite state. void set_exit_behavior( const std::string& _exit_behavior ) SX_OVERRIDE; + //!\brief Get the regions of the composite state. virtual const raw_const_region_models get_regions() const SX_OVERRIDE; + + //!\brief Get the number of regions in the composite state. + virtual const size_t get_regions_count() const SX_OVERRIDE; + + //!\brief Get the region of the composite state with the given index. + virtual region_model& get_region( const size_t _index ) SX_OVERRIDE; + //!\brief Add a region to the list of regions of the composite state. virtual void add_region( region_model_uptr _region ) SX_OVERRIDE; + + //!\brief Remove the region with the given index. + virtual void remove_region( const size_t _index ) SX_OVERRIDE; + //!\brief Get the state pseudostates of the composite state. virtual raw_const_pseduostate_models get_state_pseudostates() const SX_OVERRIDE; + + //!\brief Get the number of state pseudostates of the composite state. + virtual const size_t get_state_pseudostates_count() const SX_OVERRIDE; + + //!\brief Get the state pseudostate with the given index. + virtual pseudostate_model& get_state_pseudostate( const size_t _index ) SX_OVERRIDE; + //!\brief Add a state pseudostate to the list of the state pseudostates of the composite state. virtual void add_state_pseudostate( pseudostate_model_uptr _pseudostate ) SX_OVERRIDE; + + //!\brief Remove the state pseudostate with the given index. + virtual void remove_state_pseudostate( const size_t _index ) SX_OVERRIDE; + + //!\brief Get the child element with the given uri. + //!\param _uri Uri of the requested element. + //!\return Pointer to the requested element. + //!\exception Throws sxy::model::exception if the element does not exists. + virtual state_machine_element_model* get_child( const sxe::uri& _uri ) SX_OVERRIDE; + + //!\brief Get list of that defer the given event. + //!\param _elements List of elements to be filled. + //!\param _event Deferred event. + virtual void get_event_references( std::vector& _elements, + const event_sptr _event ) SX_OVERRIDE; + virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; private: diff --git a/yasmine_model/include/consts.hpp b/yasmine_model/include/consts.hpp index 1547e41..8f9d69d 100644 --- a/yasmine_model/include/consts.hpp +++ b/yasmine_model/include/consts.hpp @@ -50,6 +50,7 @@ extern const char* const JSON_EVENT_PRIORITY; extern const char* const JSON_VERSION; extern const char* const JSON_CURRENT_VERSION_VALUE; extern const char* const JSON_VERSION_1; +extern const char* const JSON_EXTERNALS; extern const std::string TYPE_TRANSITION; diff --git a/yasmine_model/include/deep_history_model.hpp b/yasmine_model/include/deep_history_model.hpp index d5cbe92..6a86481 100644 --- a/yasmine_model/include/deep_history_model.hpp +++ b/yasmine_model/include/deep_history_model.hpp @@ -13,6 +13,7 @@ #include "pseudostate_model.hpp" +#include "deep_history_model_fwd.hpp" namespace sxy diff --git a/yasmine_model/include/deep_history_model_fwd.hpp b/yasmine_model/include/deep_history_model_fwd.hpp index 580d5b9..636f5d5 100644 --- a/yasmine_model/include/deep_history_model_fwd.hpp +++ b/yasmine_model/include/deep_history_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class deep_history_model; +class deep_history_model_impl; -typedef sxe::SX_UNIQUE_PTR deep_history_model_uptr; +typedef sxe::SX_UNIQUE_PTR deep_history_model_uptr; } diff --git a/yasmine_model/include/deep_history_model_impl.hpp b/yasmine_model/include/deep_history_model_impl.hpp index 987fbe6..5ec52cf 100644 --- a/yasmine_model/include/deep_history_model_impl.hpp +++ b/yasmine_model/include/deep_history_model_impl.hpp @@ -38,6 +38,7 @@ class deep_history_model_impl SX_FINAL: virtual ~deep_history_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( deep_history_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/delete_visitor.hpp b/yasmine_model/include/delete_visitor.hpp new file mode 100644 index 0000000..e91165e --- /dev/null +++ b/yasmine_model/include/delete_visitor.hpp @@ -0,0 +1,80 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////// +//// // +//// This file is part of the Seadex yasmine ecosystem (http://yasmine.seadex.de). // +//// Copyright (C) 2016-2017 Seadex GmbH // +//// // +//// Licensing information is available in the folder "license" which is part of this distribution. // +//// The same information is available on the www @ http://yasmine.seadex.de/Licenses.html. // +//// // +//////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef DELETE_VISITOR_3A02D550_C734_420C_B0D0_8720A701212B +#define DELETE_VISITOR_3A02D550_C734_420C_B0D0_8720A701212B + +#include "essentials/non_copyable.hpp" + + +namespace sxy +{ + + +namespace model +{ + + +class simple_state_model; +class composite_state_model; +class final_state_model; +class initial_pseudostate_model_impl; +class terminate_pseudostate_model_impl; +class join_model_impl; +class fork_model_impl; +class choice_model_impl; +class junction_model_impl; +class entry_point_model_impl; +class exit_point_model_impl; +class shallow_history_model_impl; +class deep_history_model_impl; +class transition_model; +class region_model; +class state_model; +class pseudostate_model_impl; + + +class delete_visitor SX_FINAL +{ +public: + explicit delete_visitor(); + ~delete_visitor() SX_NOEXCEPT; + SX_NO_COPY( delete_visitor ) + void visit( simple_state_model& _simple_state ); + void visit( composite_state_model& _composite_state ); + void visit( final_state_model& _final_state ); + void visit( initial_pseudostate_model_impl& _initial_pseudostate ); + void visit( terminate_pseudostate_model_impl& _terminate_pseudostate ); + void visit( join_model_impl& _join ); + void visit( fork_model_impl& _fork ); + void visit( choice_model_impl& _choice ); + void visit( junction_model_impl& _junction ); + void visit( entry_point_model_impl& _entry_point ); + void visit( exit_point_model_impl& _exit_point ); + void visit( shallow_history_model_impl& _shallow_history ); + void visit( deep_history_model_impl& _deep_history ); + void visit( transition_model& _transition ); + void visit( region_model& _region ); + + +private: + void delete_state( state_model* _state ); + void delete_pseudostate( pseudostate_model_impl* _pseudostate ); + void delete_state_pseudostate( pseudostate_model_impl* _state_pseudostate ); +}; + + +} + + +} + + +#endif diff --git a/yasmine_model/include/entry_point_model.hpp b/yasmine_model/include/entry_point_model.hpp index 4a80f35..70f81a7 100644 --- a/yasmine_model/include/entry_point_model.hpp +++ b/yasmine_model/include/entry_point_model.hpp @@ -13,6 +13,7 @@ #include "pseudostate_model.hpp" +#include "entry_point_model_fwd.hpp" namespace sxy diff --git a/yasmine_model/include/entry_point_model_fwd.hpp b/yasmine_model/include/entry_point_model_fwd.hpp index d305b63..b9340e9 100644 --- a/yasmine_model/include/entry_point_model_fwd.hpp +++ b/yasmine_model/include/entry_point_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class entry_point_model; +class entry_point_model_impl; -typedef sxe::SX_UNIQUE_PTR entry_point_model_uptr; +typedef sxe::SX_UNIQUE_PTR entry_point_model_uptr; } diff --git a/yasmine_model/include/entry_point_model_impl.hpp b/yasmine_model/include/entry_point_model_impl.hpp index c61c70f..9482855 100644 --- a/yasmine_model/include/entry_point_model_impl.hpp +++ b/yasmine_model/include/entry_point_model_impl.hpp @@ -36,6 +36,7 @@ class entry_point_model_impl SX_FINAL: virtual ~entry_point_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( entry_point_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/event_model.hpp b/yasmine_model/include/event_model.hpp index 6b98ab6..b1db54a 100644 --- a/yasmine_model/include/event_model.hpp +++ b/yasmine_model/include/event_model.hpp @@ -8,8 +8,8 @@ // // ////////////////////////////////////////////////////////////////////////////////////////////////////// -#ifndef EVENT_3677D50A_2158_4FCD_BB50_308B5C537D87 -#define EVENT_3677D50A_2158_4FCD_BB50_308B5C537D87 +#ifndef EVENT_MODEL_1280B0B7_E85B_4EFF_BF3D_D5548D88D0D8 +#define EVENT_MODEL_1280B0B7_E85B_4EFF_BF3D_D5548D88D0D8 #include "essentials/non_copyable.hpp" @@ -26,25 +26,29 @@ namespace model { -//!\struct event_model +//!\class event_model //!\brief An event in the model. -struct event_model +class event_model { public: - //!\brief Constructor. - event_model(); - //!\brief Constructor. //!\param _name Name of the event. - //!\param _id Id of the event. + //!\param _id ID of the event. //!\param _priority Priority of the event. - event_model( const std::string _name, const event_id _id, const event_priority _priority ); + explicit event_model( const std::string _name, const event_id _id, const event_priority _priority = 0 ); ~event_model() SX_NOEXCEPT; - - - std::string name; - event_id id; - event_priority priority; + const std::string& get_name() const; + void set_name( const std::string& _name ); + const event_id get_id() const; + void set_id( const event_id _id ); + const event_priority get_priority() const; + void set_priority( const event_priority _priority); + + +private: + std::string name_; + event_id id_; + event_priority priority_; }; diff --git a/yasmine_model/include/event_model_id.hpp b/yasmine_model/include/event_model_id.hpp index f9bba19..d2d8bd1 100644 --- a/yasmine_model/include/event_model_id.hpp +++ b/yasmine_model/include/event_model_id.hpp @@ -26,7 +26,7 @@ namespace model { -struct event_model; +class event_model; //!\brief The type alias for yasmine model's event IDs. @@ -34,17 +34,8 @@ typedef sxe::uint32_t event_id; //!\brief The type alias for yasmine model's event ID list. typedef std::vector< event_id > event_ids; -#if defined( SX_CPP03_BOOST ) || ( defined(_MSC_VER) && _MSC_VER <=1800 ) - -extern const event_id Y_MODEL_COMPLETION_EVENT_ID; - -#else - extern const event_id Y_MODEL_COMPLETION_EVENT_ID; -#endif - - typedef sxe::shared_ptr< event_model > event_sptr; diff --git a/yasmine_model/include/exit_point_model_fwd.hpp b/yasmine_model/include/exit_point_model_fwd.hpp index e182db6..774c2ac 100644 --- a/yasmine_model/include/exit_point_model_fwd.hpp +++ b/yasmine_model/include/exit_point_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class exit_point_model; +class exit_point_model_impl; -typedef sxe::SX_UNIQUE_PTR exit_point_model_uptr; +typedef sxe::SX_UNIQUE_PTR exit_point_model_uptr; } diff --git a/yasmine_model/include/exit_point_model_impl.hpp b/yasmine_model/include/exit_point_model_impl.hpp index 12b7d57..ff0fe72 100644 --- a/yasmine_model/include/exit_point_model_impl.hpp +++ b/yasmine_model/include/exit_point_model_impl.hpp @@ -38,6 +38,7 @@ class exit_point_model_impl SX_FINAL : virtual ~exit_point_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( exit_point_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/externals_fwd.hpp b/yasmine_model/include/externals_fwd.hpp new file mode 100644 index 0000000..032abb0 --- /dev/null +++ b/yasmine_model/include/externals_fwd.hpp @@ -0,0 +1,37 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex yasmine ecosystem (http://yasmine.seadex.de). // +// Copyright (C) 2016-2017 Seadex GmbH // +// // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://yasmine.seadex.de/Licenses.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef EXTERNALS_FWD_0272FF1D_FEB5_48EB_BDD8_A094BAD8D12F +#define EXTERNALS_FWD_0272FF1D_FEB5_48EB_BDD8_A094BAD8D12F + +#include + +#include "essentials/compatibility/compatibility.hpp" + + +namespace sxy +{ + + +namespace model +{ + +class state_machine_external_element; +typedef sxe::SX_UNIQUE_PTR external_uptr; +typedef std::vector< external_uptr > external_vertices; + +} + + +} + + +#endif + diff --git a/yasmine_model/include/final_state_model_fwd.hpp b/yasmine_model/include/final_state_model_fwd.hpp index 6769933..c17ba13 100644 --- a/yasmine_model/include/final_state_model_fwd.hpp +++ b/yasmine_model/include/final_state_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class final_state_model; +class final_state_model_impl; -typedef sxe::SX_UNIQUE_PTR< final_state_model > final_state_model_uptr; +typedef sxe::SX_UNIQUE_PTR< final_state_model_impl > final_state_model_uptr; } diff --git a/yasmine_model/include/final_state_model_impl.hpp b/yasmine_model/include/final_state_model_impl.hpp index b7c926f..a540285 100644 --- a/yasmine_model/include/final_state_model_impl.hpp +++ b/yasmine_model/include/final_state_model_impl.hpp @@ -14,7 +14,7 @@ #include "final_state_model.hpp" #include "state_model_impl.hpp" -#include "region_model_fwd.hpp" +#include "region_model.hpp" namespace sxy @@ -46,6 +46,7 @@ class final_state_model_impl SX_FINAL: virtual const std::string& get_exit_behavior() const SX_OVERRIDE; virtual void set_exit_behavior( const std::string& _exit_behavior ) SX_OVERRIDE; virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; private: diff --git a/yasmine_model/include/fork_model_fwd.hpp b/yasmine_model/include/fork_model_fwd.hpp index ee44e85..b693c04 100644 --- a/yasmine_model/include/fork_model_fwd.hpp +++ b/yasmine_model/include/fork_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class fork_model; +class fork_model_impl; -typedef sxe::SX_UNIQUE_PTR fork_model_uptr; +typedef sxe::SX_UNIQUE_PTR fork_model_uptr; } diff --git a/yasmine_model/include/fork_model_impl.hpp b/yasmine_model/include/fork_model_impl.hpp index 55b76ae..73fa923 100644 --- a/yasmine_model/include/fork_model_impl.hpp +++ b/yasmine_model/include/fork_model_impl.hpp @@ -38,6 +38,7 @@ class fork_model_impl SX_FINAL: virtual ~fork_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( fork_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/initial_pseudostate_model_fwd.hpp b/yasmine_model/include/initial_pseudostate_model_fwd.hpp index a41c00a..4882f07 100644 --- a/yasmine_model/include/initial_pseudostate_model_fwd.hpp +++ b/yasmine_model/include/initial_pseudostate_model_fwd.hpp @@ -22,10 +22,10 @@ namespace sxy namespace model { -class initial_pseudostate_model; +class initial_pseudostate_model_impl; -typedef sxe::SX_UNIQUE_PTR< initial_pseudostate_model > initial_pseudostate_model_uptr; +typedef sxe::SX_UNIQUE_PTR< initial_pseudostate_model_impl > initial_pseudostate_model_uptr; } diff --git a/yasmine_model/include/initial_pseudostate_model_impl.hpp b/yasmine_model/include/initial_pseudostate_model_impl.hpp index 8755f2c..7ee4ed5 100644 --- a/yasmine_model/include/initial_pseudostate_model_impl.hpp +++ b/yasmine_model/include/initial_pseudostate_model_impl.hpp @@ -41,6 +41,7 @@ class initial_pseudostate_model_impl SX_FINAL: virtual ~initial_pseudostate_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( initial_pseudostate_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/join_model_fwd.hpp b/yasmine_model/include/join_model_fwd.hpp index 6cfe25a..5fd6b84 100644 --- a/yasmine_model/include/join_model_fwd.hpp +++ b/yasmine_model/include/join_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class join_model; +class join_model_impl; -typedef sxe::SX_UNIQUE_PTR join_model_uptr; +typedef sxe::SX_UNIQUE_PTR join_model_uptr; } diff --git a/yasmine_model/include/join_model_impl.hpp b/yasmine_model/include/join_model_impl.hpp index 8a30bee..f488562 100644 --- a/yasmine_model/include/join_model_impl.hpp +++ b/yasmine_model/include/join_model_impl.hpp @@ -24,8 +24,8 @@ namespace model { - //!\class join_model_impl - //!\brief A join pseudostate in the model. +//!\class join_model_impl +//!\brief A join pseudostate in the model. class join_model_impl SX_FINAL: public virtual join_model, public pseudostate_model_impl { @@ -38,6 +38,7 @@ class join_model_impl SX_FINAL: virtual ~join_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( join_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/json_reader.hpp b/yasmine_model/include/json_reader.hpp index 81b79c2..96c9884 100644 --- a/yasmine_model/include/json_reader.hpp +++ b/yasmine_model/include/json_reader.hpp @@ -11,10 +11,14 @@ #ifndef JSON_READER_B84EDCFB_85B6_4060_971F_96D6FB6D87B7 #define JSON_READER_B84EDCFB_85B6_4060_971F_96D6FB6D87B7 +#include + #include "essentials/non_copyable.hpp" #include "essentials/uri.hpp" #include "rapidjson_document.hpp" + +#include "consts.hpp" #include "transition_model_kind.hpp" #include "region_model_fwd.hpp" #include "pseudostate_model_fwd.hpp" @@ -23,26 +27,32 @@ #include "composite_state_model_fwd.hpp" #include "simple_state_model_fwd.hpp" #include "final_state_model_fwd.hpp" -#include "entry_point_model_fwd.hpp" -#include "exit_point_model_fwd.hpp" -#include "deep_history_model_fwd.hpp" -#include "shallow_history_model_fwd.hpp" #include "initial_pseudostate_model_fwd.hpp" +#include "terminate_pseudostate_model_fwd.hpp" #include "join_model_fwd.hpp" -#include "junction_model_fwd.hpp" #include "fork_model_fwd.hpp" -#include "terminate_pseudostate_model_fwd.hpp" #include "choice_model_fwd.hpp" +#include "junction_model_fwd.hpp" +#include "entry_point_model_fwd.hpp" +#include "exit_point_model_fwd.hpp" +#include "deep_history_model_fwd.hpp" +#include "shallow_history_model_fwd.hpp" #include "transition_model_fwd.hpp" -#include "consts.hpp" -#include "model_element_type.hpp" #include "json_parser_helper.hpp" #include "event_model.hpp" +#include "externals_fwd.hpp" namespace sxy { + +namespace model +{ + class state_machine_element_model_impl; +} + + //!\class json_reader //!\brief Provides the ability to read an yasmine model from a JSON file (.ym). class json_reader SX_FINAL @@ -56,12 +66,15 @@ class json_reader SX_FINAL //!\brief Retrieve the read model. //!\return Pointer to the model. model::state_machine_model_ptr get_model_ptr(); + const model::external_vertices& get_external_vertices(); private: + void read_externals(); void read_json_file( const std::string& _file ); model::state_machine_model_ptr read_into_model(); sxy::model::event_ids read_deferred_events( const rapidjson::Value& _state ) const; + sxy::model::event_ids read_error_events( const rapidjson::Value& _state ) const; model::composite_state_model_uptr read_composite_state( const rapidjson::Value& _root ); model::simple_state_model_uptr read_simple_state( const rapidjson::Value& _state, bool _is_async = false ); model::final_state_model_uptr read_final_state( const rapidjson::Value& _state ); @@ -82,6 +95,7 @@ class json_reader SX_FINAL model::transition_model_uptr read_transition( const rapidjson::Value& _transition ); static sxy::model::transition_model_kind get_transition_kind( sxe::int64_t _kind ); sxe::int32_t get_event_id_by_name( const std::string& _name ) const; + std::string get_event_name( const sxe::int32_t _event_id ) const; sxe::int8_t get_event_priority_by_name( const std::string& _name ) const; void get_event_list( model::state_machine_model_ptr& _model ); void check_document() const; @@ -92,7 +106,7 @@ class json_reader SX_FINAL const std::string pseudostate_name = get_object_member_string( sxe::ref( _pseudostate ), model::JSON_NAME_NODE ); sxe::SX_UNIQUE_PTR< pseudostate_impl > new_pseudostate = SX_MAKE_UNIQUE< pseudostate_impl >( pseudostate_name ); - return( sxe::move( new_pseudostate ) ); + return( new_pseudostate ); } diff --git a/yasmine_model/include/json_writer.hpp b/yasmine_model/include/json_writer.hpp index 41ab84e..ff13578 100644 --- a/yasmine_model/include/json_writer.hpp +++ b/yasmine_model/include/json_writer.hpp @@ -14,22 +14,8 @@ #include -#define RAPIDJSON_NO_SIZETYPEDEFINE - - -namespace rapidjson -{ - - -typedef std::size_t SizeType; - - -} - - -#include "state_machine_model.hpp" - #include "rapidjson_document.hpp" +#include "state_machine_model.hpp" namespace sxy @@ -77,15 +63,17 @@ class json_writer SX_FINAL static void add_transitions_from_model( const model::state_machine_model& _state_machine_model, rapidjson::Value& _transitions, rapidjson::MemoryPoolAllocator< >& _allocator ); static void add_regions_from_model( const model::composite_state_model& _composite_state_model, - rapidjson::Value& _regions, rapidjson::MemoryPoolAllocator< >& _allocator ); + rapidjson::Value& _regions, rapidjson::MemoryPoolAllocator< >& _allocator, + const model::state_machine_model& _state_machine_model ); static void fill_region_object( const model::region_model& _region_model, rapidjson::Value& _region, - rapidjson::MemoryPoolAllocator< >& _allocator ); + rapidjson::MemoryPoolAllocator< >& _allocator, const model::state_machine_model& _state_machine_model ); static void fill_pseudostate_object( const model::pseudostate_model& _pseudostate_model, rapidjson::Value& _pseudostate, rapidjson::MemoryPoolAllocator< >& _allocator ); static void fill_simple_state_object( const model::simple_state_model& _simple_state_model, rapidjson::Value& _simple_state, - rapidjson::MemoryPoolAllocator< >& _allocator ); + rapidjson::MemoryPoolAllocator< >& _allocator, const model::state_machine_model& _state_machine_model ); static void fill_composite_state_object( const model::composite_state_model& _composite_state_model, - rapidjson::Value& _composite_state, rapidjson::MemoryPoolAllocator< >& _allocator ); + rapidjson::Value& _composite_state, rapidjson::MemoryPoolAllocator< >& _allocator, + const model::state_machine_model& _state_machine_model ); static void fill_final_state_object( const model::final_state_model& _final_state_model, rapidjson::Value& _final_state, rapidjson::MemoryPoolAllocator< >& _allocator ); static void add_state_pseudostates_from_model( const model::composite_state_model& _composite_state_model, @@ -96,6 +84,10 @@ class json_writer SX_FINAL rapidjson::MemoryPoolAllocator< >& _allocator ); static const std::string get_event_name_by_id( const sxy::model::event_id& _event_id, const model::state_machine_model& _state_machine_model ); + static const size_t get_event_index_by_id( const sxy::model::event_id& _event_id, + const model::state_machine_model& _state_machine_model ); + void add_externals( const model::state_machine_model& _state_machine_model, rapidjson::Value& _document, + rapidjson::MemoryPoolAllocator< >& _allocator ); }; diff --git a/yasmine_model/include/junction_model_fwd.hpp b/yasmine_model/include/junction_model_fwd.hpp index 1fc1163..729023b 100644 --- a/yasmine_model/include/junction_model_fwd.hpp +++ b/yasmine_model/include/junction_model_fwd.hpp @@ -22,10 +22,10 @@ namespace sxy namespace model { -class junction_model; +class junction_model_impl; -typedef sxe::SX_UNIQUE_PTR junction_model_uptr; +typedef sxe::SX_UNIQUE_PTR junction_model_uptr; } diff --git a/yasmine_model/include/junction_model_impl.hpp b/yasmine_model/include/junction_model_impl.hpp index a4e835f..738e088 100644 --- a/yasmine_model/include/junction_model_impl.hpp +++ b/yasmine_model/include/junction_model_impl.hpp @@ -38,6 +38,7 @@ class junction_model_impl SX_FINAL: virtual ~junction_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( junction_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/model.hpp b/yasmine_model/include/model.hpp index 78cd019..98ae7bb 100644 --- a/yasmine_model/include/model.hpp +++ b/yasmine_model/include/model.hpp @@ -11,7 +11,6 @@ #ifndef MODEL_70A5CEB1_6704_4CA7_B205_65579AFDC215 #define MODEL_70A5CEB1_6704_4CA7_B205_65579AFDC215 - #include "json_reader.hpp" #include "json_writer.hpp" @@ -21,7 +20,21 @@ #include "simple_state_model_impl.hpp" #include "composite_state_model_impl.hpp" #include "final_state_model_impl.hpp" + #include "pseudostate_model_impl.hpp" +#include "initial_pseudostate_model.hpp" +#include "terminate_pseudostate_model.hpp" +#include "join_model.hpp" +#include "fork_model.hpp" +#include "choice_model.hpp" +#include "junction_model.hpp" + +#include "entry_point_model.hpp" +#include "exit_point_model.hpp" +#include "shallow_history_model.hpp" +#include "deep_history_model.hpp" + +#include "delete_visitor.hpp" #include "model_exception.hpp" diff --git a/yasmine_model/include/pseudostate_model_fwd.hpp b/yasmine_model/include/pseudostate_model_fwd.hpp index e80ccaf..95e0a7e 100644 --- a/yasmine_model/include/pseudostate_model_fwd.hpp +++ b/yasmine_model/include/pseudostate_model_fwd.hpp @@ -25,12 +25,13 @@ namespace model { +class pseudostate_model_impl; class pseudostate_model; -typedef sxe::SX_UNIQUE_PTR pseudostate_model_uptr; +typedef sxe::SX_UNIQUE_PTR pseudostate_model_uptr; typedef std::vector pseudostate_models_uptr; -typedef std::vector< const pseudostate_model*> raw_const_pseduostate_models; +typedef std::vector< const pseudostate_model_impl*> raw_const_pseduostate_models; } diff --git a/yasmine_model/include/pseudostate_model_impl.hpp b/yasmine_model/include/pseudostate_model_impl.hpp index 57d2dce..2b1d1e1 100644 --- a/yasmine_model/include/pseudostate_model_impl.hpp +++ b/yasmine_model/include/pseudostate_model_impl.hpp @@ -38,15 +38,20 @@ class pseudostate_model_impl: pseudostate_model_impl( const std::string& _name, const model_element_type& _type ); virtual ~pseudostate_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( pseudostate_model_impl ) + //!\brief Get the list of the incoming transitions of the pseudostate. virtual raw_const_transition_models get_incoming_transitions() const SX_OVERRIDE; + //!\brief Add an incoming transition to the list of the incoming transitions of the pseudostate. virtual void add_incoming_transition( transition_models _incoming_transition ) SX_OVERRIDE; + //!\brief Get the list of the outgoing transitions of the pseudostate. virtual raw_const_transition_models get_outgoing_transitions() const SX_OVERRIDE; + //!\brief Add a outgoing transition to the list of the outgoing transitions of the pseudostate. virtual void add_outgoing_transition( transition_models _outgoing_transition ) SX_OVERRIDE; + virtual state_machine_element_model* get_child( const sxe::uri& _uri ) SX_OVERRIDE; private: transition_models incoming_transitions_; diff --git a/yasmine_model/include/rapidjson_document.hpp b/yasmine_model/include/rapidjson_document.hpp index 2e9a65e..a45e0d3 100644 --- a/yasmine_model/include/rapidjson_document.hpp +++ b/yasmine_model/include/rapidjson_document.hpp @@ -19,13 +19,14 @@ namespace rapidjson { -typedef std::size_t SizeType; +typedef ::std::size_t SizeType; } #include +#include #endif diff --git a/yasmine_model/include/region_model.hpp b/yasmine_model/include/region_model.hpp index 3700eb1..844cc1b 100644 --- a/yasmine_model/include/region_model.hpp +++ b/yasmine_model/include/region_model.hpp @@ -46,9 +46,15 @@ class region_model: SX_NO_COPY( region_model ) virtual row_const_state_models get_states() const = 0; + virtual const size_t get_states_count() const = 0; + virtual state_model& get_state( const size_t _index ) = 0; virtual void add_state( state_model_uptr _state ) = 0; + virtual void remove_state( const size_t _index ) = 0; virtual raw_const_pseduostate_models get_pseudostates() const = 0; + virtual const size_t get_pseudostates_count() const = 0; + virtual pseudostate_model& get_pseudostate( const size_t _index ) = 0; virtual void add_pseudostate( pseudostate_model_uptr _region_pseudostate ) = 0; + virtual void remove_pseudostate( const size_t _index ) = 0; }; diff --git a/yasmine_model/include/region_model_impl.hpp b/yasmine_model/include/region_model_impl.hpp index 1aca840..386fce8 100644 --- a/yasmine_model/include/region_model_impl.hpp +++ b/yasmine_model/include/region_model_impl.hpp @@ -35,15 +35,45 @@ class region_model_impl SX_FINAL: explicit region_model_impl( const std::string& _name ); virtual ~region_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( region_model_impl ) + //!\brief Get the list of the states of the region. row_const_state_models get_states() const SX_OVERRIDE; + + //!\brief Get the number of states in the region. + virtual const size_t get_states_count() const SX_OVERRIDE; + + //!\brief Get the state with the given index. + virtual state_model& get_state( const size_t _index ) SX_OVERRIDE; + //!\brief Add a state to the region. - void add_state( state_model_uptr _state ) SX_OVERRIDE; - //!\brief Get the list of pseudostates of the region. - raw_const_pseduostate_models get_pseudostates() const SX_OVERRIDE; + virtual void add_state( state_model_uptr _state ) SX_OVERRIDE; + + //!\brief Remove the state with the given index from the region. + virtual void remove_state( const size_t _index ) SX_OVERRIDE; + + //!\brief Get the list of pseudostates in the region. + virtual raw_const_pseduostate_models get_pseudostates() const SX_OVERRIDE; + + //!\brief Get the number of pseudostates in the region. + virtual const size_t get_pseudostates_count() const SX_OVERRIDE; + + //!\brief Get the pseudostate in the region with the given index. + virtual pseudostate_model& get_pseudostate( const size_t _index ) SX_OVERRIDE; + //!\brief Add a pseudostate to the region. void add_pseudostate( pseudostate_model_uptr _region_pseudostate ) SX_OVERRIDE; + //!\brief Remove the pseudostate with the given index from the region. + virtual void remove_pseudostate( const size_t _index ) SX_OVERRIDE; + + //!\brief Get the child element with the given uri. + //!\param _uri Uri of the searched element. + //!\return Pointer to the searched element. + //!\exception Throws sxy::model::exception if the element does not exists. + virtual state_machine_element_model* get_child( const sxe::uri& _uri ) SX_OVERRIDE; + + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; + private: state_models_uptr states_; diff --git a/yasmine_model/include/shallow_history_model_fwd.hpp b/yasmine_model/include/shallow_history_model_fwd.hpp index a2db7eb..624454f 100644 --- a/yasmine_model/include/shallow_history_model_fwd.hpp +++ b/yasmine_model/include/shallow_history_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class shallow_history_model; +class shallow_history_model_impl; -typedef sxe::SX_UNIQUE_PTR shallow_history_model_uptr; +typedef sxe::SX_UNIQUE_PTR shallow_history_model_uptr; } diff --git a/yasmine_model/include/shallow_history_model_impl.hpp b/yasmine_model/include/shallow_history_model_impl.hpp index a303ce2..87bf518 100644 --- a/yasmine_model/include/shallow_history_model_impl.hpp +++ b/yasmine_model/include/shallow_history_model_impl.hpp @@ -38,6 +38,7 @@ class shallow_history_model_impl SX_FINAL: virtual ~shallow_history_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( shallow_history_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/simple_state_model.hpp b/yasmine_model/include/simple_state_model.hpp index 25918a0..0e3697e 100644 --- a/yasmine_model/include/simple_state_model.hpp +++ b/yasmine_model/include/simple_state_model.hpp @@ -42,6 +42,7 @@ class simple_state_model : public virtual state_model SX_NO_COPY( simple_state_model ) + virtual bool has_error_event() const = 0; virtual event_sptr get_error_event() const = 0; virtual void set_error_event( event_sptr _error_event ) = 0; virtual bool is_async() const = 0; diff --git a/yasmine_model/include/simple_state_model_fwd.hpp b/yasmine_model/include/simple_state_model_fwd.hpp index a4c16ed..07d8932 100644 --- a/yasmine_model/include/simple_state_model_fwd.hpp +++ b/yasmine_model/include/simple_state_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class simple_state_model; +class simple_state_model_impl; -typedef sxe::SX_UNIQUE_PTR< simple_state_model > simple_state_model_uptr; +typedef sxe::SX_UNIQUE_PTR< simple_state_model_impl > simple_state_model_uptr; } diff --git a/yasmine_model/include/simple_state_model_impl.hpp b/yasmine_model/include/simple_state_model_impl.hpp index 922b26e..6722550 100644 --- a/yasmine_model/include/simple_state_model_impl.hpp +++ b/yasmine_model/include/simple_state_model_impl.hpp @@ -14,7 +14,7 @@ #include "simple_state_model.hpp" #include "state_model_impl.hpp" -#include "region_model_fwd.hpp" +#include "region_model.hpp" namespace sxy @@ -42,33 +42,67 @@ class simple_state_model_impl SX_FINAL: explicit simple_state_model_impl( const std::string& _name, const std::string& _enter_behavior = "", const std::string& _do_behavior = "", const std::string& _exit_behavior = "", const event_ids& _deferred_events = event_ids(), event_sptr _error_event = event_sptr(), bool _is_async = false ); + + //!\brief Constructor. + //!\param _name Name of the simple state. + //!\param _is_async Specify if the simple state is sync or async. + //!\param _enter_behavior Entry behavior of the simple state. + //!\param _do_behavior Do behavior of the simple state. + //!\param _exit_bahvior Exit behavior of the simple state. + //!\param _deferred_events List of IDs of deferred events. + //!\param _error_event Event that is fired in case an exception occurs. + explicit simple_state_model_impl( const std::string& _name, bool _is_async, const std::string& _enter_behavior = "", + const std::string& _do_behavior = "", const std::string& _exit_behavior = "", + const event_ids& _deferred_events = event_ids(), event_sptr _error_event = event_sptr() ); virtual ~simple_state_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( simple_state_model_impl ) + //!\brief Get the enter behavior of the simple state. virtual const std::string& get_enter_behavior() const SX_OVERRIDE; + //!\brief Set the enter behavior of the simple state. virtual void set_enter_behavior( const std::string& _enter_behavior ) SX_OVERRIDE; + //!\brief Get the do behavior of the simple state. virtual const std::string& get_do_behavior() const SX_OVERRIDE; + //!\brief Set the do behavior of the simple state. virtual void set_do_behavior( const std::string& _do_behavior ) SX_OVERRIDE; + //!\brief Get the exit behavior of the simple state. virtual const std::string& get_exit_behavior() const SX_OVERRIDE; + //!\brief Set the exit behavior of the simple state. virtual void set_exit_behavior( const std::string& _exit_behavior ) SX_OVERRIDE; virtual const raw_const_region_models get_regions() const SX_OVERRIDE; virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + + //!\brief Check if an error event is stored by the simple state. + //!\return True if an event is stored by the simple state, false otherwise. + virtual bool has_error_event() const SX_OVERRIDE; + //!\brief Get the error event stored by the simple state. - //!\return Pointer to the event stored by the simple state. + //!\return Event stored by the simple state. virtual event_sptr get_error_event() const SX_OVERRIDE; + //!\brief Set the error event stored by the simple state. virtual void set_error_event( event_sptr _error_event ) SX_OVERRIDE; + //!\brief Check if the simple state is asynchronous. //!\return True for async, false otherwise. virtual bool is_async() const SX_OVERRIDE; + //!\brief Set the simple state to be asynchronous or synchronous. + //!\param _is_async Switches the type of the simple state between asynchronous - on true - and synchronous - on false. virtual void set_is_async( bool _is_async ) SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; + + //!\brief Fill the given list with the elements that defer the given event. + //!\param _elements List of elements that defer the given event. + //!\param _event Deferred event. + virtual void get_event_references( std::vector& _elements, + const event_sptr _event ) SX_OVERRIDE; private: std::string enter_behavior_; diff --git a/yasmine_model/include/state_machine_element_model.hpp b/yasmine_model/include/state_machine_element_model.hpp index 725c794..681f7c3 100644 --- a/yasmine_model/include/state_machine_element_model.hpp +++ b/yasmine_model/include/state_machine_element_model.hpp @@ -31,6 +31,9 @@ namespace model { +class delete_visitor; + + //!\interface state_machine_element_model //!\brief Interface for an element in the state machine model. class state_machine_element_model @@ -50,10 +53,19 @@ class state_machine_element_model SX_NO_COPY( state_machine_element_model ) virtual const std::string & get_name() const = 0; + virtual void set_name( const std::string& _name ) = 0; virtual const sxe::uri get_uri() const = 0; virtual model::model_element_type get_type() const = 0; virtual const state_machine_element_model* get_parent() const = 0; - virtual void set_parent( const state_machine_element_model* _parent ) = 0; + virtual state_machine_element_model* get_parent() = 0; + virtual void set_parent( state_machine_element_model* _parent ) = 0; + + //!\brief Get the child element with the given uri. + //!\param _uri Uri of the requested element. + //!\return Pointer to the requested element. + //!\exception Throws sxy::model::exception if the element does not exists. + virtual state_machine_element_model* get_child( const sxe::uri& _uri ) = 0; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) = 0; }; diff --git a/yasmine_model/include/state_machine_element_model_impl.hpp b/yasmine_model/include/state_machine_element_model_impl.hpp index 892b998..a881388 100644 --- a/yasmine_model/include/state_machine_element_model_impl.hpp +++ b/yasmine_model/include/state_machine_element_model_impl.hpp @@ -37,21 +37,31 @@ class state_machine_element_model_impl: state_machine_element_model_impl( const std::string& _name, const model_element_type& _type ); virtual ~state_machine_element_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( state_machine_element_model_impl ) + //!\brief Get the name of the element. //!\return Name of the element. virtual const std::string & get_name() const SX_OVERRIDE; + //!\brief Set the name of the element. //!\param _name Name of the element. - void set_name( const std::string& _name ); + void set_name( const std::string& _name ) SX_OVERRIDE; + //!\brief Get the parent of the element. //!\return Pointer to the parent element. virtual const state_machine_element_model* get_parent() const SX_OVERRIDE; + + //!\brief Get the parent of the element (non const). + //!\return Pointer to the parent element. + virtual state_machine_element_model* get_parent() SX_OVERRIDE; + //!\brief Set the parent of the element. //!\param _parent Parent of the element. - virtual void set_parent( const state_machine_element_model* _parent ) SX_OVERRIDE; + virtual void set_parent( state_machine_element_model* _parent ) SX_OVERRIDE; + //!\brief Get the uri of the element. //!\return Uri of the element. virtual const sxe::uri get_uri() const SX_OVERRIDE; + //!\brief Get the type of the element. //!\return Element's type. virtual model_element_type get_type() const SX_OVERRIDE; @@ -61,11 +71,15 @@ class state_machine_element_model_impl: void add_ancestor_uri( sxe::uri& _uri ) const; std::string name_; - const state_machine_element_model* parent_; + state_machine_element_model* parent_; const model_element_type type_; }; + +typedef sxe::SX_UNIQUE_PTR state_machine_element_model_uptr; + + } diff --git a/yasmine_model/include/state_machine_external_element.hpp b/yasmine_model/include/state_machine_external_element.hpp new file mode 100644 index 0000000..e6efc65 --- /dev/null +++ b/yasmine_model/include/state_machine_external_element.hpp @@ -0,0 +1,54 @@ +////////////////////////////////////////////////////////////////////////////////////////////////////// +// // +// This file is part of the Seadex yasmine ecosystem (http://yasmine.seadex.de). // +// Copyright (C) 2016-2017 Seadex GmbH // +// // +// Licensing information is available in the folder "license" which is part of this distribution. // +// The same information is available on the www @ http://yasmine.seadex.de/Licenses.html. // +// // +////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef STATE_MACHINE_EXTERNAL_ELEMENT_AEC00D27_A69B_41EB_A235_C68063B7F121 +#define STATE_MACHINE_EXTERNAL_ELEMENT_AEC00D27_A69B_41EB_A235_C68063B7F121 + +#include "essentials/non_copyable.hpp" + +#include "externals_fwd.hpp" +#include "model_element_type.hpp" + + +namespace sxy +{ + + +namespace model +{ + + +class state_machine_external_element SX_FINAL +{ +public: + explicit state_machine_external_element( const std::string& _name, const model_element_type& _type ); + ~state_machine_external_element() SX_NOEXCEPT; + SX_NO_COPY( state_machine_external_element ) + const std::string& get_name() const; + const std::string& get_name(); + void set_name( const std::string& _name ); + const model_element_type get_type() const; + void set_type( const model_element_type& _type ); + + +private: + std::string name_; + model_element_type type_; +}; + + +} + + +} + + +#endif + diff --git a/yasmine_model/include/state_machine_model.hpp b/yasmine_model/include/state_machine_model.hpp index b946f72..a5d2a97 100644 --- a/yasmine_model/include/state_machine_model.hpp +++ b/yasmine_model/include/state_machine_model.hpp @@ -14,10 +14,14 @@ #include #include "essentials/non_copyable.hpp" +#include "essentials/compatibility/compatibility.hpp" +#include "state_machine_model_fwd.hpp" #include "transition_model_fwd.hpp" #include "composite_state_model_fwd.hpp" #include "event_model.hpp" +#include "state_machine_external_element.hpp" +#include "state_machine_element_model_impl.hpp" namespace sxy @@ -28,12 +32,15 @@ namespace model { +class state_machine_element_model; + + //!\class state_machine_model //!\brief Class representing a model of a complete state machine. class state_machine_model { public: - typedef std::vector< event_model > events; + typedef std::vector< event_sptr > events; state_machine_model(); ~state_machine_model() SX_NOEXCEPT; @@ -42,30 +49,72 @@ class state_machine_model //!\brief Add a transition to the state machine. void add_transition( transition_model_uptr _transition ); + //!\brief Remove transition with the given index from state machine. + void remove_transition( const size_t _index ); + //!\brief Get a list of transitions. //!\return List of transitions. raw_const_transition_models get_transitions() const; + //!\brief Get the transition with the given index. + //!\param _index The index of requested transition. + //!\return Requested transition. + transition_model& get_transition( const size_t _index ); + //!\brief Get a reference to the root state of the state machine. - //!\reference Reference to the root state of the state machine. + //!\return Root state of the state machine. composite_state_model_impl& get_root_state() const; //!\brief Add the root state to the state machine. void add_root_state( composite_state_model_uptr _root_state ); - //!\brief Get a list of events that was read from JSON file. This events are the events used in this state machine's scenario. + //!\brief Get a list of events that was read from a JSON file. These events are the events used in this state machine. events get_events() const; - - //!\brief Add an event to the list of the events. + + //!\brief Get the event with the given index. + event_model& get_event( const size_t _index ); + + //!\brief Get the event with the given index. + const event_model& get_event( const size_t _index ) const; + + //!\brief Get name of the event with the given ID. + std::string get_event_name( const sxy::model::event_id& _event_id ) const; + + //!\brief Add an event to the list of events. //!\param _event_name Name of the event. - //!\param _event_id Id of the event. + //!\param _event_id ID of the event. void add_event( const std::string& _event_name, const event_id& _event_id, const event_priority& _event_priority ); + //!\brief Remove an event from the list of events. + //!\param _index Index of the event to be deleted. + void remove_event( const size_t _index ); + + //!\brief Get a list of elements that have a reference to the given event. + //!\param _event Event for which referencing elements are searched. + //!\return List of elements that are referencing the given event. + std::vector get_event_references( const event_sptr _event ); + + //!\brief Get a list of elements that are not part of this state machine, but of another state machine. + // These elements can be used as source or target for transitions. + const external_vertices& get_externals() const; + + //!\brief Get a list of elements that are not part of this state machine, but of another state machine. + external_vertices& get_externals(); + + //!\brief Add a new external vertex. + //!\param _external_vertex The vertex that is added to the list of external vertices. + void add_external_vertex( external_uptr _external_vertex ); + + //!\brief Remove an element from the list of external vertices. + //!\param _index Index of the element to be deleted. + void remove_external_vertex( const size_t _index ); + private: transition_models transitions_; composite_state_model_uptr root_state_; events event_list_; + external_vertices externals_; }; diff --git a/yasmine_model/include/state_model.hpp b/yasmine_model/include/state_model.hpp index 7c555b8..ee32737 100644 --- a/yasmine_model/include/state_model.hpp +++ b/yasmine_model/include/state_model.hpp @@ -49,7 +49,11 @@ class state_model : public virtual state_machine_element_model SX_NO_COPY( state_model ) virtual raw_const_transition_models get_transitions() const = 0; virtual const event_ids& get_deferred_events() const = 0; + virtual void add_deferred_event( const event_id _deferred_event_id ) = 0; + virtual void remove_deferred_event( const event_id _deferred_event_id ) = 0; + virtual bool defers_event( const event_id _id ) const = 0; virtual const raw_const_region_models get_regions() const = 0; + virtual const size_t get_regions_count() const = 0; virtual const std::string& get_enter_behavior() const = 0; virtual void set_enter_behavior( const std::string& _enter_behavior ) = 0; virtual const std::string& get_do_behavior() const = 0; @@ -57,6 +61,8 @@ class state_model : public virtual state_machine_element_model virtual const std::string& get_exit_behavior() const = 0; virtual void set_exit_behavior( const std::string& _exit_behavior ) = 0; virtual void accept( model_vertex_visitor& _constructor_visitor ) const = 0; + virtual void get_event_references( std::vector& _elements, + const event_sptr _event ) = 0; }; diff --git a/yasmine_model/include/state_model_impl.hpp b/yasmine_model/include/state_model_impl.hpp index ba28f2e..b8623c5 100644 --- a/yasmine_model/include/state_model_impl.hpp +++ b/yasmine_model/include/state_model_impl.hpp @@ -39,11 +39,37 @@ class state_model_impl: const event_ids& _deferred_events = event_ids() ); virtual ~state_model_impl() SX_NOEXCEPT; SX_NO_COPY( state_model_impl ) + + //!\brief Get the number of regions of the state. + virtual const size_t get_regions_count() const SX_OVERRIDE; + //!\brief Get the list of transitions of the state. virtual raw_const_transition_models get_transitions() const SX_OVERRIDE; - //!\brief Get the list of IDs of deferred events. + + //!\brief Get list of IDs of deferred events. virtual const event_ids& get_deferred_events() const SX_OVERRIDE; + //!\brief Add a deferred event ID to the list of deferred events. + //!\param _deferred_event_id Event ID to add as deferred event. + virtual void add_deferred_event( const event_id _deferred_event_id ) SX_OVERRIDE; + + //!\brief Remove a deferred event ID from the list of deferred events. + //!\param _deferred_event_id Event ID to remove from deferred events. + virtual void remove_deferred_event( const event_id _deferred_event_id ) SX_OVERRIDE; + + //!\brief Check if the state defers the given event ID. + //!\param _id Event ID to check if it is deferred. + //!\return True if event ID is deferred, false otherwise. + virtual bool defers_event( const event_id _id ) const SX_OVERRIDE; + + virtual state_machine_element_model* get_child( const sxe::uri& _uri ) SX_OVERRIDE; + + //!\brief Fill the given list with the elements that defer the given event. + //!\param _elements List of elements that defer the given event. + //!\param _event Deferred event. + virtual void get_event_references( std::vector& _elements, + const event_sptr _event ) SX_OVERRIDE; + private: transition_models transitions_; diff --git a/yasmine_model/include/terminate_pseudostate_model_fwd.hpp b/yasmine_model/include/terminate_pseudostate_model_fwd.hpp index 8717a37..44080e3 100644 --- a/yasmine_model/include/terminate_pseudostate_model_fwd.hpp +++ b/yasmine_model/include/terminate_pseudostate_model_fwd.hpp @@ -23,10 +23,10 @@ namespace model { -class terminate_pseudostate_model; +class terminate_pseudostate_model_impl; -typedef sxe::SX_UNIQUE_PTR terminate_pseudostate_model_uptr; +typedef sxe::SX_UNIQUE_PTR terminate_pseudostate_model_uptr; } diff --git a/yasmine_model/include/terminate_pseudostate_model_impl.hpp b/yasmine_model/include/terminate_pseudostate_model_impl.hpp index 160f3f1..fcb4937 100644 --- a/yasmine_model/include/terminate_pseudostate_model_impl.hpp +++ b/yasmine_model/include/terminate_pseudostate_model_impl.hpp @@ -41,6 +41,7 @@ class terminate_pseudostate_model_impl SX_FINAL: virtual ~terminate_pseudostate_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( terminate_pseudostate_model_impl ) virtual void accept( model_vertex_visitor& _constructor_visitor ) const SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; }; diff --git a/yasmine_model/include/transition_model.hpp b/yasmine_model/include/transition_model.hpp index 4c1bc39..7a5b968 100644 --- a/yasmine_model/include/transition_model.hpp +++ b/yasmine_model/include/transition_model.hpp @@ -45,11 +45,20 @@ class transition_model: public virtual state_machine_element_model SX_NO_COPY( transition_model ) virtual transition_model_kind get_kind() const = 0; + virtual void set_kind( transition_model_kind _kind ) = 0; virtual const std::string& get_behavior() const = 0; + virtual void set_behavior( const std::string& _behavior ) = 0; virtual const std::string& get_guard() const = 0; + virtual void set_guard( const std::string& _guard ) = 0; virtual const sxe::uri& get_source() const = 0; + virtual void set_source( const std::string& _source ) = 0; virtual const sxe::uri& get_target() const = 0; + virtual void set_target( const std::string& _target ) = 0; virtual const event_ids& get_event_ids() const = 0; + virtual void set_event_ids( event_ids& _event_ids ) = 0; + virtual void add_event( const event_id _id ) = 0; + virtual void remove_event( const event_id _id ) = 0; + virtual bool has_trigger( const event_id _id ) const = 0; }; diff --git a/yasmine_model/include/transition_model_impl.hpp b/yasmine_model/include/transition_model_impl.hpp index 68769b1..59f81ad 100644 --- a/yasmine_model/include/transition_model_impl.hpp +++ b/yasmine_model/include/transition_model_impl.hpp @@ -46,29 +46,74 @@ class transition_model_impl: const event_ids& _events ); virtual ~transition_model_impl() SX_NOEXCEPT SX_OVERRIDE; SX_NO_COPY( transition_model_impl ) + + //!\brief Get the kind of the transition. + //!\return Kind of the transition. virtual transition_model_kind get_kind() const SX_OVERRIDE; + //!\brief Set the kind of the transition. + //!\param _kind Kind of the transition. + virtual void set_kind( transition_model_kind _kind ) SX_OVERRIDE; + //!\brief Get the behavior of the transition. //!\return String behavior of the transition. virtual const std::string& get_behavior() const SX_OVERRIDE; + + //!\brief Set the behavior of the transition. + //!\param _behavior Behavior of the transition. + virtual void set_behavior( const std::string& _behavior ) SX_OVERRIDE; + //!\brief Get the guard of the transition. //!\return String guard of the transition. virtual const std::string& get_guard() const SX_OVERRIDE; + + //!\brief Set the guard of the transition. + //!\param _guard Guard of the transition. + virtual void set_guard( const std::string& _guard ) SX_OVERRIDE; + //!\brief Get the URI of the transition's source vertex. virtual const sxe::uri& get_source() const SX_OVERRIDE; + + //!\brief Set the source of the transition. + //!\param _source Source of the transition. + virtual void set_source( const std::string& _source ) SX_OVERRIDE; + //!\brief Set the URI of the transition's source vertex. virtual const sxe::uri& get_target() const SX_OVERRIDE; + + //!\brief Set the target of the transition. + //!\param _target Target of the transition. + virtual void set_target( const std::string& _target ) SX_OVERRIDE; + //!\brief Get the List of IDs of transition's events. - const event_ids& get_event_ids() const SX_OVERRIDE; + virtual const event_ids& get_event_ids() const SX_OVERRIDE; + + //!\brief Set the triggers of the transition. + //!\param _event_ids Triggers of the transition. + virtual void set_event_ids( event_ids& _event_ids ) SX_OVERRIDE; + + //!\brief Adds a triggers for transition. + //!\param _id Triggers of the transition. + virtual void add_event( const event_id _id ) SX_OVERRIDE; + + //!\brief Removes a trigger from the transition. + //!\param _id Triggers to be removed from the transition. + virtual void remove_event( const event_id _id ) SX_OVERRIDE; + + //!\brief Check if transition is fired by the given trigger. + virtual bool has_trigger( const event_id _id ) const SX_OVERRIDE; + + virtual state_machine_element_model* get_child( const sxe::uri& _uri ) SX_OVERRIDE; + virtual void accept_delete_visitor( delete_visitor& _delete_visitor ) SX_OVERRIDE; private: - const sxe::uri source_; - const sxe::uri target_; - const transition_model_kind kind_; - const std::string behavior_; - const std::string guard_; - const event_ids events_; + sxe::uri source_; + sxe::uri target_; + transition_model_kind kind_; + std::string behavior_; + std::string guard_; + event_ids events_; }; diff --git a/yasmine_model/source/choice_model_impl.cpp b/yasmine_model/source/choice_model_impl.cpp index f7db37c..581f5e7 100644 --- a/yasmine_model/source/choice_model_impl.cpp +++ b/yasmine_model/source/choice_model_impl.cpp @@ -11,6 +11,7 @@ #include "choice_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void choice_model_impl::accept( model_vertex_visitor& _constructor_visitor ) con } +void choice_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/composite_state_model_impl.cpp b/yasmine_model/source/composite_state_model_impl.cpp index 6a1042e..d6c83a6 100644 --- a/yasmine_model/source/composite_state_model_impl.cpp +++ b/yasmine_model/source/composite_state_model_impl.cpp @@ -10,11 +10,16 @@ #include "composite_state_model_impl.hpp" -#include "pseudostate_model.hpp" +#include + +#include "essentials/base.hpp" + +#include "pseudostate_model_impl.hpp" #include "model_vertex_visitor.hpp" #include "model_element_type.hpp" #include "region_model.hpp" -#include "essentials/base.hpp" +#include "model_exception.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -95,6 +100,22 @@ const raw_const_region_models composite_state_model_impl::get_regions() const } +const size_t composite_state_model_impl::get_regions_count() const +{ + return( regions_.size() ); +} + + +region_model& composite_state_model_impl::get_region( const size_t _index ) +{ + if( _index >= regions_.size() ) + { + throw exception( "Index out of range!" ); + } + return( *regions_.at( _index ) ); +} + + void composite_state_model_impl::add_region( region_model_uptr _region ) { _region->set_parent( this ); @@ -102,6 +123,16 @@ void composite_state_model_impl::add_region( region_model_uptr _region ) } +void composite_state_model_impl::remove_region( const size_t _index ) +{ + if( _index >= regions_.size() ) + { + throw exception( "Index out of range!" ); + } + regions_.erase( std::remove( regions_.begin(), regions_.end(), regions_.at( _index ) ) ); +} + + raw_const_pseduostate_models composite_state_model_impl::get_state_pseudostates() const { raw_const_pseduostate_models pseudostates; @@ -113,6 +144,22 @@ raw_const_pseduostate_models composite_state_model_impl::get_state_pseudostates( } +const size_t composite_state_model_impl::get_state_pseudostates_count() const +{ + return( state_pseudostates_.size() ); +} + + +pseudostate_model& composite_state_model_impl::get_state_pseudostate( const size_t _index ) +{ + if( _index >= state_pseudostates_.size() ) + { + throw exception( "Index out of range!" ); + } + return( *state_pseudostates_.at( _index ) ); +} + + void composite_state_model_impl::add_state_pseudostate( pseudostate_model_uptr _pseudostate ) { _pseudostate->set_parent( this ); @@ -120,12 +167,101 @@ void composite_state_model_impl::add_state_pseudostate( pseudostate_model_uptr _ } +void composite_state_model_impl::remove_state_pseudostate( const size_t _index ) +{ + if( _index >= state_pseudostates_.size() ) + { + throw exception( "Index out of range!" ); + } + state_pseudostates_.erase( std::remove( state_pseudostates_.begin(), state_pseudostates_.end(), state_pseudostates_.at( _index ) ) ); +} + + +state_machine_element_model* composite_state_model_impl::get_child( const sxe::uri& _uri ) +{ + state_machine_element_model* found_child = SX_NULLPTR; + sxe::uri local_uri = _uri; + if( get_name() == local_uri.get_front() ) + { + if( local_uri.size() == 1 ) + { + found_child = this; + } + else + { + local_uri.pop_front(); + const std::string child_to_find = local_uri.get_front(); + + for( size_t i = 0; i < regions_.size() && !found_child; ++i ) + { + if( regions_.at( i )->get_name() == child_to_find ) + { + if( local_uri.size() == 1 ) + { + found_child = regions_.at( i ).get(); + } + else + { + found_child = regions_.at( i )->get_child( local_uri ); + } + } + } + + if( !found_child ) + { + for( size_t j = 0; j < state_pseudostates_.size() && !found_child; ++j ) + { + if( state_pseudostates_.at( j )->get_name() == child_to_find ) + { + if( local_uri.size() == 1 ) + { + found_child = state_pseudostates_.at( j ).get(); + } + else + { + throw sxy::model::exception( "A state pseudostate cannot have children!" ); + } + } + } + } + + if( !found_child ) + { + throw sxy::model::exception( "Composite state '%' has no child with name '%'!", get_name(), child_to_find ); + } + } + } + return( found_child ); +} + + +void composite_state_model_impl::get_event_references( std::vector& _elements, + const event_sptr _event ) +{ + state_model_impl::get_event_references( _elements, _event ); + for( size_t i = 0; i < get_regions_count(); ++i ) + { + region_model& region = get_region( i ); + for( size_t j = 0; j < region.get_states_count(); ++j ) + { + region.get_state( j ).get_event_references( _elements, _event ); + } + } +} + + void composite_state_model_impl::accept( model_vertex_visitor& _constructor_visitor ) const { _constructor_visitor.visit( *this ); } +void composite_state_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/consts.cpp b/yasmine_model/source/consts.cpp index 9409d3a..0beed90 100644 --- a/yasmine_model/source/consts.cpp +++ b/yasmine_model/source/consts.cpp @@ -46,6 +46,7 @@ const char* const JSON_EVENT_PRIORITY = "priority"; const char* const JSON_VERSION = "version"; const char* const JSON_CURRENT_VERSION_VALUE = "2.0"; const char* const JSON_VERSION_1 = "1.0"; +const char* const JSON_EXTERNALS = "externals"; const std::string TYPE_TRANSITION = "transition"; diff --git a/yasmine_model/source/deep_history_model_impl.cpp b/yasmine_model/source/deep_history_model_impl.cpp index 5a38334..ac5903f 100644 --- a/yasmine_model/source/deep_history_model_impl.cpp +++ b/yasmine_model/source/deep_history_model_impl.cpp @@ -11,6 +11,7 @@ #include "deep_history_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void deep_history_model_impl::accept( model_vertex_visitor& _constructor_visitor } +void deep_history_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/delete_visitor.cpp b/yasmine_model/source/delete_visitor.cpp new file mode 100644 index 0000000..6f655d2 --- /dev/null +++ b/yasmine_model/source/delete_visitor.cpp @@ -0,0 +1,219 @@ +//////////////////////////////////////////////////////////////////////////////////////////////////////// +//// // +//// This file is part of the Seadex yasmine ecosystem (http://yasmine.seadex.de). // +//// Copyright (C) 2016-2017 Seadex GmbH // +//// // +//// Licensing information is available in the folder "license" which is part of this distribution. // +//// The same information is available on the www @ http://yasmine.seadex.de/Licenses.html. // +//// // +//////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "delete_visitor.hpp" + +#include + +#include "state_machine_model.hpp" +#include "simple_state_model_impl.hpp" +#include "composite_state_model_impl.hpp" +#include "final_state_model_impl.hpp" +#include "initial_pseudostate_model_impl.hpp" +#include "terminate_pseudostate_model_impl.hpp" +#include "join_model_impl.hpp" +#include "fork_model_impl.hpp" +#include "choice_model_impl.hpp" +#include "junction_model_impl.hpp" +#include "entry_point_model_impl.hpp" +#include "exit_point_model_impl.hpp" +#include "shallow_history_model_impl.hpp" +#include "deep_history_model_impl.hpp" +#include "transition_model.hpp" +#include "region_model_impl.hpp" +#include "model_exception.hpp" + + +namespace sxy +{ + + +namespace model +{ + + +delete_visitor::delete_visitor() +{ + // nothing to do... +} + + +delete_visitor::~delete_visitor() SX_NOEXCEPT +{ + // nothing to do... +} + + + +void delete_visitor::visit( simple_state_model& _simple_state ) +{ + delete_state( &_simple_state ); +} + + +void delete_visitor::visit( composite_state_model& _composite_state ) +{ + delete_state( &_composite_state ); +} + + +void delete_visitor::visit( final_state_model& _final_state ) +{ + delete_state( &_final_state ); +} + + +void delete_visitor::visit( initial_pseudostate_model_impl& _initial_pseudostate ) +{ + delete_pseudostate( &_initial_pseudostate ); +} + + +void delete_visitor::visit( terminate_pseudostate_model_impl& _terminate_pseudostate ) +{ + delete_pseudostate( &_terminate_pseudostate ); +} + + +void delete_visitor::visit( join_model_impl& _join ) +{ + delete_pseudostate( &_join ); +} + + +void delete_visitor::visit( fork_model_impl& _fork ) +{ + delete_pseudostate( &_fork ); +} + + +void delete_visitor::visit( choice_model_impl& _choice ) +{ + delete_pseudostate( &_choice ); +} + + +void delete_visitor::visit( junction_model_impl& _junction ) +{ + delete_pseudostate( &_junction ); +} + + +void delete_visitor::visit( entry_point_model_impl& _entry_point ) +{ + delete_state_pseudostate( &_entry_point ); +} + + +void delete_visitor::visit( exit_point_model_impl& _exit_point ) +{ + delete_state_pseudostate( &_exit_point ); +} + + +void delete_visitor::visit( shallow_history_model_impl& _shallow_history ) +{ + delete_state_pseudostate( &_shallow_history ); +} + + +void delete_visitor::visit( deep_history_model_impl& _deep_history ) +{ + delete_state_pseudostate( &_deep_history ); +} + + +void delete_visitor::visit( transition_model& _transition ) +{ + state_machine_element_model* parent_of_transition = _transition.get_parent(); + if( parent_of_transition ) + { + sxy::model::state_machine_model* state_machine = + dynamic_cast< sxy::model::state_machine_model* >( parent_of_transition ); + if( state_machine ) + { + const raw_const_transition_models transitions = state_machine->get_transitions(); + const size_t idx = std::find( transitions.begin(), transitions.end(), &_transition ) - transitions.begin(); + state_machine->remove_transition( idx ); + } + } +} + + +void delete_visitor::visit( region_model& _region ) +{ + state_machine_element_model* parent_element = _region.get_parent(); + if( parent_element ) + { + sxy::model::composite_state_model* parent_state = + dynamic_cast< sxy::model::composite_state_model* >( parent_element ); + if( parent_state ) + { + const raw_const_region_models regions = parent_state->get_regions(); + const size_t idx = std::find( regions.begin(), regions.end(), &_region ) - regions.begin(); + parent_state->remove_region( idx ); + } + } +} + + +void delete_visitor::delete_state( state_model* _state ) +{ + state_machine_element_model* parent_element = _state->get_parent(); + if( parent_element ) + { + region_model* parent_region = dynamic_cast< region_model* >( parent_element ); + if( parent_region ) + { + const row_const_state_models states = parent_region->get_states(); + const size_t idx = std::find( states.begin(), states.end(), _state ) - states.begin(); + parent_region->remove_state( idx ); + } + } +} + + +void delete_visitor::delete_pseudostate( pseudostate_model_impl* _pseudostate ) +{ + state_machine_element_model* parent_element = _pseudostate->get_parent(); + if( parent_element ) + { + sxy::model::region_model* parent_region = dynamic_cast< sxy::model::region_model* >( parent_element ); + if( parent_region ) + { + const raw_const_pseduostate_models pseudostates = parent_region->get_pseudostates(); + const size_t idx = std::find( pseudostates.begin(), pseudostates.end(), _pseudostate ) - pseudostates.begin(); + parent_region->remove_pseudostate( idx ); + } + } +} + + +void delete_visitor::delete_state_pseudostate( pseudostate_model_impl* _state_pseudostate ) +{ + state_machine_element_model* parent_element = _state_pseudostate->get_parent(); + if( parent_element ) + { + sxy::model::composite_state_model* parent_state = + dynamic_cast< sxy::model::composite_state_model* >( parent_element ); + if( parent_state ) + { + const raw_const_pseduostate_models state_pseudostates = parent_state->get_state_pseudostates(); + const size_t idx = std::find( state_pseudostates.begin(), state_pseudostates.end(), _state_pseudostate ) - state_pseudostates.begin(); + parent_state->remove_state_pseudostate( idx ); + } + } +} + + +} + + +} diff --git a/yasmine_model/source/entry_point_model_impl.cpp b/yasmine_model/source/entry_point_model_impl.cpp index 1d41a22..13afd6f 100644 --- a/yasmine_model/source/entry_point_model_impl.cpp +++ b/yasmine_model/source/entry_point_model_impl.cpp @@ -11,6 +11,7 @@ #include "entry_point_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void entry_point_model_impl::accept( model_vertex_visitor& _constructor_visitor } +void entry_point_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/event_model.cpp b/yasmine_model/source/event_model.cpp index 4aa5a26..3f00bbc 100644 --- a/yasmine_model/source/event_model.cpp +++ b/yasmine_model/source/event_model.cpp @@ -19,28 +19,56 @@ namespace model { - event_model::event_model() - : name(), - id(), - priority() - { - // Nothing to do... - } - - - event_model::event_model( const std::string _name, const event_id _id, const event_priority _priority ) - : name( _name ), - id( _id ), - priority( _priority ) - { - // Nothing to do... - } - - - event_model::~event_model() SX_NOEXCEPT - { - // Nothing to do... - } + +event_model::event_model( const std::string _name, const event_id _id, const event_priority _priority ) + : name_( _name ), + id_( _id ), + priority_( _priority ) +{ + // Nothing to do... +} + + +event_model::~event_model() SX_NOEXCEPT +{ + // Nothing to do... +} + + +const std::string& event_model::get_name() const +{ + return( name_ ); +} + + +void event_model::set_name( const std::string& _name ) +{ + name_ = _name; +} + + +const event_id event_model::get_id() const +{ + return( id_ ); +} + + +void event_model::set_id( const event_id _id ) +{ + id_ = _id; +} + + +const event_priority event_model::get_priority() const +{ + return( priority_ ); +} + + +void event_model::set_priority( const event_priority _priority ) +{ + priority_ = _priority; +} } diff --git a/yasmine_model/source/event_model_id.cpp b/yasmine_model/source/event_model_id.cpp index c5d9bd9..f5997b0 100644 --- a/yasmine_model/source/event_model_id.cpp +++ b/yasmine_model/source/event_model_id.cpp @@ -8,10 +8,6 @@ // // ////////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef SX_CPP03_BOOST - - #include "event_model_id.hpp" namespace sxy @@ -27,25 +23,3 @@ namespace model } - -#else - - -#include "event_model_id.hpp" - -namespace sxy -{ - - - namespace model - { - - const event_id Y_MODEL_COMPLETION_EVENT_ID = std::numeric_limits::max(); - - } - - -} - - -#endif diff --git a/yasmine_model/source/exit_point_model_impl.cpp b/yasmine_model/source/exit_point_model_impl.cpp index a377ffb..8568cfc 100644 --- a/yasmine_model/source/exit_point_model_impl.cpp +++ b/yasmine_model/source/exit_point_model_impl.cpp @@ -11,6 +11,7 @@ #include "exit_point_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void exit_point_model_impl::accept( model_vertex_visitor& _constructor_visitor ) } +void exit_point_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/final_state_model_impl.cpp b/yasmine_model/source/final_state_model_impl.cpp index b3d87f6..90882e5 100644 --- a/yasmine_model/source/final_state_model_impl.cpp +++ b/yasmine_model/source/final_state_model_impl.cpp @@ -14,6 +14,7 @@ #include "model_vertex_visitor.hpp" #include "model_element_type.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -86,6 +87,11 @@ void final_state_model_impl::accept( model_vertex_visitor& _constructor_visitor } +void final_state_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + } diff --git a/yasmine_model/source/fork_model_impl.cpp b/yasmine_model/source/fork_model_impl.cpp index 89bcea5..57979b9 100644 --- a/yasmine_model/source/fork_model_impl.cpp +++ b/yasmine_model/source/fork_model_impl.cpp @@ -11,6 +11,7 @@ #include "fork_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void fork_model_impl::accept( model_vertex_visitor& _constructor_visitor ) const } +void fork_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/initial_pseudostate_model_impl.cpp b/yasmine_model/source/initial_pseudostate_model_impl.cpp index 9a08602..0a49a5e 100644 --- a/yasmine_model/source/initial_pseudostate_model_impl.cpp +++ b/yasmine_model/source/initial_pseudostate_model_impl.cpp @@ -11,6 +11,7 @@ #include "initial_pseudostate_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void initial_pseudostate_model_impl::accept( model_vertex_visitor& _constructor_ } +void initial_pseudostate_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/join_model_impl.cpp b/yasmine_model/source/join_model_impl.cpp index 1341114..c9efbeb 100644 --- a/yasmine_model/source/join_model_impl.cpp +++ b/yasmine_model/source/join_model_impl.cpp @@ -11,6 +11,7 @@ #include "join_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void join_model_impl::accept( model_vertex_visitor& _constructor_visitor ) const } +void join_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/json_reader.cpp b/yasmine_model/source/json_reader.cpp index c447f64..7520093 100644 --- a/yasmine_model/source/json_reader.cpp +++ b/yasmine_model/source/json_reader.cpp @@ -26,16 +26,16 @@ #include "state_machine_model.hpp" #include "region_model_impl.hpp" #include "pseudostate_model_impl.hpp" -#include "entry_point_model_impl.hpp" -#include "exit_point_model_impl.hpp" -#include "deep_history_model_impl.hpp" -#include "shallow_history_model_impl.hpp" #include "initial_pseudostate_model_impl.hpp" +#include "terminate_pseudostate_model_impl.hpp" #include "join_model_impl.hpp" -#include "junction_model_impl.hpp" #include "fork_model_impl.hpp" -#include "terminate_pseudostate_model_impl.hpp" #include "choice_model_impl.hpp" +#include "junction_model_impl.hpp" +#include "entry_point_model_impl.hpp" +#include "exit_point_model_impl.hpp" +#include "deep_history_model_impl.hpp" +#include "shallow_history_model_impl.hpp" #include "transition_model_impl.hpp" #include "model_exception.hpp" @@ -46,11 +46,12 @@ namespace sxy json_reader::json_reader( const std::string& _file ) : document_(), - model_() + model_() { read_json_file( _file ); check_document(); model_ = read_into_model(); + read_externals(); } @@ -66,9 +67,38 @@ model::state_machine_model_ptr json_reader::get_model_ptr() } -void json_reader::read_json_file( const std::string& _file ) +const model::external_vertices& json_reader::get_external_vertices() { + return( model_->get_externals() ); +} + + +void json_reader::read_externals() +{ + try{ + std::vector externals_list = + extract_members_from_array( get_object_member_array( document_, model::JSON_EXTERNALS ) ); + + SX_FOR( const rapidjson::Value* json_external, externals_list ) + { + sxy::model::model_element_type vertex_type = + model::model_element_type_from_string( get_object_member_string( sxe::ref( *json_external ), model::JSON_TYPE_NODE ) ); + const std::string name = get_object_member_string( sxe::ref( *json_external ), model::JSON_NAME_NODE ); + model_->add_external_vertex( SX_MAKE_UNIQUE( name, vertex_type ) ); + } + } + catch( const sxy::model::exception& _e ) + { + if( std::strcmp( _e.what(), "Member externals was not found!" ) != 0 ) + { + throw; + } + } +} + +void json_reader::read_json_file( const std::string& _file ) +{ #ifndef SX_CPP03_BOOST std::ifstream infile( _file, std::ios::in ); #else @@ -126,6 +156,22 @@ sxy::model::event_ids json_reader::read_deferred_events( const rapidjson::Value& } +sxy::model::event_ids json_reader::read_error_events( const rapidjson::Value& _state ) const +{ + std::vector error_event_list = + extract_members_from_array( get_object_member_array( _state, model::JSON_ERROR_EVENT ) ); + + sxy::model::event_ids error_events; + SX_FOR( const rapidjson::Value* const an_event, error_event_list ) + { + const std::string event_name = get_object_member_string( sxe::ref( *an_event ), model::JSON_EVENT_NAME ); + sxy::model::event_id event_id = get_event_id_by_name( event_name ); + error_events.push_back( event_id ); + } + return( error_events ); +} + + model::composite_state_model_uptr json_reader::read_composite_state( const rapidjson::Value& _root ) { std::string name = get_object_member_string( sxe::ref(_root), model::JSON_NAME_NODE ); @@ -177,7 +223,21 @@ model::simple_state_model_uptr json_reader::read_simple_state( const rapidjson:: } catch ( ... ) { - // Nothing to do... + // try to read error event as a list of error event objects + try + { + sxy::model::event_ids error_events = read_error_events( _state ); + if( !error_events.empty() ) + { + const std::string event_name = get_event_name( error_events.at( 0 ) ); + error_event = SX_MAKE_SHARED( event_name, error_events.at( 0 ), + get_event_priority_by_name( event_name ) ); + } + } + catch( ... ) + { + // Nothing to do... + } } sxe::SX_UNIQUE_PTR< model::simple_state_model_impl > simple_state = SX_MAKE_UNIQUE< model::simple_state_model_impl >( name, enter_behavior, @@ -197,21 +257,21 @@ model::final_state_model_uptr json_reader::read_final_state( const rapidjson::Va model::region_model_impl_uptr json_reader::read_region( const rapidjson::Value& _region ) { - const std::string name = get_object_member_string( sxe::ref( _region), model::JSON_NAME_NODE ); + const std::string name = get_object_member_string( sxe::ref( _region ), model::JSON_NAME_NODE ); sxe::SX_UNIQUE_PTR< model::region_model_impl > region = SX_MAKE_UNIQUE< model::region_model_impl >( name ); - std::vector vertices = + std::vector vertices = extract_members_from_array( get_object_member_array( _region, model::JSON_VERTICES_NODE ) ); SX_FOR( const rapidjson::Value* vertice, vertices ) { - sxy::model::model_element_type vertice_type = model::model_element_type_from_string( get_object_member_string( sxe::ref( *vertice ), + sxy::model::model_element_type vertex_type = model::model_element_type_from_string( get_object_member_string( sxe::ref( *vertice ), model::JSON_TYPE_NODE ) ); - if( vertice_type == sxy::model::model_element_type::TYE_SIMPLE_STATE || - vertice_type == sxy::model::model_element_type::TYE_ASYNC_SIMPLE_STATE || - vertice_type == sxy::model::model_element_type::TYE_COMPOSITE_STATE || - vertice_type == sxy::model::model_element_type::TYE_FINAL_STATE ) + if( vertex_type == sxy::model::model_element_type::TYE_SIMPLE_STATE || + vertex_type == sxy::model::model_element_type::TYE_ASYNC_SIMPLE_STATE || + vertex_type == sxy::model::model_element_type::TYE_COMPOSITE_STATE || + vertex_type == sxy::model::model_element_type::TYE_FINAL_STATE ) { sxy::model::state_model_uptr state = read_state( *vertice ); region->add_state( sxe::move( state ) ); @@ -223,6 +283,37 @@ model::region_model_impl_uptr json_reader::read_region( const rapidjson::Value& } } + // backward compatibility -> in the region there is one list : 'vertices'. Before there were two: 'states' and 'pseudostates'. + try{ + std::vector pseudostates_vertices = + extract_members_from_array( get_object_member_array( _region, model::JSON_PSEUDOSTATES_NODE ) ); + SX_FOR( const rapidjson::Value* pseudostate_vertex, pseudostates_vertices ) + { + sxy::model::model_element_type vertex_type = model::model_element_type_from_string( get_object_member_string( sxe::ref( *pseudostate_vertex ), + model::JSON_TYPE_NODE ) ); + + if( vertex_type == sxy::model::model_element_type::TYE_SIMPLE_STATE || + vertex_type == sxy::model::model_element_type::TYE_ASYNC_SIMPLE_STATE || + vertex_type == sxy::model::model_element_type::TYE_COMPOSITE_STATE || + vertex_type == sxy::model::model_element_type::TYE_FINAL_STATE ) + { + // Nothing to do... + } + else + { + sxy::model::pseudostate_model_uptr pseudostate = read_pseudostate( *pseudostate_vertex ); + region->add_pseudostate( sxe::move( pseudostate ) ); + } + } + } + catch( const model::exception& _e ) + { + if( ::std::strcmp( _e.what(), "Member pseudostates was not found!" ) != 0 ) + { + throw; + } + } + return( region ); } @@ -515,6 +606,26 @@ sxe::int32_t json_reader::get_event_id_by_name( const std::string& _name ) const } +std::string json_reader::get_event_name( const sxe::int32_t _event_id ) const +{ + std::string event_name = ""; + std::vector event_list = + extract_members_from_array( get_object_member_array( document_, model::JSON_EVENT_LIST_NODE ) ); + + SX_FOR( const rapidjson::Value* const an_event, event_list ) + { + // FixME: safe cast + sxe::int32_t event_id = static_cast< sxe::int32_t >( get_object_member_int( sxe::ref( *an_event ), model::JSON_EVENT_ID ) ); + if( event_id == _event_id ) + { + event_name = get_object_member_string( sxe::ref( *an_event ), model::JSON_EVENT_NAME ); + break; + } + } + return( event_name ); +} + + sxe::int8_t json_reader::get_event_priority_by_name( const std::string& _name ) const { #ifdef SX_CPP03_BOOST diff --git a/yasmine_model/source/json_writer.cpp b/yasmine_model/source/json_writer.cpp index 865b808..3adaa03 100644 --- a/yasmine_model/source/json_writer.cpp +++ b/yasmine_model/source/json_writer.cpp @@ -12,8 +12,6 @@ #include -#include - #include "essentials/exception.hpp" #include "essentials/base.hpp" @@ -62,10 +60,13 @@ void json_writer::write_json_to_file( const std::string& _json_file, const model rapidjson::Value root( rapidjson::kObjectType ); sxy::model::composite_state_model_impl& root_state = _state_machine_model.get_root_state(); - fill_composite_state_object( root_state, root, doc.GetAllocator() ); + fill_composite_state_object( root_state, root, doc.GetAllocator(), _state_machine_model ); json_state_machine.AddMember( rapidjson::StringRef( model::JSON_ROOT_NODE ), root, doc.GetAllocator() ); doc.AddMember( rapidjson::StringRef( model::JSON_STATE_MACHINE_NODE ), json_state_machine, doc.GetAllocator() ); + + add_externals( _state_machine_model, doc, doc.GetAllocator() ); + rapidjson::StringBuffer string_buffer; rapidjson::PrettyWriter< rapidjson::StringBuffer > writer( string_buffer ); doc.Accept( writer ); @@ -104,11 +105,11 @@ void json_writer::add_version( rapidjson::Value& _document, rapidjson::MemoryPoo void json_writer::add_events_from_model( const model::state_machine_model& _state_machine_model, rapidjson::Value& _events, rapidjson::MemoryPoolAllocator< >& _allocator ) { - SX_FOR( const sxy::model::event_model& an_event, _state_machine_model.get_events() ) + SX_FOR( model::event_sptr an_event, _state_machine_model.get_events() ) { - const std::string name = an_event.name; - sxy::model::event_id id = an_event.id; - sxy::model::event_priority priority = an_event.priority; + const std::string name = an_event->get_name(); + sxy::model::event_id id = an_event->get_id(); + sxy::model::event_priority priority = an_event->get_priority(); rapidjson::Value json_event( rapidjson::kObjectType ); rapidjson::Value name_val; @@ -168,12 +169,13 @@ void json_writer::add_transitions_from_model( const model::state_machine_model& void json_writer::add_regions_from_model( const model::composite_state_model& _composite_state_model, - rapidjson::Value& _regions, rapidjson::MemoryPoolAllocator< >& _allocator ) + rapidjson::Value& _regions, rapidjson::MemoryPoolAllocator< >& _allocator, + const model::state_machine_model& _state_machine_model ) { SX_FOR( const sxy::model::region_model* const region, _composite_state_model.get_regions() ) { rapidjson::Value json_region( rapidjson::kObjectType ); - fill_region_object( *region, json_region, _allocator ); + fill_region_object( *region, json_region, _allocator, _state_machine_model ); if( json_region.IsObject() ) { _regions.PushBack( json_region.Move(), _allocator ); @@ -183,12 +185,12 @@ void json_writer::add_regions_from_model( const model::composite_state_model& _c void json_writer::fill_region_object( const model::region_model& _region_model, rapidjson::Value& _region, - rapidjson::MemoryPoolAllocator< >& _allocator ) + rapidjson::MemoryPoolAllocator< >& _allocator, const model::state_machine_model& _state_machine_model ) { rapidjson::Value name_node; _region.AddMember( rapidjson::StringRef( model::JSON_NAME_NODE ), create_rapidjson_string_value( _region_model.get_name(), name_node ).Move(), _allocator ); - rapidjson::Value json_states( rapidjson::kArrayType ); + rapidjson::Value json_vertices( rapidjson::kArrayType ); SX_FOR( const sxy::model::state_model* const one_state_model, _region_model.get_states() ) { @@ -201,13 +203,14 @@ void json_writer::fill_region_object( const model::region_model& _region_model, #endif { case model::model_element_type::TYE_SIMPLE_STATE: + case model::model_element_type::TYE_ASYNC_SIMPLE_STATE: { const model::simple_state_model_impl* simple_state_model = dynamic_cast< const model::simple_state_model_impl* >( one_state_model ); SX_ASSERT( simple_state_model, "Simple state cannot be written to json file!" ); rapidjson::Value json_state( rapidjson::kObjectType ); - fill_simple_state_object( *simple_state_model, json_state, _allocator ); - json_states.PushBack( json_state, _allocator ); + fill_simple_state_object( *simple_state_model, json_state, _allocator, _state_machine_model ); + json_vertices.PushBack( json_state, _allocator ); break; } @@ -217,8 +220,8 @@ void json_writer::fill_region_object( const model::region_model& _region_model, dynamic_cast< const model::composite_state_model_impl* >( one_state_model ); SX_ASSERT( composite_state_state_model, "Composite state cannot be written to json file!" ); rapidjson::Value json_state( rapidjson::kObjectType ); - fill_composite_state_object( *composite_state_state_model, json_state, _allocator ); - json_states.PushBack( json_state, _allocator ); + fill_composite_state_object( *composite_state_state_model, json_state, _allocator, _state_machine_model ); + json_vertices.PushBack( json_state, _allocator ); break; } @@ -229,7 +232,7 @@ void json_writer::fill_region_object( const model::region_model& _region_model, SX_ASSERT( final_state_model, "Final state cannot be written to json file!" ); rapidjson::Value json_state( rapidjson::kObjectType ); fill_final_state_object( *final_state_model, json_state, _allocator ); - json_states.PushBack( json_state, _allocator ); + json_vertices.PushBack( json_state, _allocator ); break; } @@ -238,17 +241,15 @@ void json_writer::fill_region_object( const model::region_model& _region_model, } } - _region.AddMember( rapidjson::StringRef( model::JSON_VERTICES_NODE ), json_states, _allocator ); - rapidjson::Value json_pseudostates( rapidjson::kArrayType ); - SX_FOR( const sxy::model::pseudostate_model* const pseudostate, _region_model.get_pseudostates() ) { rapidjson::Value json_pseudostate( rapidjson::kObjectType ); fill_pseudostate_object( *pseudostate, json_pseudostate, _allocator ); - json_pseudostates.PushBack( json_pseudostate, _allocator ); + json_vertices.PushBack( json_pseudostate, _allocator ); } - _region.AddMember( rapidjson::StringRef( model::JSON_PSEUDOSTATES_NODE ), json_pseudostates, _allocator ); + _region.AddMember( rapidjson::StringRef( model::JSON_VERTICES_NODE ), json_vertices, _allocator ); + rapidjson::Value json_pseudostates( rapidjson::kArrayType ); } @@ -260,7 +261,8 @@ void json_writer::fill_pseudostate_object( const model::pseudostate_model& _pseu void json_writer::fill_simple_state_object( const model::simple_state_model& _simple_state_model, - rapidjson::Value& _simple_state, rapidjson::MemoryPoolAllocator< >& _allocator ) + rapidjson::Value& _simple_state, rapidjson::MemoryPoolAllocator< >& _allocator, + const model::state_machine_model& _state_machine_model ) { if( _simple_state_model.is_async() ) { @@ -286,18 +288,39 @@ void json_writer::fill_simple_state_object( const model::simple_state_model& _si _simple_state.AddMember( rapidjson::StringRef( model::JSON_EXIT_BEHAVIOR_NODE ), create_rapidjson_string_value( _simple_state_model.get_exit_behavior(), transition_exit_behavior ).Move(), _allocator ); rapidjson::Value deferred_events( rapidjson::kArrayType ); + SX_FOR( const sxy::model::event_id event_ID, _simple_state_model.get_deferred_events() ) + { + rapidjson::Value json_deferred_event( rapidjson::kObjectType ); + rapidjson::Value json_event_name; + const size_t deferred_event_index = get_event_index_by_id( event_ID, _state_machine_model ); + json_deferred_event.AddMember( rapidjson::StringRef( model::JSON_NAME_NODE ), + create_rapidjson_string_value( _state_machine_model.get_event( deferred_event_index ).get_name(), json_event_name ).Move(), _allocator ); + deferred_events.PushBack( json_deferred_event.Move(), _allocator ); + } _simple_state.AddMember( rapidjson::StringRef( model::JSON_DEFERRED_EVENTS ), deferred_events, _allocator ); + + rapidjson::Value error_events( rapidjson::kArrayType ); + if( _simple_state_model.has_error_event() ) + { + rapidjson::Value json_error_event( rapidjson::kObjectType ); + rapidjson::Value json_event_name; + json_error_event.AddMember( rapidjson::StringRef( model::JSON_NAME_NODE ), + create_rapidjson_string_value( _simple_state_model.get_error_event()->get_name(), json_event_name ).Move(), _allocator ); + error_events.PushBack( json_error_event.Move(), _allocator ); + } + _simple_state.AddMember( rapidjson::StringRef( model::JSON_ERROR_EVENT ), error_events, _allocator ); } void json_writer::fill_composite_state_object( const model::composite_state_model& _composite_state_model, - rapidjson::Value& _composite_state, rapidjson::MemoryPoolAllocator< >& _allocator ) + rapidjson::Value& _composite_state, rapidjson::MemoryPoolAllocator< >& _allocator, + const model::state_machine_model& _state_machine_model ) { fill_base_info( _composite_state, _composite_state_model, _allocator ); // regions rapidjson::Value json_regions( rapidjson::kArrayType ); - add_regions_from_model( _composite_state_model, json_regions, _allocator ); + add_regions_from_model( _composite_state_model, json_regions, _allocator, _state_machine_model ); _composite_state.AddMember( rapidjson::StringRef( model::JSON_REGIONS_NODE ), json_regions, _allocator ); // state_pseudostates @@ -312,6 +335,18 @@ void json_writer::fill_composite_state_object( const model::composite_state_mode rapidjson::Value transition_exit_behavior; _composite_state.AddMember( rapidjson::StringRef( model::JSON_EXIT_BEHAVIOR_NODE ), create_rapidjson_string_value( _composite_state_model.get_exit_behavior(), transition_exit_behavior ).Move(), _allocator ); + + rapidjson::Value deferred_events( rapidjson::kArrayType ); + SX_FOR( const sxy::model::event_id event_ID, _composite_state_model.get_deferred_events() ) + { + rapidjson::Value json_deferred_event( rapidjson::kObjectType ); + rapidjson::Value json_event_name; + const size_t deferred_event_index = get_event_index_by_id( event_ID, _state_machine_model ); + json_deferred_event.AddMember( rapidjson::StringRef( model::JSON_NAME_NODE ), + create_rapidjson_string_value( _state_machine_model.get_event( deferred_event_index ).get_name(), json_event_name ).Move(), _allocator ); + deferred_events.PushBack( json_deferred_event.Move(), _allocator ); + } + _composite_state.AddMember( rapidjson::StringRef( model::JSON_DEFERRED_EVENTS ), deferred_events, _allocator ); } @@ -359,11 +394,11 @@ const std::string json_writer::get_event_name_by_id( const sxy::model::event_id& const model::state_machine_model& _state_machine_model ) { std::string event_name = ""; - SX_FOR( const sxy::model::event_model& an_event , _state_machine_model.get_events() ) + SX_FOR( model::event_sptr an_event, _state_machine_model.get_events() ) { - if( _event_id == an_event.id ) + if( _event_id == an_event->get_id() ) { - event_name = an_event.name; + event_name = an_event->get_name(); break; } } @@ -372,4 +407,46 @@ const std::string json_writer::get_event_name_by_id( const sxy::model::event_id& } +const size_t json_writer::get_event_index_by_id( const sxy::model::event_id& _event_id, + const model::state_machine_model& _state_machine_model ) +{ + size_t index = _state_machine_model.get_transitions().size(); + for( size_t i = 0; i < _state_machine_model.get_transitions().size(); ++i ) + { + if( _state_machine_model.get_events().at( i )->get_id() == _event_id ) + { + index = i; + break; + } + } + return( index ); +} + + +void json_writer::add_externals( const model::state_machine_model& _state_machine_model, rapidjson::Value& _document, + rapidjson::MemoryPoolAllocator< >& _allocator ) +{ + rapidjson::Value json_externals( rapidjson::kArrayType ); + SX_FOR( const model::external_uptr& vertex, _state_machine_model.get_externals() ) + { + rapidjson::Value json_vertex( rapidjson::kObjectType ); + + // name + rapidjson::Value name_node; + json_vertex.AddMember( rapidjson::StringRef( model::JSON_NAME_NODE ), + create_rapidjson_string_value( vertex->get_name(), name_node ).Move(), _allocator ); + + // type + rapidjson::Value type_node; + const std::string node_type = model_element_type_to_string( vertex->get_type() ); + type_node.SetString( node_type.c_str(), node_type.length(), _allocator ); + json_vertex.AddMember( rapidjson::StringRef( model::JSON_TYPE_NODE ), type_node.Move(), _allocator ); + + json_externals.PushBack( json_vertex, _allocator ); + } + + _document.AddMember( rapidjson::StringRef( model::JSON_EXTERNALS ), json_externals, _allocator ); +} + + } diff --git a/yasmine_model/source/junction_model_impl.cpp b/yasmine_model/source/junction_model_impl.cpp index 5038a28..5f06298 100644 --- a/yasmine_model/source/junction_model_impl.cpp +++ b/yasmine_model/source/junction_model_impl.cpp @@ -11,6 +11,7 @@ #include "junction_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void junction_model_impl::accept( model_vertex_visitor& _constructor_visitor ) c } +void junction_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/model_version.cpp b/yasmine_model/source/model_version.cpp index 3533d0a..7f9bfa6 100644 --- a/yasmine_model/source/model_version.cpp +++ b/yasmine_model/source/model_version.cpp @@ -30,8 +30,8 @@ namespace const sxe::uint16_t VERSION_MAJOR( 0 ); -const sxe::uint16_t VERSION_MINOR( 1 ); -const sxe::uint16_t VERSION_PATCH( 5 ); +const sxe::uint16_t VERSION_MINOR( 2 ); +const sxe::uint16_t VERSION_PATCH( 0 ); } diff --git a/yasmine_model/source/pseudostate_model_impl.cpp b/yasmine_model/source/pseudostate_model_impl.cpp index 7f6845f..d86f206 100644 --- a/yasmine_model/source/pseudostate_model_impl.cpp +++ b/yasmine_model/source/pseudostate_model_impl.cpp @@ -10,7 +10,10 @@ #include "pseudostate_model_impl.hpp" +#include "essentials/base.hpp" + #include "transition_model.hpp" +#include "model_exception.hpp" namespace sxy @@ -68,6 +71,13 @@ void pseudostate_model_impl::add_outgoing_transition( transition_models _outgoin } +state_machine_element_model* pseudostate_model_impl::get_child( const sxe::uri& _uri ) +{ + SX_UNUSED_PARAMETER( _uri ); + throw sxy::model::exception( "Pseudostates cannot have children!" ); +} + + } diff --git a/yasmine_model/source/region_model_impl.cpp b/yasmine_model/source/region_model_impl.cpp index e44565a..d8bb544 100644 --- a/yasmine_model/source/region_model_impl.cpp +++ b/yasmine_model/source/region_model_impl.cpp @@ -10,8 +10,12 @@ #include "region_model_impl.hpp" -#include "pseudostate_model.hpp" +#include + +#include "pseudostate_model_impl.hpp" #include "state_model.hpp" +#include "model_exception.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -46,6 +50,22 @@ row_const_state_models region_model_impl::get_states() const } +const size_t region_model_impl::get_states_count() const +{ + return( states_.size() ); +} + + +state_model& region_model_impl::get_state( const size_t _index ) +{ + if( _index >= states_.size() ) + { + throw exception( "Index out of range!" ); + } + return( *states_.at( _index ) ); +} + + void region_model_impl::add_state( state_model_uptr _state ) { _state->set_parent( this ); @@ -53,6 +73,16 @@ void region_model_impl::add_state( state_model_uptr _state ) } +void region_model_impl::remove_state( const size_t _index ) +{ + if( _index >= states_.size() ) + { + throw exception( "Index out of range!" ); + } + states_.erase( std::remove( states_.begin(), states_.end(), states_.at( _index ) ) ); +} + + raw_const_pseduostate_models region_model_impl::get_pseudostates() const { raw_const_pseduostate_models pseudostates; @@ -64,6 +94,22 @@ raw_const_pseduostate_models region_model_impl::get_pseudostates() const } +const size_t region_model_impl::get_pseudostates_count() const +{ + return( pseudostates_.size() ); +} + + +pseudostate_model& region_model_impl::get_pseudostate( const size_t _index ) +{ + if( _index >= pseudostates_.size() ) + { + throw exception( "Index out of range!" ); + } + return( *pseudostates_.at( _index ) ); +} + + void region_model_impl::add_pseudostate( pseudostate_model_uptr _pseudostate ) { _pseudostate->set_parent( this ); @@ -71,6 +117,71 @@ void region_model_impl::add_pseudostate( pseudostate_model_uptr _pseudostate ) } +void region_model_impl::remove_pseudostate( const size_t _index ) +{ + if( _index >= pseudostates_.size() ) + { + throw exception( "Index out of range!" ); + } + pseudostates_.erase( std::remove( pseudostates_.begin(), pseudostates_.end(), pseudostates_.at( _index ) ) ); +} + + +state_machine_element_model* region_model_impl::get_child( const sxe::uri& _uri ) +{ + state_machine_element_model* found_child = SX_NULLPTR; + sxe::uri local_uri = _uri; + local_uri.pop_front(); + const std::string child_to_find = local_uri.get_front(); + + for( size_t i = 0; i < states_.size() && !found_child; ++i ) + { + if( states_.at( i )->get_name() == child_to_find ) + { + if( local_uri.size() == 1 ) + { + found_child = states_.at( i ).get(); + } + else + { + found_child = states_.at( i )->get_child( local_uri ); + } + } + } + + if( !found_child ) + { + for( size_t j = 0; j < pseudostates_.size() && !found_child; ++j ) + { + if( pseudostates_.at( j )->get_name() == child_to_find ) + { + if( local_uri.size() == 1 ) + { + found_child = pseudostates_.at( j ).get(); + } + else + { + throw sxy::model::exception( "A pseudostate cannot have children!" ); + } + } + } + } + + if( !found_child ) + { + throw sxy::model::exception( "Region '%' has no child with name '%'!", get_name(), child_to_find ); + } + + return( found_child ); +} + + +void region_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/shallow_history_model_impl.cpp b/yasmine_model/source/shallow_history_model_impl.cpp index e5d66b9..bba3ac0 100644 --- a/yasmine_model/source/shallow_history_model_impl.cpp +++ b/yasmine_model/source/shallow_history_model_impl.cpp @@ -11,6 +11,7 @@ #include "shallow_history_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void shallow_history_model_impl::accept( model_vertex_visitor& _constructor_visi } +void shallow_history_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/simple_state_model_impl.cpp b/yasmine_model/source/simple_state_model_impl.cpp index 3cfed56..8bc32f0 100644 --- a/yasmine_model/source/simple_state_model_impl.cpp +++ b/yasmine_model/source/simple_state_model_impl.cpp @@ -12,6 +12,7 @@ #include "model_vertex_visitor.hpp" #include "model_element_type.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -25,7 +26,7 @@ namespace model simple_state_model_impl::simple_state_model_impl( const std::string& _name, const std::string& _enter_behavior, const std::string& _do_behavior, const std::string& _exit_behavior, const event_ids& _deferred_events, event_sptr _error_event, bool _is_async) - : state_model_impl( _name, model_element_type::TYE_SIMPLE_STATE, _deferred_events ), + : state_model_impl( _name, _is_async ? model_element_type::TYE_ASYNC_SIMPLE_STATE : model_element_type::TYE_SIMPLE_STATE, _deferred_events ), enter_behavior_( _enter_behavior ), do_behavior_( _do_behavior ), exit_behavior_( _exit_behavior ), @@ -36,7 +37,21 @@ simple_state_model_impl::simple_state_model_impl( const std::string& _name, cons } -simple_state_model_impl::~simple_state_model_impl()SX_NOEXCEPT +simple_state_model_impl::simple_state_model_impl( const std::string& _name, bool _is_async, const std::string& _enter_behavior, + const std::string& _do_behavior, const std::string& _exit_behavior, const event_ids& _deferred_events, + event_sptr _error_event ) + : state_model_impl( _name, _is_async ? model_element_type::TYE_ASYNC_SIMPLE_STATE : model_element_type::TYE_SIMPLE_STATE, _deferred_events ), + enter_behavior_( _enter_behavior ), + do_behavior_( _do_behavior ), + exit_behavior_( _exit_behavior ), + error_event_( _error_event ), + is_async_( _is_async ) +{ + // Nothing to do... +} + + +simple_state_model_impl::~simple_state_model_impl() SX_NOEXCEPT { // Nothing to do... } @@ -91,6 +106,13 @@ void simple_state_model_impl::accept( model_vertex_visitor& _constructor_visitor } +bool simple_state_model_impl::has_error_event() const +{ + const bool state_has_error_event = !!error_event_; + return( state_has_error_event ); +} + + event_sptr simple_state_model_impl::get_error_event() const { return( error_event_ ); @@ -115,6 +137,29 @@ void simple_state_model_impl::set_is_async( bool _is_async ) } +void simple_state_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + +void simple_state_model_impl::get_event_references( std::vector& _elements, + const event_sptr _event ) +{ + if( error_event_ ) + { + if( error_event_->get_id() == _event->get_id() ) + { + _elements.push_back( this ); + } + } + else + { + state_model_impl::get_event_references( _elements, _event ); + } +} + + } diff --git a/yasmine_model/source/state_machine_element_model_impl.cpp b/yasmine_model/source/state_machine_element_model_impl.cpp index 2015b52..3fb9ec8 100644 --- a/yasmine_model/source/state_machine_element_model_impl.cpp +++ b/yasmine_model/source/state_machine_element_model_impl.cpp @@ -56,7 +56,13 @@ const state_machine_element_model* state_machine_element_model_impl::get_parent( } -void state_machine_element_model_impl::set_parent( const state_machine_element_model* _parent ) +state_machine_element_model* state_machine_element_model_impl::get_parent() +{ + return( parent_ ); +} + + +void state_machine_element_model_impl::set_parent( state_machine_element_model* _parent ) { parent_ = _parent; } diff --git a/yasmine_model/source/state_machine_external_element.cpp b/yasmine_model/source/state_machine_external_element.cpp new file mode 100644 index 0000000..dce2c2a --- /dev/null +++ b/yasmine_model/source/state_machine_external_element.cpp @@ -0,0 +1,61 @@ +#include "state_machine_external_element.hpp" + + +namespace sxy +{ + + +namespace model +{ + + +state_machine_external_element::state_machine_external_element( const std::string& _name, const model_element_type& _type ): + name_( _name ), + type_( _type ) +{ + // Nothing to do... +} + + +state_machine_external_element::~state_machine_external_element() SX_NOEXCEPT +{ + // Nothing to do... +} + + +const std::string& state_machine_external_element::get_name() const +{ + return( name_ ); +} + + +const std::string& state_machine_external_element::get_name() +{ + return( name_ ); +} + + +void state_machine_external_element::set_name( const std::string& _name ) +{ + name_ = _name; +} + + +const model_element_type state_machine_external_element::get_type() const +{ + return( type_ ); +} + + +void state_machine_external_element::set_type( const model_element_type& _type ) +{ + type_ = _type; +} + + +} + + +} + + diff --git a/yasmine_model/source/state_machine_model.cpp b/yasmine_model/source/state_machine_model.cpp index 5ba54cd..80d4049 100644 --- a/yasmine_model/source/state_machine_model.cpp +++ b/yasmine_model/source/state_machine_model.cpp @@ -10,7 +10,10 @@ #include "state_machine_model.hpp" +#include + #include "composite_state_model_impl.hpp" +#include "model_exception.hpp" namespace sxy @@ -24,7 +27,8 @@ namespace model state_machine_model::state_machine_model() : transitions_(), root_state_(), - event_list_() + event_list_(), + externals_() { // Nothing to do... } @@ -42,6 +46,16 @@ void state_machine_model::add_transition( transition_model_uptr _transition ) } +void state_machine_model::remove_transition( const size_t _index ) +{ + if( _index >= transitions_.size() ) + { + throw exception( "Index out of range!" ); + } + transitions_.erase( std::remove( transitions_.begin(), transitions_.end(), transitions_.at( _index ) ) ); +} + + raw_const_transition_models state_machine_model::get_transitions() const { raw_const_transition_models transitions; @@ -57,6 +71,16 @@ raw_const_transition_models state_machine_model::get_transitions() const } +transition_model& state_machine_model::get_transition( const size_t _index ) +{ + if( _index >= transitions_.size() ) + { + throw exception( "Index out of range!" ); + } + return( *transitions_.at( _index ) ); +} + + composite_state_model_impl& state_machine_model::get_root_state() const { return( *root_state_ ); @@ -75,10 +99,93 @@ sxy::model::state_machine_model::events state_machine_model::get_events() const } +event_model& state_machine_model::get_event( const size_t _index ) +{ + if( _index >= event_list_.size() ) + { + throw exception( "Index out of range!" ); + } + return( *event_list_.at( _index ) ); +} + + +const event_model& state_machine_model::get_event( const size_t _index ) const +{ + if( _index >= event_list_.size() ) + { + throw exception( "Index out of range!" ); + } + return( *event_list_.at( _index ) ); +} + + +std::string state_machine_model::get_event_name( const sxy::model::event_id& _event_id ) const +{ + std::string event_name = ""; + for( size_t i = 0; i < event_list_.size(); ++i ) + { + if( event_list_.at( i )->get_id() == _event_id ) + { + event_name = event_list_.at( i )->get_name(); + break; + } + } + return( event_name ); +} + + void state_machine_model::add_event( const std::string& _event_name, const event_id& _event_id, const event_priority& _event_priority ) { - event_list_.push_back( event_model( _event_name, _event_id, _event_priority ) ); + event_list_.push_back( SX_MAKE_SHARED( _event_name, _event_id, _event_priority ) ); +} + + +void state_machine_model::remove_event( const size_t _index ) +{ + sxy::model::event_sptr event_to_be_deleted = event_list_.at( _index ); + event_list_.erase( std::remove( event_list_.begin(), event_list_.end(), event_to_be_deleted ), event_list_.end() ); +} + + +std::vector state_machine_model::get_event_references( const event_sptr _event ) +{ + std::vector elements; + for( size_t i = 0; i < transitions_.size(); ++i ) + { + if( transitions_.at( i )->has_trigger( _event->get_id() ) ) + { + elements.push_back( transitions_.at( i ).get() ); + } + } + + root_state_->get_event_references( elements, _event ); + return( elements ); +} + + +const external_vertices& state_machine_model::get_externals() const +{ + return( externals_ ); +} + + +external_vertices& state_machine_model::get_externals() +{ + return( externals_ ); +} + + +void state_machine_model::add_external_vertex( external_uptr _external_vertex ) +{ + externals_.push_back( sxe::move( _external_vertex ) ); +} + + +void state_machine_model::remove_external_vertex( const size_t _index ) +{ + external_uptr& vertex_to_be_deleted = externals_.at( _index ); + externals_.erase( std::remove( externals_.begin(), externals_.end(), vertex_to_be_deleted ) ); } diff --git a/yasmine_model/source/state_model_impl.cpp b/yasmine_model/source/state_model_impl.cpp index ffd922b..7e4f23a 100644 --- a/yasmine_model/source/state_model_impl.cpp +++ b/yasmine_model/source/state_model_impl.cpp @@ -10,6 +10,13 @@ #include "state_model_impl.hpp" +#include + +#include "essentials/base.hpp" + +#include "model_exception.hpp" +#include "region_model.hpp" + namespace sxy { @@ -35,6 +42,12 @@ state_model_impl::~state_model_impl() SX_NOEXCEPT } +const size_t state_model_impl::get_regions_count() const +{ + return( 0 ); +} + + raw_const_transition_models state_model_impl::get_transitions() const { std::vector< const transition_model* > transitions; @@ -52,6 +65,47 @@ const event_ids& state_model_impl::get_deferred_events() const } +void state_model_impl::add_deferred_event( const event_id _deferred_event_id ) +{ + deferred_events_.push_back( _deferred_event_id ); +} + + +void state_model_impl::remove_deferred_event( const event_id _deferred_event_id ) +{ + deferred_events_.erase( std::remove( deferred_events_.begin(), deferred_events_.end(), _deferred_event_id ), deferred_events_.end() ); +} + + +bool state_model_impl::defers_event( const event_id _id ) const +{ + bool state_defers_event = false; + if( std::find( deferred_events_.begin(), deferred_events_.end(), _id ) != deferred_events_.end() ) + { + state_defers_event = true; + } + return( state_defers_event ); +} + + +state_machine_element_model* state_model_impl::get_child( const sxe::uri& _uri ) +{ + SX_UNUSED_PARAMETER( _uri ); + throw sxy::model::exception( "State '%' is of type '%' and cannot have children!", get_name(), + model_element_type_to_string( get_type() ) ); +} + + +void state_model_impl::get_event_references( std::vector& _elements, + const event_sptr _event ) +{ + if( defers_event( _event->get_id() ) ) + { + _elements.push_back( this ); + } +} + + } diff --git a/yasmine_model/source/terminate_pseudostate_model_impl.cpp b/yasmine_model/source/terminate_pseudostate_model_impl.cpp index b5f322a..d3dd5b9 100644 --- a/yasmine_model/source/terminate_pseudostate_model_impl.cpp +++ b/yasmine_model/source/terminate_pseudostate_model_impl.cpp @@ -11,6 +11,7 @@ #include "terminate_pseudostate_model_impl.hpp" #include "model_vertex_visitor.hpp" +#include "delete_visitor.hpp" namespace sxy @@ -40,6 +41,12 @@ void terminate_pseudostate_model_impl::accept( model_vertex_visitor& _constructo } +void terminate_pseudostate_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/source/transition_model_impl.cpp b/yasmine_model/source/transition_model_impl.cpp index 2c9e36a..5468082 100644 --- a/yasmine_model/source/transition_model_impl.cpp +++ b/yasmine_model/source/transition_model_impl.cpp @@ -10,6 +10,14 @@ #include "transition_model_impl.hpp" +#include + +#include "essentials/base.hpp" + +#include "model_exception.hpp" +#include "delete_visitor.hpp" + + namespace sxy { @@ -45,36 +53,109 @@ transition_model_kind transition_model_impl::get_kind() const } +void transition_model_impl::set_kind( transition_model_kind _kind ) +{ + kind_ = _kind; +} + + const std::string& transition_model_impl::get_behavior() const { return( behavior_ ); } +void transition_model_impl::set_behavior( const std::string& _behavior ) +{ + behavior_ = _behavior; +} + + const std::string& transition_model_impl::get_guard() const { return( guard_ ); } +void transition_model_impl::set_guard( const std::string& _guard ) +{ + guard_ = _guard; +} + + const sxe::uri& transition_model_impl::get_source() const { return( source_ ); } +void transition_model_impl::set_source( const std::string& _source ) +{ + source_ = sxe::uri( _source ); +} + + const sxe::uri& transition_model_impl::get_target() const { return( target_ ); } +void transition_model_impl::set_target( const std::string& _target ) +{ + target_ = sxe::uri( _target ); +} + + const event_ids& transition_model_impl::get_event_ids() const { return( events_ ); } +void transition_model_impl::set_event_ids( event_ids& _event_ids ) +{ + events_ = _event_ids; +} + + +void transition_model_impl::add_event( const event_id _id ) +{ + events_.push_back( _id ); +} + + +void transition_model_impl::remove_event( const event_id _id ) +{ + events_.erase( std::remove( events_.begin(), events_.end(), _id ), events_.end() ); +} + + +bool transition_model_impl::has_trigger( event_id _id ) const +{ + bool transition_has_trigger = false; + if( std::find( events_.begin(), events_.end(), _id ) != events_.end() ) + { + transition_has_trigger = true; + } + + return( transition_has_trigger ); +} + + +state_machine_element_model* transition_model_impl::get_child( const sxe::uri& _uri ) +{ + SX_UNUSED_PARAMETER( _uri ); + throw sxy::model::exception( "Transitions cannot have children!" ); +} + + +void transition_model_impl::accept_delete_visitor( delete_visitor& _delete_visitor ) +{ + _delete_visitor.visit( *this ); +} + + } diff --git a/yasmine_model/yasmine_model.vcxproj b/yasmine_model/yasmine_model.vcxproj index 73c8ea6..02c5642 100644 --- a/yasmine_model/yasmine_model.vcxproj +++ b/yasmine_model/yasmine_model.vcxproj @@ -83,15 +83,11 @@ - - - - - + @@ -111,6 +107,7 @@ + @@ -118,21 +115,6 @@ - - - - - - - - - - - - - - - @@ -144,6 +126,7 @@ + @@ -153,6 +136,7 @@ + @@ -191,6 +175,7 @@ + @@ -419,10 +404,10 @@ - + diff --git a/yasmine_model/yasmine_model.vcxproj.filters b/yasmine_model/yasmine_model.vcxproj.filters index c797543..b02ab2b 100644 --- a/yasmine_model/yasmine_model.vcxproj.filters +++ b/yasmine_model/yasmine_model.vcxproj.filters @@ -52,20 +52,8 @@ {f23a6b72-fd79-4e80-94f0-df764a94a2fa} - - {31e6d6f0-beef-4573-a2ee-45bb97e3972d} - - - {f3585f15-06be-4a13-8b57-021f06f33586} - - - {c435bfdf-a901-42bf-8149-b5b498bd573f} - - - {ca791aac-15dc-4770-82a2-4af4749309bc} - - - {558aca08-79e1-4822-82f2-d4294f22c133} + + {e4867d26-f01b-4da5-99ae-9c18747a3d19} @@ -147,27 +135,18 @@ Quelldateien\state machine\element - - Quelldateien\extenals\essentials - - - Quelldateien\extenals\essentials - - - Quelldateien\extenals\essentials - - - Quelldateien\extenals\essentials - - - Quelldateien\extenals\essentials - Quelldateien\state machine\element Quelldateien\state machine\element + + Quelldateien\state machine\visitors + + + Quelldateien\state machine + @@ -368,48 +347,6 @@ Headerdateien\state machine\element - - Headerdateien\externals\essentials\compatibility - - - Headerdateien\externals\essentials\compatibility - - - Headerdateien\externals\essentials\compatibility - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - - - Headerdateien\externals\essentials - Headerdateien\state machine\element @@ -419,12 +356,18 @@ Headerdateien\state machine\element - - Headerdateien\externals\essentials\compatibility - Headerdateien\json + + Headerdateien\state machine\visitors + + + Headerdateien + + + Headerdateien\state machine + diff --git a/ygen/CMakeLists.txt b/ygen/CMakeLists.txt index 3e115bb..055242e 100644 --- a/ygen/CMakeLists.txt +++ b/ygen/CMakeLists.txt @@ -29,8 +29,8 @@ message(STATUS "ygen linking to libraries: ${link_libraries_list}" ) target_link_libraries(ygen LINK_PUBLIC ${link_libraries_list}) include_directories("./include") -include_directories("./../externals/essentials/include") -include_directories("./../genesis/include") +include_directories("./../externals/essentials/source/essentials/include") +include_directories("./../externals/genesis/source/genesis/include") include_directories("./../libygen/include") install(TARGETS ygen DESTINATION bin) diff --git a/ygen/changelog.txt b/ygen/changelog.txt index cc90389..289494b 100644 --- a/ygen/changelog.txt +++ b/ygen/changelog.txt @@ -1,14 +1,21 @@ # Change log All notable changes to this project are documented in this file. -##[0.1.3] - 2017-09-21 +##[0.1.5] - 2017-12-18 + +### Changed +• CMake: use external CMakeHelpers files +• CMake: refactoring of build scripts -### Fixed -• bug in template header.gtpl: behavior classes includes onthe same line + +##[0.1.3] - 2017-09-21 ### Changed • removed unused include from template source.gtpl +### Fixed +• bug in template header.gtpl: behavior classes includes onthe same line + ##[0.1.1] - 2017-04-28 @@ -18,4 +25,4 @@ All notable changes to this project are documented in this file. ##[0.1.0] - 2017-04-25 -• The very first released version of ygen \ No newline at end of file +• The very first released version of ygen diff --git a/ygen/include/ygen_build_number.hpp b/ygen/include/ygen_build_number.hpp index 9b59587..3e4cfc1 100644 --- a/ygen/include/ygen_build_number.hpp +++ b/ygen/include/ygen_build_number.hpp @@ -20,7 +20,7 @@ namespace version { - const sxe::uint16_t BUILD_NUMBER( 810 ); + const sxe::uint16_t BUILD_NUMBER( 850 ); } diff --git a/ygen/source/ygen_version.cpp b/ygen/source/ygen_version.cpp index 64a37b6..08c4d79 100644 --- a/ygen/source/ygen_version.cpp +++ b/ygen/source/ygen_version.cpp @@ -27,7 +27,7 @@ namespace const sxe::uint16_t VERSION_MAJOR( 0 ); const sxe::uint16_t VERSION_MINOR( 1 ); -const sxe::uint16_t VERSION_PATCH( 3 ); +const sxe::uint16_t VERSION_PATCH( 5 ); } diff --git a/ygen/ygen.vcxproj b/ygen/ygen.vcxproj index c296b5b..0465e6a 100644 --- a/ygen/ygen.vcxproj +++ b/ygen/ygen.vcxproj @@ -283,11 +283,11 @@ + - + - @@ -419,7 +419,6 @@ -