Prefix most of the macros in global.h

This commit is contained in:
Martchus 2019-06-12 20:34:25 +02:00
parent 4e2539548d
commit fd531bdd6a
6 changed files with 30 additions and 31 deletions

View File

@ -907,7 +907,7 @@ void ArgumentParser::parseArgs(int argc, const char *const *argv, ParseArgumentB
*/ */
void ArgumentParser::readArgs(int argc, const char *const *argv) void ArgumentParser::readArgs(int argc, const char *const *argv)
{ {
IF_DEBUG_BUILD(verifyArgs(m_mainArgs);) CPP_UTILITIES_IF_DEBUG_BUILD(verifyArgs(m_mainArgs);)
m_actualArgc = 0; m_actualArgc = 0;
// the first argument is the executable name // the first argument is the executable name
@ -1005,7 +1005,7 @@ bool ArgumentParser::isUncombinableMainArgPresent() const
return false; return false;
} }
#ifdef DEBUG_BUILD #ifdef CPP_UTILITIES_DEBUG_BUILD
/*! /*!
* \brief Verifies the specified \a argument definitions. * \brief Verifies the specified \a argument definitions.
* *

View File

@ -8,7 +8,7 @@
#include <initializer_list> #include <initializer_list>
#include <limits> #include <limits>
#include <vector> #include <vector>
#ifdef DEBUG_BUILD #ifdef CPP_UTILITIES_DEBUG_BUILD
#include <cassert> #include <cassert>
#endif #endif
@ -484,7 +484,7 @@ public:
private: private:
// declare internal operations // declare internal operations
IF_DEBUG_BUILD(void verifyArgs(const ArgumentVector &args);) CPP_UTILITIES_IF_DEBUG_BUILD(void verifyArgs(const ArgumentVector &args);)
ArgumentCompletionInfo determineCompletionInfo( ArgumentCompletionInfo determineCompletionInfo(
int argc, const char *const *argv, unsigned int currentWordIndex, const ArgumentReader &reader) const; int argc, const char *const *argv, unsigned int currentWordIndex, const ArgumentReader &reader) const;
std::string findSuggestions(int argc, const char *const *argv, unsigned int cursorPos, const ArgumentReader &reader) const; std::string findSuggestions(int argc, const char *const *argv, unsigned int cursorPos, const ArgumentReader &reader) const;
@ -522,7 +522,7 @@ inline const char *Argument::name() const
*/ */
inline void Argument::setName(const char *name) inline void Argument::setName(const char *name)
{ {
#ifdef DEBUG_BUILD #ifdef CPP_UTILITIES_DEBUG_BUILD
if (name && *name) { if (name && *name) {
assert(*name != '-'); assert(*name != '-');
for (const char *c = name; *c; ++c) { for (const char *c = name; *c; ++c) {
@ -552,8 +552,8 @@ inline char Argument::abbreviation() const
*/ */
inline void Argument::setAbbreviation(char abbreviation) inline void Argument::setAbbreviation(char abbreviation)
{ {
IF_DEBUG_BUILD(assert(abbreviation != ' ' && abbreviation != '=' && abbreviation != '-' && abbreviation != '\'' && abbreviation != '"' CPP_UTILITIES_IF_DEBUG_BUILD(assert(abbreviation != ' ' && abbreviation != '=' && abbreviation != '-' && abbreviation != '\''
&& abbreviation != '\n' && abbreviation != '\r')); && abbreviation != '"' && abbreviation != '\n' && abbreviation != '\r'));
m_abbreviation = abbreviation; m_abbreviation = abbreviation;
} }

View File

@ -1,5 +1,5 @@
#ifndef APPLICATION_UTILITIES_GLOBAL_H #ifndef CPP_UTILITIES_APPLICATION_UTILITIES_GLOBAL_H
#define APPLICATION_UTILITIES_GLOBAL_H #define CPP_UTILITIES_APPLICATION_UTILITIES_GLOBAL_H
#if defined(_WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) #if defined(_WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
#ifndef PLATFORM_WINDOWS #ifndef PLATFORM_WINDOWS
@ -58,49 +58,48 @@
#endif #endif
/*! /*!
* \def LIB_EXPORT * \def CPP_UTILITIES_GENERIC_LIB_EXPORT
* \brief Marks a symbol for shared library export. * \brief Marks a symbol for shared library export.
*/ */
/*! /*!
* \def LIB_IMPORT * \def CPP_UTILITIES_GENERIC_LIB_IMPORT
* \brief Declares a symbol to be an import from a shared library. * \brief Declares a symbol to be an import from a shared library.
*/ */
/*! /*!
* \def LIB_HIDDEN * \def CPP_UTILITIES_GENERIC_LIB_HIDDEN
* \brief Hidden visibility indicates that the symbol will not be placed into * \brief Hidden visibility indicates that the symbol will not be placed into
* the dynamic symbol table, so no other module (executable or shared library) * the dynamic symbol table, so no other module (executable or shared library)
* can reference it directly. * can reference it directly.
*/ */
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
#define LIB_EXPORT __declspec(dllexport) #define CPP_UTILITIES_GENERIC_LIB_EXPORT __declspec(dllexport)
#define LIB_IMPORT __declspec(dllimport) #define CPP_UTILITIES_GENERIC_LIB_IMPORT __declspec(dllimport)
#define LIB_HIDDEN #define CPP_UTILITIES_GENERIC_LIB_HIDDEN
#else #else
#define LIB_EXPORT __attribute__((visibility("default"))) #define CPP_UTILITIES_GENERIC_LIB_EXPORT __attribute__((visibility("default")))
#define LIB_IMPORT __attribute__((visibility("default"))) #define CPP_UTILITIES_GENERIC_LIB_IMPORT __attribute__((visibility("default")))
#define LIB_HIDDEN __attribute__((visibility("hidden"))) #define CPP_UTILITIES_GENERIC_LIB_HIDDEN __attribute__((visibility("hidden")))
#endif #endif
/*! /*!
* \def VAR_UNUSED * \def CPP_UTILITIES_UNUSED
* \brief Prevents warnings about unused variables. * \brief Prevents warnings about unused variables.
*/ */
#define VAR_UNUSED(x) (void)x; #define CPP_UTILITIES_UNUSED(x) (void)x;
/*! /*!
* \def IF_DEBUG_BUILD * \def CPP_UTILITIES_IF_DEBUG_BUILD
* \brief Wraps debug-only lines conveniently. * \brief Wraps debug-only lines conveniently.
*/ */
#ifdef DEBUG_BUILD #ifdef CPP_UTILITIES_DEBUG_BUILD
#define IF_DEBUG_BUILD(x) x #define CPP_UTILITIES_IF_DEBUG_BUILD(x) x
#else #else
#define IF_DEBUG_BUILD(x) #define CPP_UTILITIES_IF_DEBUG_BUILD(x)
#endif #endif
#endif // CPP_UTILITIES_APPLICATION_UTILITIES_GLOBAL_H
#endif // APPLICATION_UTILITIES_GLOBAL_H

View File

@ -190,7 +190,7 @@ endif ()
# enable debug-only code when doing a debug build # enable debug-only code when doing a debug build
if (CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS DEBUG_BUILD) list(APPEND META_PRIVATE_COMPILE_DEFINITIONS CPP_UTILITIES_DEBUG_BUILD)
message(STATUS "Debug build enabled.") message(STATUS "Debug build enabled.")
endif () endif ()

View File

@ -10,8 +10,8 @@
#define @META_PROJECT_VARNAME_UPPER@_EXPORT #define @META_PROJECT_VARNAME_UPPER@_EXPORT
#define @META_PROJECT_VARNAME_UPPER@_IMPORT #define @META_PROJECT_VARNAME_UPPER@_IMPORT
#else #else
#define @META_PROJECT_VARNAME_UPPER@_EXPORT LIB_EXPORT #define @META_PROJECT_VARNAME_UPPER@_EXPORT CPP_UTILITIES_GENERIC_LIB_EXPORT
#define @META_PROJECT_VARNAME_UPPER@_IMPORT LIB_IMPORT #define @META_PROJECT_VARNAME_UPPER@_IMPORT CPP_UTILITIES_GENERIC_LIB_IMPORT
#endif #endif
/*! /*!

View File

@ -10,8 +10,8 @@
#define CPP_UTILITIES_EXPORT #define CPP_UTILITIES_EXPORT
#define CPP_UTILITIES_IMPORT #define CPP_UTILITIES_IMPORT
#else #else
#define CPP_UTILITIES_EXPORT LIB_EXPORT #define CPP_UTILITIES_EXPORT CPP_UTILITIES_GENERIC_LIB_EXPORT
#define CPP_UTILITIES_IMPORT LIB_IMPORT #define CPP_UTILITIES_IMPORT CPP_UTILITIES_GENERIC_LIB_IMPORT
#endif #endif
/*! /*!