Fix decoration for static builds

- Also add improvemnts a few other things in the build system
This commit is contained in:
Martchus 2016-08-29 15:35:48 +02:00
parent cf521a3255
commit d6b08b8ed9
38 changed files with 2622 additions and 2569 deletions

View File

@ -1,7 +1,7 @@
#ifndef APPLICATION_UTILITIES_ARGUMENTPARSER_H #ifndef APPLICATION_UTILITIES_ARGUMENTPARSER_H
#define APPLICATION_UTILITIES_ARGUMENTPARSER_H #define APPLICATION_UTILITIES_ARGUMENTPARSER_H
#include "./global.h" #include "../global.h"
#include <vector> #include <vector>
#include <initializer_list> #include <initializer_list>
@ -14,10 +14,10 @@ class ArgumentParserTests;
namespace ApplicationUtilities { namespace ApplicationUtilities {
LIB_EXPORT extern const char *applicationName; CPP_UTILITIES_EXPORT extern const char *applicationName;
LIB_EXPORT extern const char *applicationAuthor; CPP_UTILITIES_EXPORT extern const char *applicationAuthor;
LIB_EXPORT extern const char *applicationVersion; CPP_UTILITIES_EXPORT extern const char *applicationVersion;
LIB_EXPORT extern const char *applicationUrl; CPP_UTILITIES_EXPORT extern const char *applicationUrl;
#define SET_APPLICATION_INFO \ #define SET_APPLICATION_INFO \
::ApplicationUtilities::applicationName = APP_NAME; \ ::ApplicationUtilities::applicationName = APP_NAME; \
@ -68,12 +68,12 @@ constexpr bool operator&(ValueCompletionBehavior lhs, ValueCompletionBehavior rh
} }
/// \endcond /// \endcond
Argument LIB_EXPORT *firstPresentUncombinableArg(const ArgumentVector &args, const Argument *except); Argument CPP_UTILITIES_EXPORT *firstPresentUncombinableArg(const ArgumentVector &args, const Argument *except);
/*! /*!
* \brief The ArgumentOccurrence struct holds argument values for an occurrence of an argument. * \brief The ArgumentOccurrence struct holds argument values for an occurrence of an argument.
*/ */
struct LIB_EXPORT ArgumentOccurrence struct CPP_UTILITIES_EXPORT ArgumentOccurrence
{ {
ArgumentOccurrence(std::size_t index); ArgumentOccurrence(std::size_t index);
ArgumentOccurrence(std::size_t index, const std::vector<Argument *> parentPath, Argument *parent); ArgumentOccurrence(std::size_t index, const std::vector<Argument *> parentPath, Argument *parent);
@ -119,7 +119,7 @@ inline ArgumentOccurrence::ArgumentOccurrence(std::size_t index, const std::vect
} }
} }
class LIB_EXPORT Argument class CPP_UTILITIES_EXPORT Argument
{ {
friend class ArgumentParser; friend class ArgumentParser;
@ -200,7 +200,7 @@ private:
const char *m_preDefinedCompletionValues; const char *m_preDefinedCompletionValues;
}; };
class LIB_EXPORT ArgumentParser class CPP_UTILITIES_EXPORT ArgumentParser
{ {
friend ArgumentParserTests; friend ArgumentParserTests;
public: public:
@ -767,7 +767,7 @@ inline void ArgumentParser::setDefaultArgument(Argument *argument)
m_defaultArg = argument; m_defaultArg = argument;
} }
class LIB_EXPORT HelpArgument : public Argument class CPP_UTILITIES_EXPORT HelpArgument : public Argument
{ {
public: public:
HelpArgument(ArgumentParser &parser); HelpArgument(ArgumentParser &parser);

View File

@ -1,7 +1,7 @@
#ifndef APPLICATIONUTILITIES_COMMANDLINEUTILS_H #ifndef APPLICATIONUTILITIES_COMMANDLINEUTILS_H
#define APPLICATIONUTILITIES_COMMANDLINEUTILS_H #define APPLICATIONUTILITIES_COMMANDLINEUTILS_H
#include "./global.h" #include "../global.h"
namespace ApplicationUtilities { namespace ApplicationUtilities {
@ -15,10 +15,10 @@ enum class Response
No No
}; };
bool LIB_EXPORT confirmPrompt(const char *message, Response defaultResponse = Response::None); bool CPP_UTILITIES_EXPORT confirmPrompt(const char *message, Response defaultResponse = Response::None);
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
void LIB_EXPORT startConsole(); void CPP_UTILITIES_EXPORT startConsole();
# define CMD_UTILS_START_CONSOLE ::ApplicationUtilities::startConsole(); # define CMD_UTILS_START_CONSOLE ::ApplicationUtilities::startConsole();
#else #else
# define CMD_UTILS_START_CONSOLE # define CMD_UTILS_START_CONSOLE

View File

@ -1,14 +1,14 @@
#ifndef APPLICATION_UTILITIES_FAILURE_H #ifndef APPLICATION_UTILITIES_FAILURE_H
#define APPLICATION_UTILITIES_FAILURE_H #define APPLICATION_UTILITIES_FAILURE_H
#include "./global.h" #include "../global.h"
#include <exception> #include <exception>
#include <string> #include <string>
namespace ApplicationUtilities { namespace ApplicationUtilities {
class LIB_EXPORT Failure : public std::exception class CPP_UTILITIES_EXPORT Failure : public std::exception
{ {
public: public:
Failure(); Failure();

View File

@ -5,7 +5,7 @@
namespace ApplicationUtilities { namespace ApplicationUtilities {
class LIB_EXPORT FakeQtConfigArguments class CPP_UTILITIES_EXPORT FakeQtConfigArguments
{ {
public: public:
FakeQtConfigArguments(); FakeQtConfigArguments();

View File

@ -52,7 +52,7 @@ enum class DatePart
Day /**< day */ Day /**< day */
}; };
class LIB_EXPORT DateTime class CPP_UTILITIES_EXPORT DateTime
{ {
public: public:
explicit constexpr DateTime(); explicit constexpr DateTime();

View File

@ -3,11 +3,9 @@
#include "./datetime.h" #include "./datetime.h"
#include "../application/global.h"
namespace ChronoUtilities { namespace ChronoUtilities {
class LIB_EXPORT Period class CPP_UTILITIES_EXPORT Period
{ {
public: public:
Period(const DateTime &beg, const DateTime &end); Period(const DateTime &beg, const DateTime &end);

View File

@ -1,7 +1,7 @@
#ifndef CHRONO_UTILITIES_TIMESPAN_H #ifndef CHRONO_UTILITIES_TIMESPAN_H
#define CHRONO_UTILITIES_TIMESPAN_H #define CHRONO_UTILITIES_TIMESPAN_H
#include "../application/global.h" #include "../global.h"
#include "../conversion/types.h" #include "../conversion/types.h"
#include <string> #include <string>
@ -25,7 +25,7 @@ enum class TimeSpanOutputFormat
WithMeasures /**< measures are used, eg.: 34 d 5 h 10 min 7 s 31 ms */ WithMeasures /**< measures are used, eg.: 34 d 5 h 10 min 7 s 31 ms */
}; };
class LIB_EXPORT TimeSpan class CPP_UTILITIES_EXPORT TimeSpan
{ {
friend class DateTime; friend class DateTime;
public: public:

View File

@ -18,6 +18,7 @@ else()
set(ACTUAL_ADDITIONAL_LINK_FLAGS ${ADDITIONAL_LINK_FLAGS}) set(ACTUAL_ADDITIONAL_LINK_FLAGS ${ADDITIONAL_LINK_FLAGS})
set(ACTUAL_ADDITIONAL_COMPILE_DEFINITIONS ${ADDITIONAL_COMPILE_DEFINITIONS}) set(ACTUAL_ADDITIONAL_COMPILE_DEFINITIONS ${ADDITIONAL_COMPILE_DEFINITIONS})
endif() endif()
# add target for building the application # add target for building the application
add_executable(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} ${GUI_TYPE} ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_FILES} ${QML_FILES} ${RES_FILES} ${QM_FILES} ${WINDOWS_ICON_PATH}) add_executable(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} ${GUI_TYPE} ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_FILES} ${QML_FILES} ${RES_FILES} ${QM_FILES} ${WINDOWS_ICON_PATH})
target_link_libraries(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} ${ACTUAL_ADDITIONAL_LINK_FLAGS} ${LIBRARIES}) target_link_libraries(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} ${ACTUAL_ADDITIONAL_LINK_FLAGS} ${LIBRARIES})
@ -33,7 +34,6 @@ install(TARGETS ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
COMPONENT binary COMPONENT binary
) )
if(NOT TARGET install-binary) if(NOT TARGET install-binary)
add_custom_target(install-binary add_custom_target(install-binary
DEPENDS ${META_PROJECT_NAME} DEPENDS ${META_PROJECT_NAME}
@ -64,7 +64,6 @@ foreach(ICON_FILE ${ICON_FILES})
COMPONENT desktop COMPONENT desktop
) )
endforeach() endforeach()
if(NOT TARGET install-desktop) if(NOT TARGET install-desktop)
add_custom_target(install-desktop add_custom_target(install-desktop
DEPENDS ${META_PROJECT_NAME} DEPENDS ${META_PROJECT_NAME}

View File

@ -39,7 +39,7 @@ set(TARGET_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bin/${TARGET_PREFIX}${META_PROJEC
option(FORCE_OLD_ABI "specifies whether usage of old ABI should be forced" OFF) option(FORCE_OLD_ABI "specifies whether usage of old ABI should be forced" OFF)
if(FORCE_OLD_ABI) if(FORCE_OLD_ABI)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
set(META_REQUIRED_CFLAGS "${META_REQUIRED_CFLAGS} -D-D_GLIBCXX_USE_CXX11_ABI=0") set(META_REQUIRED_BUILD_FLAGS "${META_REQUIRED_BUILD_CFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
message(STATUS "Forcing usage of old CXX11 ABI.") message(STATUS "Forcing usage of old CXX11 ABI.")
else() else()
message(STATUS "Using default CXX11 ABI (not forcing old CX11 ABI).") message(STATUS "Using default CXX11 ABI (not forcing old CX11 ABI).")
@ -59,9 +59,14 @@ if(LOGGING_ENABLED)
endif() endif()
# options for deciding whether to build static and/or shared libraries # options for deciding whether to build static and/or shared libraries
if((NOT ${META_PROJECT_TYPE} STREQUAL "library") AND (NOT ${META_PROJECT_TYPE} STREQUAL "")) if(("${META_PROJECT_TYPE}" STREQUAL "library") OR ("${META_PROJECT_TYPE}" STREQUAL ""))
option(BUILD_STATIC_LIBS "whether to build static libraries (disabled by default)" OFF) option(BUILD_STATIC_LIBS "whether to build static libraries (disabled by default)" OFF)
option(DISABLE_SHARED_LIBS "whether building dynamic libraries is disabled (prevents BUILD_SHARED_LIBS being re-enabled when using Qt Creator)" OFF)
if(DISABLE_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF)
else()
option(BUILD_SHARED_LIBS "whether to build dynamic libraries (enabled by default)" ON) option(BUILD_SHARED_LIBS "whether to build dynamic libraries (enabled by default)" ON)
endif()
endif() endif()
# options for forcing static linkage when building applications or dynamic libraries # options for forcing static linkage when building applications or dynamic libraries

View File

@ -30,6 +30,7 @@ set(LIB_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${SELECTED_LIB_SUFFIX}")
set(CMAKE_MODULE_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${META_PROJECT_NAME}/cmake/modules") set(CMAKE_MODULE_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${META_PROJECT_NAME}/cmake/modules")
set(CMAKE_CONFIG_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${META_PROJECT_NAME}/cmake") set(CMAKE_CONFIG_INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${META_PROJECT_NAME}/cmake")
# remove library prefix when building with mingw-w64 (just for consistency with qmake) # remove library prefix when building with mingw-w64 (just for consistency with qmake)
if(MINGW) if(MINGW)
set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_SHARED_LIBRARY_PREFIX "")
@ -40,6 +41,29 @@ if(MINGW)
set(WINDOWS_EXT "dll") set(WINDOWS_EXT "dll")
endif(MINGW) endif(MINGW)
# create global header and define build flags
if(NOT META_SHARED_LIB_COMPILE_DEFINITIONS)
set(META_SHARED_LIB_COMPILE_DEFINITIONS ${META_COMPILE_DEFINITIONS})
endif()
if(NOT META_STATIC_LIB_COMPILE_DEFINITIONS)
set(META_STATIC_LIB_COMPILE_DEFINITIONS ${META_COMPILE_DEFINITIONS} ${META_PROJECT_VARNAME_UPPER}_STATIC)
endif()
# add global library-specific header
include(TemplateFinder)
find_template_file("global.h" CPP_UTILITIES GLOBAL_H_TEMPLATE_FILE)
if("${META_PROJECT_NAME}" STREQUAL "c++utilities")
set(GENERAL_GLOBAL_H_INCLUDE_PATH "\"./application/global.h\"")
else()
set(GENERAL_GLOBAL_H_INCLUDE_PATH "<c++utilities/application/global.h>")
endif()
configure_file(
"${GLOBAL_H_TEMPLATE_FILE}"
"${CMAKE_CURRENT_SOURCE_DIR}/global.h" # simply add this to source to ease inclusion
NEWLINE_STYLE UNIX # since this goes to sources ensure consistency
)
list(APPEND HEADER_FILES global.h)
# add target for building the library # add target for building the library
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
# use correct linker flags and compile definitions (depend on linkage) # use correct linker flags and compile definitions (depend on linkage)
@ -65,6 +89,8 @@ endif()
# add target for building a static version of the library # add target for building a static version of the library
if(BUILD_STATIC_LIBS) if(BUILD_STATIC_LIBS)
set(ACTUAL_ADDITIONAL_COMPILE_DEFINITIONS ${ADDITIONAL_STATIC_COMPILE_DEFINITIONS})
list(APPEND ACTUAL_ADDITIONAL_COMPILE_DEFINITIONS ${META_STATIC_LIB_COMPILE_DEFINITIONS})
add_library(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static STATIC ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_FILES} ${QML_FILES} ${RES_FILES} ${QM_FILES} ${WINDOWS_ICON_PATH}) add_library(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static STATIC ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_FILES} ${QML_FILES} ${RES_FILES} ${QM_FILES} ${WINDOWS_ICON_PATH})
# add target link libraries for the static lib also because otherwise Qt header files can not be located # add target link libraries for the static lib also because otherwise Qt header files can not be located
target_link_libraries(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static ${STATIC_LIBRARIES}) target_link_libraries(${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static ${STATIC_LIBRARIES})
@ -73,7 +99,7 @@ if(BUILD_STATIC_LIBS)
SOVERSION ${META_VERSION_MAJOR} SOVERSION ${META_VERSION_MAJOR}
OUTPUT_NAME ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} OUTPUT_NAME ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}
CXX_STANDARD 11 CXX_STANDARD 11
COMPILE_DEFINITIONS "${ADDITIONAL_STATIC_COMPILE_DEFINITIONS}" COMPILE_DEFINITIONS "${ACTUAL_ADDITIONAL_COMPILE_DEFINITIONS}"
) )
set(META_STATIC_LIB_DEPENDS ${${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static_LIB_DEPENDS}) # used in config file set(META_STATIC_LIB_DEPENDS ${${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static_LIB_DEPENDS}) # used in config file
endif() endif()
@ -101,7 +127,6 @@ write_basic_package_version_file(
# create pkg-config file from template # create pkg-config file from template
# will (currently) not contain Libs.private if static libs haven't been built anyways # will (currently) not contain Libs.private if static libs haven't been built anyways
include(TemplateFinder)
find_template_file("template.pc" CPP_UTILITIES PKGCONFIG_TEMPLATE_FILE) find_template_file("template.pc" CPP_UTILITIES PKGCONFIG_TEMPLATE_FILE)
configure_file( configure_file(
"${PKGCONFIG_TEMPLATE_FILE}" "${PKGCONFIG_TEMPLATE_FILE}"
@ -119,7 +144,6 @@ install(
COMPONENT COMPONENT
cmake-config cmake-config
) )
if(NOT TARGET install-cmake-config) if(NOT TARGET install-cmake-config)
add_custom_target(install-cmake-config add_custom_target(install-cmake-config
DEPENDS ${META_PROJECT_NAME} DEPENDS ${META_PROJECT_NAME}
@ -152,7 +176,6 @@ if(BUILD_SHARED_LIBS)
COMPONENT binary COMPONENT binary
) )
endif() endif()
if(NOT TARGET install-binary) if(NOT TARGET install-binary)
add_custom_target(install-binary add_custom_target(install-binary
DEPENDS ${META_PROJECT_NAME} DEPENDS ${META_PROJECT_NAME}
@ -190,7 +213,6 @@ foreach(HEADER_FILE ${HEADER_FILES} ${ADDITIONAL_HEADER_FILES})
COMPONENT header COMPONENT header
) )
endforeach() endforeach()
if(NOT TARGET install-header) if(NOT TARGET install-header)
add_custom_target(install-header add_custom_target(install-header
DEPENDS ${META_PROJECT_NAME} DEPENDS ${META_PROJECT_NAME}
@ -207,7 +229,6 @@ foreach(CMAKE_MODULE_FILE ${CMAKE_MODULE_FILES})
COMPONENT cmake-modules COMPONENT cmake-modules
) )
endforeach() endforeach()
if(NOT TARGET install-cmake-modules) if(NOT TARGET install-cmake-modules)
add_custom_target(install-cmake-modules add_custom_target(install-cmake-modules
DEPENDS ${META_PROJECT_NAME} DEPENDS ${META_PROJECT_NAME}
@ -224,7 +245,6 @@ foreach(CMAKE_TEMPLATE_FILE ${CMAKE_TEMPLATE_FILES})
COMPONENT cmake-templates COMPONENT cmake-templates
) )
endforeach() endforeach()
if(NOT TARGET install-cmake-templates) if(NOT TARGET install-cmake-templates)
add_custom_target(install-cmake-templates add_custom_target(install-cmake-templates
DEPENDS ${META_PROJECT_NAME} DEPENDS ${META_PROJECT_NAME}
@ -245,21 +265,18 @@ if(NOT TARGET install-mingw-w64)
DEPENDS install-binary install-header install-cmake-stuff ${LOCALIZATION_TARGET} DEPENDS install-binary install-header install-cmake-stuff ${LOCALIZATION_TARGET}
) )
endif() endif()
if(NOT TARGET install-mingw-w64-importlib-strip) if(NOT TARGET install-mingw-w64-importlib-strip)
add_custom_target(install-mingw-w64-importlib-strip add_custom_target(install-mingw-w64-importlib-strip
DEPENDS install-binary-strip DEPENDS install-binary-strip
COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" --strip-unneeded "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.dll.a" COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" --strip-unneeded "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.dll.a"
) )
endif() endif()
if(NOT TARGET install-mingw-w64-staticlib-strip) if(NOT TARGET install-mingw-w64-staticlib-strip)
add_custom_target(install-mingw-w64-staticlib-strip add_custom_target(install-mingw-w64-staticlib-strip
DEPENDS install-binary-strip DEPENDS install-binary-strip
COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" -g "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.a" COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" -g "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.a"
) )
endif() endif()
if(NOT TARGET install-mingw-w64-strip) if(NOT TARGET install-mingw-w64-strip)
add_custom_target(install-mingw-w64-strip add_custom_target(install-mingw-w64-strip
DEPENDS install-binary-strip install-mingw-w64-importlib-strip install-mingw-w64-staticlib-strip install-header install-cmake-stuff ${LOCALIZATION_TARGET} DEPENDS install-binary-strip install-mingw-w64-importlib-strip install-mingw-w64-staticlib-strip install-header install-cmake-stuff ${LOCALIZATION_TARGET}

View File

@ -1,41 +1,44 @@
@PACKAGE_INIT@ @PACKAGE_INIT@
set(@META_PROJECT_VARNAME@_HAS_SHARED_LIB "@BUILD_SHARED_LIBS@") set(@META_PROJECT_VARNAME_UPPER@_HAS_SHARED_LIB "@BUILD_SHARED_LIBS@")
set(@META_PROJECT_VARNAME@_SHARED_LIB "@META_PROJECT_NAME@") set(@META_PROJECT_VARNAME_UPPER@_SHARED_LIB "@META_PROJECT_NAME@")
set(@META_PROJECT_VARNAME@_HAS_STATIC_LIB "@BUILD_STATIC_LIBS@") set(@META_PROJECT_VARNAME_UPPER@_SHARED_LIB_COMPILE_DEFINITIONS @META_SHARED_LIB_COMPILE_DEFINITIONS@)
set(@META_PROJECT_VARNAME@_STATIC_LIB "@META_PROJECT_NAME@.a") set(@META_PROJECT_VARNAME_UPPER@_HAS_STATIC_LIB "@BUILD_STATIC_LIBS@")
set(@META_PROJECT_VARNAME@_STATIC_LIB_DEPENDS @META_STATIC_LIB_DEPENDS@) set(@META_PROJECT_VARNAME_UPPER@_STATIC_LIB "@META_PROJECT_NAME@.a")
set(@META_PROJECT_VARNAME@_INCLUDE_DIRS "@PACKAGE_HEADER_INSTALL_DESTINATION@") set(@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_DEPENDS @META_STATIC_LIB_DEPENDS@)
set(@META_PROJECT_VARNAME@_BIN_DIR "@PACKAGE_BIN_INSTALL_DESTINATION@") set(@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_COMPILE_DEFINITIONS @META_STATIC_LIB_COMPILE_DEFINITIONS@)
set(@META_PROJECT_VARNAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DESTINATION@") set(@META_PROJECT_VARNAME_UPPER@_INCLUDE_DIRS "@PACKAGE_HEADER_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME@_MODULE_DIRS "@PACKAGE_CMAKE_MODULE_INSTALL_DESTINATION@") set(@META_PROJECT_VARNAME_UPPER@_BIN_DIR "@PACKAGE_BIN_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME@_CONFIG_DIRS "@PACKAGE_CMAKE_CONFIG_INSTALL_DESTINATION@") set(@META_PROJECT_VARNAME_UPPER@_LIB_DIR "@PACKAGE_LIB_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME@_REQUIRED_CFLAGS "@META_REQUIRED_CFLAGS@") set(@META_PROJECT_VARNAME_UPPER@_MODULE_DIRS "@PACKAGE_CMAKE_MODULE_INSTALL_DESTINATION@")
set(@META_PROJECT_VARNAME_UPPER@_CONFIG_DIRS "@PACKAGE_CMAKE_CONFIG_INSTALL_DESTINATION@")
if(@META_PROJECT_VARNAME@_HAS_SHARED_LIB) if(@META_PROJECT_VARNAME_UPPER@_HAS_SHARED_LIB)
set(@META_PROJECT_VARNAME@_LIB "${@META_PROJECT_VARNAME@_SHARED_LIB}") set(@META_PROJECT_VARNAME_UPPER@_LIB "${@META_PROJECT_VARNAME_UPPER@_SHARED_LIB}")
else() else()
set(@META_PROJECT_VARNAME@_LIB "${@META_PROJECT_VARNAME@_STATIC_LIB}") set(@META_PROJECT_VARNAME_UPPER@_LIB "${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB}")
endif() endif()
macro(use_@META_PROJECT_VARNAME@) macro(use_@META_PROJECT_VARNAME_UPPER@)
include_directories(BEFORE SYSTEM ${@META_PROJECT_VARNAME@_INCLUDE_DIRS}) include_directories(BEFORE SYSTEM ${@META_PROJECT_VARNAME_UPPER@_INCLUDE_DIRS})
link_directories(${@META_PROJECT_VARNAME@_LIB_DIR}) link_directories(${@META_PROJECT_VARNAME_UPPER@_LIB_DIR})
# add library to list of libraries to link against when building dynamic libraries or applications # add library to list of libraries to link against when building dynamic libraries or applications
if(@META_PROJECT_VARNAME@_HAS_STATIC_LIB AND ((NOT ARGV0 AND ((STATIC_LINKAGE AND "${META_PROJECT_TYPE}" STREQUAL "application") OR (STATIC_LIBRARY_LINKAGE AND ("${META_PROJECT_TYPE}" STREQUAL "" OR "${META_PROJECT_TYPE}" STREQUAL "library")))) OR ("${ARGV0}" STREQUAL "STATIC") OR (NOT ARGV0 AND NOT @META_PROJECT_VARNAME@_HAS_SHARED_LIB))) if(@META_PROJECT_VARNAME_UPPER@_HAS_STATIC_LIB AND ((NOT ARGV0 AND ((STATIC_LINKAGE AND "${META_PROJECT_TYPE}" STREQUAL "application") OR (STATIC_LIBRARY_LINKAGE AND ("${META_PROJECT_TYPE}" STREQUAL "" OR "${META_PROJECT_TYPE}" STREQUAL "library")))) OR ("${ARGV0}" STREQUAL "STATIC") OR (NOT ARGV0 AND NOT @META_PROJECT_VARNAME_UPPER@_HAS_SHARED_LIB)))
list(APPEND LIBRARIES ${@META_PROJECT_VARNAME@_STATIC_LIB} ${@META_PROJECT_VARNAME@_STATIC_LIB_DEPENDS}) list(APPEND LIBRARIES ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB} ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_DEPENDS})
message(STATUS "Linking ${META_PROJECT_NAME} statically against @META_PROJECT_NAME@ (${@META_PROJECT_VARNAME@_STATIC_LIB} ${@META_PROJECT_VARNAME@_STATIC_LIB_DEPENDS}).") message(STATUS "Linking ${META_PROJECT_NAME} statically against @META_PROJECT_NAME@ (${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB} ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_DEPENDS}).")
elseif(@META_PROJECT_VARNAME@_HAS_SHARED_LIB AND (NOT ARGV0 OR ("${ARGV0}" STREQUAL "SHARED"))) list(APPEND ADDITIONAL_STATIC_COMPILE_DEFINITIONS ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_COMPILE_DEFINITIONS})
list(APPEND LIBRARIES ${@META_PROJECT_VARNAME@_SHARED_LIB}) elseif(@META_PROJECT_VARNAME_UPPER@_HAS_SHARED_LIB AND (NOT ARGV0 OR ("${ARGV0}" STREQUAL "SHARED")))
message(STATUS "Linking ${META_PROJECT_NAME} dynamically against @META_PROJECT_NAME@ (${@META_PROJECT_VARNAME@_SHARED_LIB}).") list(APPEND LIBRARIES ${@META_PROJECT_VARNAME_UPPER@_SHARED_LIB})
message(STATUS "Linking ${META_PROJECT_NAME} dynamically against @META_PROJECT_NAME@ (${@META_PROJECT_VARNAME_UPPER@_SHARED_LIB}).")
list(APPEND ADDITIONAL_SHARED_COMPILE_DEFINITIONS ${@META_PROJECT_VARNAME_UPPER@_SHARED_LIB_COMPILE_DEFINITIONS})
elseif(ARGV0) elseif(ARGV0)
message(FATAL_ERROR "Can not link ${META_PROJECT_NAME} against @META_PROJECT_NAME@ with the specified linkage ${ARGV0}.") message(FATAL_ERROR "Can not link ${META_PROJECT_NAME} against @META_PROJECT_NAME@ with the specified linkage ${ARGV0}.")
else() else()
message(FATAL_ERROR "Can not link ${META_PROJECT_NAME} against @META_PROJECT_NAME@.") message(FATAL_ERROR "Can not link ${META_PROJECT_NAME} against @META_PROJECT_NAME@.")
endif() endif()
# add library (including dependencies) to list of libraries to be provided as transitive dependencies when building static libraries # add library (including dependencies) to list of libraries to be provided as transitive dependencies when building static libraries
list(APPEND STATIC_LIBRARIES ${@META_PROJECT_VARNAME@_STATIC_LIB} ${@META_PROJECT_VARNAME@_STATIC_LIB_DEPENDS}) list(APPEND STATIC_LIBRARIES ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB} ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_DEPENDS})
message(STATUS "Adding ${@META_PROJECT_VARNAME@_STATIC_LIB} ${@META_PROJECT_VARNAME@_STATIC_LIB_DEPENDS} to static library dependencies of ${META_PROJECT_NAME}.") message(STATUS "Adding ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB} ${@META_PROJECT_VARNAME_UPPER@_STATIC_LIB_DEPENDS} to static library dependencies of ${META_PROJECT_NAME}.")
# make CMake modules of the project available # make CMake modules of the project available
list(APPEND CMAKE_MODULE_PATH ${@META_PROJECT_VARNAME@_MODULE_DIRS}) list(APPEND CMAKE_MODULE_PATH ${@META_PROJECT_VARNAME_UPPER@_MODULE_DIRS})
endmacro() endmacro()

View File

@ -1,5 +1,8 @@
#ifndef APP_METADATA_AVAIL // Created via CMake from template config.h.in
#define APP_METADATA_AVAIL // WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef APPLICATION_CONFIG
#define APPLICATION_CONFIG
#define PROJECT_NAME @META_PROJECT_NAME_STR@ #define PROJECT_NAME @META_PROJECT_NAME_STR@
#define APP_NAME @META_APP_NAME_STR@ #define APP_NAME @META_APP_NAME_STR@
@ -12,4 +15,4 @@
#cmakedefine SVG_SUPPORT #cmakedefine SVG_SUPPORT
#cmakedefine SVG_ICON_SUPPORT #cmakedefine SVG_ICON_SUPPORT
#endif // APP_METADATA_AVAIL #endif // APPLICATION_CONFIG

View File

@ -0,0 +1,17 @@
// Created via CMake from template global.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef @META_PROJECT_VARNAME_UPPER@_GLOBAL
#define @META_PROJECT_VARNAME_UPPER@_GLOBAL
#include @GENERAL_GLOBAL_H_INCLUDE_PATH@
#ifdef @META_PROJECT_VARNAME_UPPER@_STATIC
# define @META_PROJECT_VARNAME_UPPER@_EXPORT
# define @META_PROJECT_VARNAME_UPPER@_IMPORT
#else
# define @META_PROJECT_VARNAME_UPPER@_EXPORT LIB_EXPORT
# define @META_PROJECT_VARNAME_UPPER@_IMPORT LIB_IMPORT
#endif
#endif // @META_PROJECT_VARNAME_UPPER@_GLOBAL

View File

@ -10,4 +10,4 @@ URL: @META_APP_URL@
Libs: -L${libdir} -l@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@ Libs: -L${libdir} -l@TARGET_PREFIX@@META_PROJECT_NAME@@TARGET_SUFFIX@
Libs.private: @META_STATIC_LIB_DEPENDS@ Libs.private: @META_STATIC_LIB_DEPENDS@
Cflags: -I${includedir} @META_REQUIRED_CFLAGS@ Cflags: -I${includedir}

View File

@ -3,7 +3,7 @@
#include "./types.h" #include "./types.h"
#include "../application/global.h" #include "../global.h"
#ifdef __BYTE_ORDER__ #ifdef __BYTE_ORDER__
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ # if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
@ -106,7 +106,7 @@ namespace LE {
/*! /*!
* \brief Returns the 8.8 fixed point representation converted from the specified 32-bit floating point number. * \brief Returns the 8.8 fixed point representation converted from the specified 32-bit floating point number.
*/ */
LIB_EXPORT constexpr uint16 toFixed8(float32 float32value) CPP_UTILITIES_EXPORT constexpr uint16 toFixed8(float32 float32value)
{ {
return static_cast<uint16>(float32value * 256.0f); return static_cast<uint16>(float32value * 256.0f);
} }
@ -114,7 +114,7 @@ LIB_EXPORT constexpr uint16 toFixed8(float32 float32value)
/*! /*!
* \brief Returns a 32-bit floating point number converted from the specified 8.8 fixed point representation. * \brief Returns a 32-bit floating point number converted from the specified 8.8 fixed point representation.
*/ */
LIB_EXPORT constexpr float32 toFloat32(uint16 fixed8value) CPP_UTILITIES_EXPORT constexpr float32 toFloat32(uint16 fixed8value)
{ {
return static_cast<float32>(fixed8value) / 256.0f; return static_cast<float32>(fixed8value) / 256.0f;
} }
@ -122,7 +122,7 @@ LIB_EXPORT constexpr float32 toFloat32(uint16 fixed8value)
/*! /*!
* \brief Returns the 16.16 fixed point representation converted from the specified 32-bit floating point number. * \brief Returns the 16.16 fixed point representation converted from the specified 32-bit floating point number.
*/ */
LIB_EXPORT constexpr uint32 toFixed16(float32 float32value) CPP_UTILITIES_EXPORT constexpr uint32 toFixed16(float32 float32value)
{ {
return static_cast<uint32>(float32value * 65536.0f); return static_cast<uint32>(float32value * 65536.0f);
} }
@ -130,7 +130,7 @@ LIB_EXPORT constexpr uint32 toFixed16(float32 float32value)
/*! /*!
* \brief Returns a 32-bit floating point number converted from the specified 16.16 fixed point representation. * \brief Returns a 32-bit floating point number converted from the specified 16.16 fixed point representation.
*/ */
LIB_EXPORT constexpr float32 toFloat32(uint32 fixed16value) CPP_UTILITIES_EXPORT constexpr float32 toFloat32(uint32 fixed16value)
{ {
return static_cast<float32>(fixed16value) / 65536.0f; return static_cast<float32>(fixed16value) / 65536.0f;
} }
@ -140,7 +140,7 @@ LIB_EXPORT constexpr float32 toFloat32(uint32 fixed16value)
* \remarks Synchsafe integers appear in ID3 tags that are attached to an MP3 file. * \remarks Synchsafe integers appear in ID3 tags that are attached to an MP3 file.
* \sa <a href="http://id3.org/id3v2.4.0-structure">ID3 tag version 2.4.0 - Main Structure</a> * \sa <a href="http://id3.org/id3v2.4.0-structure">ID3 tag version 2.4.0 - Main Structure</a>
*/ */
LIB_EXPORT constexpr uint32 toSynchsafeInt(uint32 normalInt) CPP_UTILITIES_EXPORT constexpr uint32 toSynchsafeInt(uint32 normalInt)
{ {
return ((normalInt & 0x0000007fu) ) return ((normalInt & 0x0000007fu) )
| ((normalInt & 0x00003f80u) << 1) | ((normalInt & 0x00003f80u) << 1)
@ -153,7 +153,7 @@ LIB_EXPORT constexpr uint32 toSynchsafeInt(uint32 normalInt)
* \remarks Synchsafe integers appear in ID3 tags that are attached to an MP3 file. * \remarks Synchsafe integers appear in ID3 tags that are attached to an MP3 file.
* \sa <a href="http://id3.org/id3v2.4.0-structure">ID3 tag version 2.4.0 - Main Structure</a> * \sa <a href="http://id3.org/id3v2.4.0-structure">ID3 tag version 2.4.0 - Main Structure</a>
*/ */
LIB_EXPORT constexpr uint32 toNormalInt(uint32 synchsafeInt) CPP_UTILITIES_EXPORT constexpr uint32 toNormalInt(uint32 synchsafeInt)
{ {
return ((synchsafeInt & 0x0000007fu) ) return ((synchsafeInt & 0x0000007fu) )
| ((synchsafeInt & 0x00007f00u) >> 1) | ((synchsafeInt & 0x00007f00u) >> 1)
@ -164,7 +164,7 @@ LIB_EXPORT constexpr uint32 toNormalInt(uint32 synchsafeInt)
/*! /*!
* \brief Swaps the byte order of the specified 16-bit unsigned integer. * \brief Swaps the byte order of the specified 16-bit unsigned integer.
*/ */
LIB_EXPORT constexpr uint16 swapOrder(uint16 value) CPP_UTILITIES_EXPORT constexpr uint16 swapOrder(uint16 value)
{ {
return (value >> 8) | (value << 8); return (value >> 8) | (value << 8);
} }
@ -172,7 +172,7 @@ LIB_EXPORT constexpr uint16 swapOrder(uint16 value)
/*! /*!
* \brief Swaps the byte order of the specified 32-bit unsigned integer. * \brief Swaps the byte order of the specified 32-bit unsigned integer.
*/ */
LIB_EXPORT constexpr uint32 swapOrder(uint32 value) CPP_UTILITIES_EXPORT constexpr uint32 swapOrder(uint32 value)
{ {
return (value >> 24) return (value >> 24)
| ((value & 0x00FF0000) >> 8) | ((value & 0x00FF0000) >> 8)
@ -183,7 +183,7 @@ LIB_EXPORT constexpr uint32 swapOrder(uint32 value)
/*! /*!
* \brief Swaps the byte order of the specified 64-bit unsigned integer. * \brief Swaps the byte order of the specified 64-bit unsigned integer.
*/ */
LIB_EXPORT constexpr uint64 swapOrder(uint64 value) CPP_UTILITIES_EXPORT constexpr uint64 swapOrder(uint64 value)
{ {
return(value >> (7 * 8)) return(value >> (7 * 8))
| ((value & 0x00FF000000000000) >> (5 * 8)) | ((value & 0x00FF000000000000) >> (5 * 8))

View File

@ -6,12 +6,12 @@
#include "./types.h" #include "./types.h"
#include "../application/global.h" #include "../global.h"
/*! /*!
* \brief Returns a 16-bit signed integer converted from two bytes at a specified position in a char array. * \brief Returns a 16-bit signed integer converted from two bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline int16 toInt16(const char *value) CPP_UTILITIES_EXPORT inline int16 toInt16(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
return (static_cast<int16>(value[0]) << 8 & 0xFF00) return (static_cast<int16>(value[0]) << 8 & 0xFF00)
@ -25,7 +25,7 @@ LIB_EXPORT inline int16 toInt16(const char *value)
/*! /*!
* \brief Returns a 16-bit unsigned integer converted from two bytes at a specified position in a char array. * \brief Returns a 16-bit unsigned integer converted from two bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline uint16 toUInt16(const char *value) CPP_UTILITIES_EXPORT inline uint16 toUInt16(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
return (static_cast<uint16>(value[0]) << 8 & 0xFF00) return (static_cast<uint16>(value[0]) << 8 & 0xFF00)
@ -39,7 +39,7 @@ LIB_EXPORT inline uint16 toUInt16(const char *value)
/*! /*!
* \brief Returns a 32-bit signed integer converted from four bytes at a specified position in a char array. * \brief Returns a 32-bit signed integer converted from four bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline int32 toInt32(const char *value) CPP_UTILITIES_EXPORT inline int32 toInt32(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
return (static_cast<int32>(value[0]) << 24 & 0xFF000000) return (static_cast<int32>(value[0]) << 24 & 0xFF000000)
@ -57,7 +57,7 @@ LIB_EXPORT inline int32 toInt32(const char *value)
/*! /*!
* \brief Returns a 32-bit unsigned integer converted from three bytes at a specified position in a char array. * \brief Returns a 32-bit unsigned integer converted from three bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline uint32 toUInt24(const char *value) CPP_UTILITIES_EXPORT inline uint32 toUInt24(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
return (static_cast<uint32>(value[0]) << 16 & 0x00FF0000) return (static_cast<uint32>(value[0]) << 16 & 0x00FF0000)
@ -73,7 +73,7 @@ LIB_EXPORT inline uint32 toUInt24(const char *value)
/*! /*!
* \brief Returns a 32-bit unsigned integer converted from four bytes at a specified position in a char array. * \brief Returns a 32-bit unsigned integer converted from four bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline uint32 toUInt32(const char *value) CPP_UTILITIES_EXPORT inline uint32 toUInt32(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
return (static_cast<uint32>(value[0]) << 24 & 0xFF000000) return (static_cast<uint32>(value[0]) << 24 & 0xFF000000)
@ -91,7 +91,7 @@ LIB_EXPORT inline uint32 toUInt32(const char *value)
/*! /*!
* \brief Returns a 64-bit signed integer converted from eight bytes at a specified position in a char array. * \brief Returns a 64-bit signed integer converted from eight bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline int64 toInt64(const char *value) CPP_UTILITIES_EXPORT inline int64 toInt64(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
return (static_cast<int64>(value[0]) << 56 & 0xFF00000000000000) return (static_cast<int64>(value[0]) << 56 & 0xFF00000000000000)
@ -117,7 +117,7 @@ LIB_EXPORT inline int64 toInt64(const char *value)
/*! /*!
* \brief Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a char array. * \brief Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline uint64 toUInt64(const char *value) CPP_UTILITIES_EXPORT inline uint64 toUInt64(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
return (static_cast<uint64>(value[0]) << 56 & 0xFF00000000000000) return (static_cast<uint64>(value[0]) << 56 & 0xFF00000000000000)
@ -143,7 +143,7 @@ LIB_EXPORT inline uint64 toUInt64(const char *value)
/*! /*!
* \brief Returns a 32-bit floating point number converted from four bytes at a specified position in a char array. * \brief Returns a 32-bit floating point number converted from four bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline float32 toFloat32(const char *value) CPP_UTILITIES_EXPORT inline float32 toFloat32(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
int32 val = toInt32(value); int32 val = toInt32(value);
@ -159,7 +159,7 @@ LIB_EXPORT inline float32 toFloat32(const char *value)
/*! /*!
* \brief Returns a 64-bit floating point number converted from eight bytes at a specified position in a char array. * \brief Returns a 64-bit floating point number converted from eight bytes at a specified position in a char array.
*/ */
LIB_EXPORT inline float64 toFloat64(const char *value) CPP_UTILITIES_EXPORT inline float64 toFloat64(const char *value)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
int64 val = toInt64(value); int64 val = toInt64(value);
@ -175,7 +175,7 @@ LIB_EXPORT inline float64 toFloat64(const char *value)
/*! /*!
* \brief Stores the specified 16-bit signed integer value at a specified position in a char array. * \brief Stores the specified 16-bit signed integer value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(int16 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(int16 value, char *outputbuffer)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
outputbuffer[0] = static_cast<char>((value >> 8) & 0xFF); outputbuffer[0] = static_cast<char>((value >> 8) & 0xFF);
@ -189,7 +189,7 @@ LIB_EXPORT inline void getBytes(int16 value, char *outputbuffer)
/*! /*!
* \brief Stores the specified 16-bit unsigned integer value at a specified position in a char array. * \brief Stores the specified 16-bit unsigned integer value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(uint16 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(uint16 value, char *outputbuffer)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
outputbuffer[0] = static_cast<char>((value >> 8) & 0xFF); outputbuffer[0] = static_cast<char>((value >> 8) & 0xFF);
@ -204,7 +204,7 @@ LIB_EXPORT inline void getBytes(uint16 value, char *outputbuffer)
* \brief Stores the specified 24-bit unsigned integer value at a specified position in a char array. * \brief Stores the specified 24-bit unsigned integer value at a specified position in a char array.
* \remarks Ignores the most significant byte. * \remarks Ignores the most significant byte.
*/ */
LIB_EXPORT inline void getBytes24(uint32 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes24(uint32 value, char *outputbuffer)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
outputbuffer[0] = static_cast<char>((value >> 16) & 0xFF); outputbuffer[0] = static_cast<char>((value >> 16) & 0xFF);
@ -220,7 +220,7 @@ LIB_EXPORT inline void getBytes24(uint32 value, char *outputbuffer)
/*! /*!
* \brief Stores the specified 32-bit signed integer value at a specified position in a char array. * \brief Stores the specified 32-bit signed integer value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(int32 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(int32 value, char *outputbuffer)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
outputbuffer[0] = static_cast<char>((value >> 24) & 0xFF); outputbuffer[0] = static_cast<char>((value >> 24) & 0xFF);
@ -238,7 +238,7 @@ LIB_EXPORT inline void getBytes(int32 value, char *outputbuffer)
/*! /*!
* \brief Stores the specified 32-bit signed integer value at a specified position in a char array. * \brief Stores the specified 32-bit signed integer value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(uint32 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(uint32 value, char *outputbuffer)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
outputbuffer[0] = static_cast<char>((value >> 24) & 0xFF); outputbuffer[0] = static_cast<char>((value >> 24) & 0xFF);
@ -256,7 +256,7 @@ LIB_EXPORT inline void getBytes(uint32 value, char *outputbuffer)
/*! /*!
* \brief Stores the specified 64-bit signed integer value at a specified position in a char array. * \brief Stores the specified 64-bit signed integer value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(int64 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(int64 value, char *outputbuffer)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
outputbuffer[0] = static_cast<char>((value >> 56) & 0xFF); outputbuffer[0] = static_cast<char>((value >> 56) & 0xFF);
@ -282,7 +282,7 @@ LIB_EXPORT inline void getBytes(int64 value, char *outputbuffer)
/*! /*!
* \brief Stores the specified 64-bit unsigned integer value at a specified position in a char array. * \brief Stores the specified 64-bit unsigned integer value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(uint64 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(uint64 value, char *outputbuffer)
{ {
#if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0
outputbuffer[0] = static_cast<char>((value >> 56) & 0xFF); outputbuffer[0] = static_cast<char>((value >> 56) & 0xFF);
@ -308,7 +308,7 @@ LIB_EXPORT inline void getBytes(uint64 value, char *outputbuffer)
/*! /*!
* \brief Stores the specified 32-bit floating point value at a specified position in a char array. * \brief Stores the specified 32-bit floating point value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(float32 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(float32 value, char *outputbuffer)
{ {
char *c = reinterpret_cast<char *>(&value); char *c = reinterpret_cast<char *>(&value);
int32 i = *reinterpret_cast<int32 *>(c); int32 i = *reinterpret_cast<int32 *>(c);
@ -318,7 +318,7 @@ LIB_EXPORT inline void getBytes(float32 value, char *outputbuffer)
/*! /*!
* \brief Stores the specified 64-bit floating point value at a specified position in a char array. * \brief Stores the specified 64-bit floating point value at a specified position in a char array.
*/ */
LIB_EXPORT inline void getBytes(float64 value, char *outputbuffer) CPP_UTILITIES_EXPORT inline void getBytes(float64 value, char *outputbuffer)
{ {
char *c = reinterpret_cast<char *>(&value); char *c = reinterpret_cast<char *>(&value);
int64 i = *reinterpret_cast<int64 *>(c); int64 i = *reinterpret_cast<int64 *>(c);

View File

@ -1,14 +1,14 @@
#ifndef CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H #ifndef CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H
#define CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H #define CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H
#include "../application/global.h" #include "../global.h"
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
namespace ConversionUtilities { namespace ConversionUtilities {
class LIB_EXPORT ConversionException : public std::runtime_error class CPP_UTILITIES_EXPORT ConversionException : public std::runtime_error
{ {
public: public:
ConversionException() USE_NOTHROW; ConversionException() USE_NOTHROW;

View File

@ -19,7 +19,7 @@ namespace ConversionUtilities
/*! /*!
* \brief The StringDataDeleter struct deletes the data of a StringData instance. * \brief The StringDataDeleter struct deletes the data of a StringData instance.
*/ */
struct LIB_EXPORT StringDataDeleter { struct CPP_UTILITIES_EXPORT StringDataDeleter {
/*! /*!
* \brief Deletes the specified \a stringData with std::free(), because the memory has been * \brief Deletes the specified \a stringData with std::free(), because the memory has been
* allocated using std::malloc()/std::realloc(). * allocated using std::malloc()/std::realloc().
@ -36,15 +36,15 @@ struct LIB_EXPORT StringDataDeleter {
typedef std::pair<std::unique_ptr<char[], StringDataDeleter>, std::size_t> StringData; typedef std::pair<std::unique_ptr<char[], StringDataDeleter>, std::size_t> StringData;
//typedef std::pair<std::unique_ptr<char>, std::size_t> StringData; // might work too //typedef std::pair<std::unique_ptr<char>, std::size_t> StringData; // might work too
LIB_EXPORT StringData convertString(const char *fromCharset, const char *toCharset, const char *inputBuffer, std::size_t inputBufferSize, float outputBufferSizeFactor = 1.0f); CPP_UTILITIES_EXPORT StringData convertString(const char *fromCharset, const char *toCharset, const char *inputBuffer, std::size_t inputBufferSize, float outputBufferSizeFactor = 1.0f);
LIB_EXPORT StringData convertUtf8ToUtf16LE(const char *inputBuffer, std::size_t inputBufferSize); CPP_UTILITIES_EXPORT StringData convertUtf8ToUtf16LE(const char *inputBuffer, std::size_t inputBufferSize);
LIB_EXPORT StringData convertUtf16LEToUtf8(const char *inputBuffer, std::size_t inputBufferSize); CPP_UTILITIES_EXPORT StringData convertUtf16LEToUtf8(const char *inputBuffer, std::size_t inputBufferSize);
LIB_EXPORT StringData convertUtf8ToUtf16BE(const char *inputBuffer, std::size_t inputBufferSize); CPP_UTILITIES_EXPORT StringData convertUtf8ToUtf16BE(const char *inputBuffer, std::size_t inputBufferSize);
LIB_EXPORT StringData convertUtf16BEToUtf8(const char *inputBuffer, std::size_t inputBufferSize); CPP_UTILITIES_EXPORT StringData convertUtf16BEToUtf8(const char *inputBuffer, std::size_t inputBufferSize);
LIB_EXPORT StringData convertLatin1ToUtf8(const char *inputBuffer, std::size_t inputBufferSize); CPP_UTILITIES_EXPORT StringData convertLatin1ToUtf8(const char *inputBuffer, std::size_t inputBufferSize);
LIB_EXPORT StringData convertUtf8ToLatin1(const char *inputBuffer, std::size_t inputBufferSize); CPP_UTILITIES_EXPORT StringData convertUtf8ToLatin1(const char *inputBuffer, std::size_t inputBufferSize);
LIB_EXPORT void truncateString(std::string &str, char terminationChar = '\0'); CPP_UTILITIES_EXPORT void truncateString(std::string &str, char terminationChar = '\0');
/*! /*!
* \brief Joins the given \a strings using the specified \a delimiter. * \brief Joins the given \a strings using the specified \a delimiter.
@ -59,7 +59,7 @@ LIB_EXPORT void truncateString(std::string &str, char terminationChar = '\0');
* \tparam Container The STL-container used to provide the \a strings. * \tparam Container The STL-container used to provide the \a strings.
* \returns Returns the joined string. * \returns Returns the joined string.
*/ */
template <class Container = std::initializer_list<std::string> > LIB_EXPORT template <class Container = std::initializer_list<std::string> > CPP_UTILITIES_EXPORT
typename Container::value_type joinStrings(const Container &strings, const typename Container::value_type &delimiter = typename Container::value_type(), bool omitEmpty = false, const typename Container::value_type &leftClosure = typename Container::value_type(), const typename Container::value_type &rightClosure = typename Container::value_type()) typename Container::value_type joinStrings(const Container &strings, const typename Container::value_type &delimiter = typename Container::value_type(), bool omitEmpty = false, const typename Container::value_type &leftClosure = typename Container::value_type(), const typename Container::value_type &rightClosure = typename Container::value_type())
{ {
typename Container::value_type res; typename Container::value_type res;
@ -108,7 +108,7 @@ enum class EmptyPartsTreat
* \tparam Container The STL-container used to return the parts. * \tparam Container The STL-container used to return the parts.
* \returns Returns the parts. * \returns Returns the parts.
*/ */
template <class Container = std::list<std::string> > LIB_EXPORT template <class Container = std::list<std::string> > CPP_UTILITIES_EXPORT
Container splitString(const typename Container::value_type &string, const typename Container::value_type &delimiter, EmptyPartsTreat emptyPartsRole = EmptyPartsTreat::Keep, int maxParts = -1) Container splitString(const typename Container::value_type &string, const typename Container::value_type &delimiter, EmptyPartsTreat emptyPartsRole = EmptyPartsTreat::Keep, int maxParts = -1)
{ {
--maxParts; --maxParts;
@ -148,7 +148,7 @@ Container splitString(const typename Container::value_type &string, const typena
/*! /*!
* \brief Returns whether \a str starts with \a phrase. * \brief Returns whether \a str starts with \a phrase.
*/ */
template <typename StringType> LIB_EXPORT bool startsWith(const StringType &str, const StringType &phrase) template <typename StringType> CPP_UTILITIES_EXPORT bool startsWith(const StringType &str, const StringType &phrase)
{ {
if(str.size() < phrase.size()) { if(str.size() < phrase.size()) {
return false; return false;
@ -166,7 +166,7 @@ template <typename StringType> LIB_EXPORT bool startsWith(const StringType &str,
/*! /*!
* \brief Returns whether \a str starts with \a phrase. * \brief Returns whether \a str starts with \a phrase.
*/ */
template <typename StringType> LIB_EXPORT bool startsWith(const StringType &str, const typename StringType::value_type *phrase) template <typename StringType> CPP_UTILITIES_EXPORT bool startsWith(const StringType &str, const typename StringType::value_type *phrase)
{ {
for(auto stri = str.cbegin(), strend = str.cend(); stri != strend; ++stri, ++phrase) { for(auto stri = str.cbegin(), strend = str.cend(); stri != strend; ++stri, ++phrase) {
if(!*phrase) { if(!*phrase) {
@ -182,7 +182,7 @@ template <typename StringType> LIB_EXPORT bool startsWith(const StringType &str,
* \brief Returns whether \a str contains the specified \a substrings. * \brief Returns whether \a str contains the specified \a substrings.
* \remarks The \a substrings must occur in the specified order. * \remarks The \a substrings must occur in the specified order.
*/ */
template <typename StringType> LIB_EXPORT bool containsSubstrings(const StringType &str, std::initializer_list<StringType> substrings) template <typename StringType> CPP_UTILITIES_EXPORT bool containsSubstrings(const StringType &str, std::initializer_list<StringType> substrings)
{ {
typename StringType::size_type currentPos = 0; typename StringType::size_type currentPos = 0;
for(const auto &substr : substrings) { for(const auto &substr : substrings) {
@ -198,7 +198,7 @@ template <typename StringType> LIB_EXPORT bool containsSubstrings(const StringTy
* \brief Returns whether \a str contains the specified \a substrings. * \brief Returns whether \a str contains the specified \a substrings.
* \remarks The \a substrings must occur in the specified order. * \remarks The \a substrings must occur in the specified order.
*/ */
template <typename StringType> LIB_EXPORT bool containsSubstrings(const StringType &str, std::initializer_list<const typename StringType::value_type *> substrings) template <typename StringType> CPP_UTILITIES_EXPORT bool containsSubstrings(const StringType &str, std::initializer_list<const typename StringType::value_type *> substrings)
{ {
typename StringType::size_type currentPos = 0; typename StringType::size_type currentPos = 0;
for(const auto *substr : substrings) { for(const auto *substr : substrings) {
@ -213,7 +213,7 @@ template <typename StringType> LIB_EXPORT bool containsSubstrings(const StringTy
/*! /*!
* \brief Replaces all occurences of \a find with \a relpace in the specified \a str. * \brief Replaces all occurences of \a find with \a relpace in the specified \a str.
*/ */
template <typename StringType> LIB_EXPORT void findAndReplace(StringType &str, const StringType &find, const StringType &replace) template <typename StringType> CPP_UTILITIES_EXPORT void findAndReplace(StringType &str, const StringType &find, const StringType &replace)
{ {
for(typename StringType::size_type i = 0; (i = str.find(find, i)) != StringType::npos; i += replace.size()) { for(typename StringType::size_type i = 0; (i = str.find(find, i)) != StringType::npos; i += replace.size()) {
str.replace(i, find.size(), replace); str.replace(i, find.size(), replace);
@ -226,7 +226,7 @@ template <typename StringType> LIB_EXPORT void findAndReplace(StringType &str, c
* \tparam StringType The string type (should be an instantiation of the basic_string class template). * \tparam StringType The string type (should be an instantiation of the basic_string class template).
* \sa stringToNumber() * \sa stringToNumber()
*/ */
template <typename NumberType, typename StringType = std::string> LIB_EXPORT StringType numberToString(NumberType number, int base = 10) template <typename NumberType, typename StringType = std::string> CPP_UTILITIES_EXPORT StringType numberToString(NumberType number, int base = 10)
{ {
std::basic_stringstream<typename StringType::value_type> ss; std::basic_stringstream<typename StringType::value_type> ss;
ss << std::setbase(base) << number; ss << std::setbase(base) << number;
@ -240,7 +240,7 @@ template <typename NumberType, typename StringType = std::string> LIB_EXPORT Str
* \throws A ConversionException will be thrown if the provided string is not a valid number. * \throws A ConversionException will be thrown if the provided string is not a valid number.
* \sa numberToString() * \sa numberToString()
*/ */
template <typename NumberType, typename StringType> LIB_EXPORT NumberType stringToNumber(const StringType &string, int base = 10) template <typename NumberType, typename StringType> CPP_UTILITIES_EXPORT NumberType stringToNumber(const StringType &string, int base = 10)
{ {
std::basic_stringstream<typename StringType::value_type> ss; std::basic_stringstream<typename StringType::value_type> ss;
ss << std::setbase(base) << string; ss << std::setbase(base) << string;
@ -259,7 +259,7 @@ template <typename NumberType, typename StringType> LIB_EXPORT NumberType string
* \throws A ConversionException will be thrown if the provided string is not a valid number. * \throws A ConversionException will be thrown if the provided string is not a valid number.
* \sa numberToString() * \sa numberToString()
*/ */
template <typename NumberType, typename CharType> LIB_EXPORT NumberType stringToNumber(const CharType *string, int base = 10) template <typename NumberType, typename CharType> CPP_UTILITIES_EXPORT NumberType stringToNumber(const CharType *string, int base = 10)
{ {
std::basic_stringstream<CharType> ss; std::basic_stringstream<CharType> ss;
ss << std::setbase(base) << string; ss << std::setbase(base) << string;
@ -280,17 +280,17 @@ template <typename NumberType, typename CharType> LIB_EXPORT NumberType stringTo
* *
* \tparam T The data type of the integer to be interpreted. * \tparam T The data type of the integer to be interpreted.
*/ */
template <typename T> LIB_EXPORT std::string interpretIntegerAsString(T integer, int startOffset = 0) template <typename T> CPP_UTILITIES_EXPORT std::string interpretIntegerAsString(T integer, int startOffset = 0)
{ {
char buffer[sizeof(T)]; char buffer[sizeof(T)];
ConversionUtilities::BE::getBytes(integer, buffer); ConversionUtilities::BE::getBytes(integer, buffer);
return std::string(buffer + startOffset, sizeof(T) - startOffset); return std::string(buffer + startOffset, sizeof(T) - startOffset);
} }
LIB_EXPORT std::string dataSizeToString(uint64 sizeInByte, bool includeByte = false); CPP_UTILITIES_EXPORT std::string dataSizeToString(uint64 sizeInByte, bool includeByte = false);
LIB_EXPORT std::string bitrateToString(double speedInKbitsPerSecond, bool useByteInsteadOfBits = false); CPP_UTILITIES_EXPORT std::string bitrateToString(double speedInKbitsPerSecond, bool useByteInsteadOfBits = false);
LIB_EXPORT std::string encodeBase64(const byte *data, uint32 dataSize); CPP_UTILITIES_EXPORT std::string encodeBase64(const byte *data, uint32 dataSize);
LIB_EXPORT std::pair<std::unique_ptr<byte[]>, uint32> decodeBase64(const char *encodedStr, const uint32 strSize); CPP_UTILITIES_EXPORT std::pair<std::unique_ptr<byte[]>, uint32> decodeBase64(const char *encodedStr, const uint32 strSize);
} }

View File

@ -59,7 +59,7 @@ typedef std::uintptr_t uintptr;
*/ */
typedef float float32; typedef float float32;
#else #else
#error "Unable to define float32!" # error "Unable to define float32!"
#endif #endif
#if __SIZEOF_DOUBLE__ == 8 #if __SIZEOF_DOUBLE__ == 8
@ -68,7 +68,7 @@ typedef float float32;
*/ */
typedef double float64; typedef double float64;
#else #else
#error "Unable to define float64!" # error "Unable to define float64!"
#endif #endif
#endif // CONVERSION_UTILITIES_TYPES_H #endif // CONVERSION_UTILITIES_TYPES_H

View File

@ -1,7 +1,7 @@
#ifndef CONVERSION_UTILITIES_WIDEN_H #ifndef CONVERSION_UTILITIES_WIDEN_H
#define CONVERSION_UTILITIES_WIDEN_H #define CONVERSION_UTILITIES_WIDEN_H
#include "../application/global.h" #include "../global.h"
#include <string> #include <string>
#include <vector> #include <vector>
@ -16,7 +16,7 @@ namespace ConversionUtilities
* \brief Converts a std::string to a wide string using the specified locale. * \brief Converts a std::string to a wide string using the specified locale.
*/ */
template<class E, class T = std::char_traits<E>, class A = std::allocator<E> > template<class E, class T = std::char_traits<E>, class A = std::allocator<E> >
class LIB_EXPORT Widen : public std::unary_function<const std::string &, std::basic_string<E, T, A> > class CPP_UTILITIES_EXPORT Widen : public std::unary_function<const std::string &, std::basic_string<E, T, A> >
{ {
public: public:
/*! /*!

17
global.h Normal file
View File

@ -0,0 +1,17 @@
// Created via CMake from template global.h.in
// WARNING! Any changes to this file will be overwritten by the next CMake run!
#ifndef CPP_UTILITIES_GLOBAL
#define CPP_UTILITIES_GLOBAL
#include "./application/global.h"
#ifdef CPP_UTILITIES_STATIC
# define CPP_UTILITIES_EXPORT
# define CPP_UTILITIES_IMPORT
#else
# define CPP_UTILITIES_EXPORT LIB_EXPORT
# define CPP_UTILITIES_IMPORT LIB_IMPORT
#endif
#endif // CPP_UTILITIES_GLOBAL

View File

@ -1,7 +1,7 @@
#ifndef IOUTILITIES_ANSIESCAPECODES #ifndef IOUTILITIES_ANSIESCAPECODES
#define IOUTILITIES_ANSIESCAPECODES #define IOUTILITIES_ANSIESCAPECODES
#include "../application/global.h" #include "../global.h"
#include <ostream> #include <ostream>

View File

@ -1,8 +1,6 @@
#ifndef IOUTILITIES_BINERYREADER_H #ifndef IOUTILITIES_BINERYREADER_H
#define IOUTILITIES_BINERYREADER_H #define IOUTILITIES_BINERYREADER_H
#include "../application/global.h"
#include "../conversion/types.h"
#include "../conversion/binaryconversion.h" #include "../conversion/binaryconversion.h"
#include <vector> #include <vector>
@ -11,7 +9,7 @@
namespace IoUtilities namespace IoUtilities
{ {
class LIB_EXPORT BinaryReader class CPP_UTILITIES_EXPORT BinaryReader
{ {
public: public:

View File

@ -1,7 +1,6 @@
#ifndef IOUTILITIES_BINARYWRITER_H #ifndef IOUTILITIES_BINARYWRITER_H
#define IOUTILITIES_BINARYWRITER_H #define IOUTILITIES_BINARYWRITER_H
#include "../application/global.h"
#include "../conversion/types.h" #include "../conversion/types.h"
#include "../conversion/binaryconversion.h" #include "../conversion/binaryconversion.h"
@ -12,7 +11,7 @@
namespace IoUtilities namespace IoUtilities
{ {
class LIB_EXPORT BinaryWriter class CPP_UTILITIES_EXPORT BinaryWriter
{ {
public: public:
BinaryWriter(std::ostream *stream); BinaryWriter(std::ostream *stream);

View File

@ -2,8 +2,8 @@
#define IOUTILITIES_BITREADER_H #define IOUTILITIES_BITREADER_H
#include "../conversion/types.h" #include "../conversion/types.h"
#include "../application/global.h"
#include "../io/catchiofailure.h" #include "../io/catchiofailure.h"
#include "../global.h"
#include <ios> #include <ios>
#include <iostream> #include <iostream>
@ -11,7 +11,7 @@
namespace IoUtilities { namespace IoUtilities {
class LIB_EXPORT BitReader class CPP_UTILITIES_EXPORT BitReader
{ {
public: public:
BitReader(const char *buffer, std::size_t bufferSize); BitReader(const char *buffer, std::size_t bufferSize);

View File

@ -1,14 +1,14 @@
#ifndef IOUTILITIES_CATCHIOFAILURE_H #ifndef IOUTILITIES_CATCHIOFAILURE_H
#define IOUTILITIES_CATCHIOFAILURE_H #define IOUTILITIES_CATCHIOFAILURE_H
#include "../application/global.h" #include "../global.h"
#include <string> #include <string>
namespace IoUtilities { namespace IoUtilities {
LIB_EXPORT const char *catchIoFailure(); CPP_UTILITIES_EXPORT const char *catchIoFailure();
LIB_EXPORT void throwIoFailure(const char *what); CPP_UTILITIES_EXPORT void throwIoFailure(const char *what);
} }

View File

@ -1,7 +1,7 @@
#ifndef IOUTILITIES_COPY_H #ifndef IOUTILITIES_COPY_H
#define IOUTILITIES_COPY_H #define IOUTILITIES_COPY_H
#include "../application/global.h" #include "../global.h"
#include <iostream> #include <iostream>
#include <functional> #include <functional>
@ -14,7 +14,7 @@ namespace IoUtilities {
* \tparam Specifies the buffer size. * \tparam Specifies the buffer size.
*/ */
template<std::size_t bufferSize> template<std::size_t bufferSize>
class LIB_EXPORT CopyHelper class CPP_UTILITIES_EXPORT CopyHelper
{ {
public: public:
CopyHelper(); CopyHelper();

View File

@ -1,7 +1,7 @@
#ifndef IOUTILITIES_INIFILE_H #ifndef IOUTILITIES_INIFILE_H
#define IOUTILITIES_INIFILE_H #define IOUTILITIES_INIFILE_H
#include "../application/global.h" #include "../global.h"
#include <vector> #include <vector>
#include <map> #include <map>
@ -9,7 +9,7 @@
namespace IoUtilities { namespace IoUtilities {
class LIB_EXPORT IniFile class CPP_UTILITIES_EXPORT IniFile
{ {
public: public:
IniFile(); IniFile();

View File

@ -1,6 +1,5 @@
#include "./path.h" #include "./path.h"
#include "../application/global.h"
#include "../conversion/widen.h" #include "../conversion/widen.h"
#include <string> #include <string>

View File

@ -4,8 +4,6 @@
#include "./binarywriter.h" #include "./binarywriter.h"
#include "./binaryreader.h" #include "./binaryreader.h"
#include "../application/global.h"
#include <string> #include <string>
#include <list> #include <list>
@ -45,11 +43,11 @@ constexpr DirectoryEntryType operator&(DirectoryEntryType lhs, DirectoryEntryTyp
return static_cast<DirectoryEntryType>(static_cast<unsigned char>(lhs) & static_cast<unsigned char>(rhs)); return static_cast<DirectoryEntryType>(static_cast<unsigned char>(lhs) & static_cast<unsigned char>(rhs));
} }
LIB_EXPORT std::string fileName(const std::string &path); CPP_UTILITIES_EXPORT std::string fileName(const std::string &path);
LIB_EXPORT std::string directory(const std::string &path); CPP_UTILITIES_EXPORT std::string directory(const std::string &path);
LIB_EXPORT void removeInvalidChars(std::string &fileName); CPP_UTILITIES_EXPORT void removeInvalidChars(std::string &fileName);
LIB_EXPORT bool settingsDirectory(std::string &result, std::string applicationDirectoryName = std::string(), bool createApplicationDirectory = false); CPP_UTILITIES_EXPORT bool settingsDirectory(std::string &result, std::string applicationDirectoryName = std::string(), bool createApplicationDirectory = false);
LIB_EXPORT std::list<std::string> directoryEntries(const char *path, DirectoryEntryType types = DirectoryEntryType::All); CPP_UTILITIES_EXPORT std::list<std::string> directoryEntries(const char *path, DirectoryEntryType types = DirectoryEntryType::All);
} }

View File

@ -1,17 +1,17 @@
#ifndef MATHUTILITIES_H #ifndef MATHUTILITIES_H
#define MATHUTILITIES_H #define MATHUTILITIES_H
#include "../application/global.h" #include "../global.h"
#include "../conversion/types.h" #include "../conversion/types.h"
namespace MathUtilities { namespace MathUtilities {
LIB_EXPORT int random(int lowerbounds, int upperbounds); CPP_UTILITIES_EXPORT int random(int lowerbounds, int upperbounds);
LIB_EXPORT int digitsum(int number, int base = 10); CPP_UTILITIES_EXPORT int digitsum(int number, int base = 10);
LIB_EXPORT int factorial(int number); CPP_UTILITIES_EXPORT int factorial(int number);
LIB_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module); CPP_UTILITIES_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module);
LIB_EXPORT int64 inverseModulo(int64 number, int64 module); CPP_UTILITIES_EXPORT int64 inverseModulo(int64 number, int64 module);
LIB_EXPORT uint64 orderModulo(uint64 number, uint64 module); CPP_UTILITIES_EXPORT uint64 orderModulo(uint64 number, uint64 module);
} }

View File

@ -1,14 +1,14 @@
#ifndef RANDOMUTILS_H #ifndef RANDOMUTILS_H
#define RANDOMUTILS_H #define RANDOMUTILS_H
#include "../application/global.h" #include "../global.h"
#include <functional> #include <functional>
namespace RandomUtilities { namespace RandomUtilities {
LIB_EXPORT void generateRandomCharacterSequence(char *result, unsigned int length, bool useSmallLetters = true, bool useCapitalLetters = true, bool useNumbers = true, bool useSymbols = true, bool useAtLeastOneOfEachCategory = true); CPP_UTILITIES_EXPORT void generateRandomCharacterSequence(char *result, unsigned int length, bool useSmallLetters = true, bool useCapitalLetters = true, bool useNumbers = true, bool useSymbols = true, bool useAtLeastOneOfEachCategory = true);
LIB_EXPORT void generateRandomCharacterSequence(char *result, unsigned int length, std::function<int ()> randomizer, int maximalRandomNumber, bool useSmallLetters = true, bool useCapitalLetters = true, bool useNumbers = true, bool useSymbols = true, bool useAtLeastOneOfEachCategory = true); CPP_UTILITIES_EXPORT void generateRandomCharacterSequence(char *result, unsigned int length, std::function<int ()> randomizer, int maximalRandomNumber, bool useSmallLetters = true, bool useCapitalLetters = true, bool useNumbers = true, bool useSymbols = true, bool useAtLeastOneOfEachCategory = true);
} }

View File

@ -8,7 +8,7 @@
namespace TestUtilities { namespace TestUtilities {
class LIB_EXPORT TestApplication class CPP_UTILITIES_EXPORT TestApplication
{ {
public: public:
TestApplication(int argc, char **argv); TestApplication(int argc, char **argv);
@ -79,7 +79,7 @@ inline const std::vector<const char *> &TestApplication::units() const
* \remarks A TestApplication must be present. * \remarks A TestApplication must be present.
* \sa TestApplication::testFilePath() * \sa TestApplication::testFilePath()
*/ */
inline LIB_EXPORT std::string testFilePath(const std::string &name) inline CPP_UTILITIES_EXPORT std::string testFilePath(const std::string &name)
{ {
return TestApplication::instance()->testFilePath(name); return TestApplication::instance()->testFilePath(name);
} }
@ -90,7 +90,7 @@ inline LIB_EXPORT std::string testFilePath(const std::string &name)
* \remarks A TestApplication must be present. * \remarks A TestApplication must be present.
* \sa TestApplication::workingCopyPath() * \sa TestApplication::workingCopyPath()
*/ */
inline LIB_EXPORT std::string workingCopyPath(const std::string &name) inline CPP_UTILITIES_EXPORT std::string workingCopyPath(const std::string &name)
{ {
return TestApplication::instance()->workingCopyPath(name); return TestApplication::instance()->workingCopyPath(name);
} }
@ -100,7 +100,7 @@ inline LIB_EXPORT std::string workingCopyPath(const std::string &name)
* \remarks A TestApplication must be present. * \remarks A TestApplication must be present.
* \sa TestApplication::execApp() * \sa TestApplication::execApp()
*/ */
inline LIB_EXPORT int execApp(const char *const *args, std::string &output, std::string &errors) inline CPP_UTILITIES_EXPORT int execApp(const char *const *args, std::string &output, std::string &errors)
{ {
return TestApplication::instance()->execApp(args, output, errors); return TestApplication::instance()->execApp(args, output, errors);
} }