From 36eb9a0d91ea5aa19b41e0b35f959f102b1a4243 Mon Sep 17 00:00:00 2001 From: Ming Li Date: Tue, 8 Sep 2020 15:01:04 +0200 Subject: [PATCH] rename function names related to versions. The current function name is quite generic and it's easy to conflict with other functions in a project since they're C functions --- easy_profiler_core/include/easy/profiler.h | 20 ++++++++++---------- easy_profiler_core/profiler.cpp | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/easy_profiler_core/include/easy/profiler.h b/easy_profiler_core/include/easy/profiler.h index 7a735ba..d8bd570 100644 --- a/easy_profiler_core/include/easy/profiler.h +++ b/easy_profiler_core/include/easy/profiler.h @@ -670,19 +670,19 @@ namespace profiler { \ingroup profiler */ - PROFILER_API uint8_t versionMajor(); + PROFILER_API uint8_t apiVersionMajor(); /** Returns current minor version. \ingroup profiler */ - PROFILER_API uint8_t versionMinor(); + PROFILER_API uint8_t apiVersionMinor(); /** Returns current version patch. \ingroup profiler */ - PROFILER_API uint16_t versionPatch(); + PROFILER_API uint16_t apiVersionPatch(); /** Returns current version in 32-bit integer format. @@ -691,7 +691,7 @@ namespace profiler { \ingroup profiler */ - PROFILER_API uint32_t version(); + PROFILER_API uint32_t apiVersion(); /** Returns current version string. @@ -699,7 +699,7 @@ namespace profiler { \ingroup profiler */ - PROFILER_API const char* versionName(); + PROFILER_API const char* apiVersionName(); /** Returns true if current thread has been marked as Main. Otherwise, returns false. @@ -790,11 +790,11 @@ namespace profiler { inline void startListen(uint16_t = ::profiler::DEFAULT_PORT) { } inline void stopListen() { } inline EASY_CONSTEXPR_FCN bool isListening() { return false; } - inline EASY_CONSTEXPR_FCN uint8_t versionMajor() { return 0; } - inline EASY_CONSTEXPR_FCN uint8_t versionMinor() { return 0; } - inline EASY_CONSTEXPR_FCN uint16_t versionPatch() { return 0; } - inline EASY_CONSTEXPR_FCN uint32_t version() { return 0; } - inline EASY_CONSTEXPR_FCN const char* versionName() { return "v0.0.0_disabled"; } + inline EASY_CONSTEXPR_FCN uint8_t apiVersionMajor() { return 0; } + inline EASY_CONSTEXPR_FCN uint8_t apiVersionMinor() { return 0; } + inline EASY_CONSTEXPR_FCN uint16_t apiVersionPatch() { return 0; } + inline EASY_CONSTEXPR_FCN uint32_t apiVersion() { return 0; } + inline EASY_CONSTEXPR_FCN const char* apiVersionName() { return "v0.0.0_disabled"; } inline EASY_CONSTEXPR_FCN bool isMainThread() { return false; } inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; } inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; } diff --git a/easy_profiler_core/profiler.cpp b/easy_profiler_core/profiler.cpp index cb13be2..4dd8b86 100644 --- a/easy_profiler_core/profiler.cpp +++ b/easy_profiler_core/profiler.cpp @@ -85,7 +85,7 @@ extern const uint32_t EASY_PROFILER_VERSION = (static_cast(EASY_PROFIL extern "C" { -PROFILER_API uint8_t versionMajor() +PROFILER_API uint8_t apiVersionMajor() { static_assert(0 <= EASY_PROFILER_VERSION_MAJOR && EASY_PROFILER_VERSION_MAJOR <= 255, "EASY_PROFILER_VERSION_MAJOR must be defined in range [0, 255]"); @@ -93,7 +93,7 @@ PROFILER_API uint8_t versionMajor() return EASY_PROFILER_VERSION_MAJOR; } -PROFILER_API uint8_t versionMinor() +PROFILER_API uint8_t apiVersionMinor() { static_assert(0 <= EASY_PROFILER_VERSION_MINOR && EASY_PROFILER_VERSION_MINOR <= 255, "EASY_PROFILER_VERSION_MINOR must be defined in range [0, 255]"); @@ -101,7 +101,7 @@ PROFILER_API uint8_t versionMinor() return EASY_PROFILER_VERSION_MINOR; } -PROFILER_API uint16_t versionPatch() +PROFILER_API uint16_t apiVersionPatch() { static_assert(0 <= EASY_PROFILER_VERSION_PATCH && EASY_PROFILER_VERSION_PATCH <= 65535, "EASY_PROFILER_VERSION_PATCH must be defined in range [0, 65535]"); @@ -109,12 +109,12 @@ PROFILER_API uint16_t versionPatch() return EASY_PROFILER_VERSION_PATCH; } -PROFILER_API uint32_t version() +PROFILER_API uint32_t apiVersion() { return EASY_PROFILER_VERSION; } -PROFILER_API const char* versionName() +PROFILER_API const char* apiVersionName() { #ifdef EASY_PROFILER_API_DISABLED return EASY_PROFILER_PRODUCT_VERSION "_disabled";