From 99d16b51f142281f7d81cf3f704aff0e97bd1feb Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 16 Mar 2021 23:48:30 +1100 Subject: Convert Platform from a class to a namespace. Does not change callers. Make Assert, DebugPrintf, and similar noexcept so they can be used in noexcept methods and they don't throw. --- src/Platform.h | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/Platform.h b/src/Platform.h index 628611132..346e057b1 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -542,31 +542,26 @@ public: #endif /** - * Platform class used to retrieve system wide parameters such as double click speed - * and chrome colour. Not a creatable object, more of a module with several functions. + * Platform namespace used to retrieve system wide parameters such as double click speed + * and chrome colour. */ -class Platform { -public: - Platform() = default; - Platform(const Platform &) = delete; - Platform(Platform &&) = delete; - Platform &operator=(const Platform &) = delete; - Platform &operator=(Platform &&) = delete; - ~Platform() = default; - static ColourDesired Chrome(); - static ColourDesired ChromeHighlight(); - static const char *DefaultFont(); - static int DefaultFontSize(); - static unsigned int DoubleClickTime(); - static void DebugDisplay(const char *s); - static constexpr long LongFromTwoShorts(short a,short b) noexcept { - return (a) | ((b) << 16); - } - - static void DebugPrintf(const char *format, ...); - static bool ShowAssertionPopUps(bool assertionPopUps_); - static void Assert(const char *c, const char *file, int line) CLANG_ANALYZER_NORETURN; -}; +namespace Platform { + +ColourDesired Chrome(); +ColourDesired ChromeHighlight(); +const char *DefaultFont(); +int DefaultFontSize(); +unsigned int DoubleClickTime(); +constexpr long LongFromTwoShorts(short a,short b) noexcept { + return (a) | ((b) << 16); +} + +void DebugDisplay(const char *s) noexcept; +void DebugPrintf(const char *format, ...) noexcept; +bool ShowAssertionPopUps(bool assertionPopUps_) noexcept; +void Assert(const char *c, const char *file, int line) noexcept CLANG_ANALYZER_NORETURN; + +} #ifdef NDEBUG #define PLATFORM_ASSERT(c) ((void)0) -- cgit v1.2.3