diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-12-05 20:33:50 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-12-05 20:33:50 +0800 |
| commit | 5edaa008efabb1b97446bed2f6b542cf01eb3c70 (patch) | |
| tree | 96472d1b554634b0bafdd4d8d7ce22321a0e179d /include | |
| parent | 8dcca49f42627400773dcc707ebaa757cbeef37b (diff) | |
| download | cru-5edaa008efabb1b97446bed2f6b542cf01eb3c70.tar.gz cru-5edaa008efabb1b97446bed2f6b542cf01eb3c70.tar.bz2 cru-5edaa008efabb1b97446bed2f6b542cf01eb3c70.zip | |
Remove CRU_DEFINE_CLASS_LOG_TAG.
Diffstat (limited to 'include')
32 files changed, 78 insertions, 38 deletions
diff --git a/include/cru/base/Base.h b/include/cru/base/Base.h index 3cd04f8c..e62054eb 100644 --- a/include/cru/base/Base.h +++ b/include/cru/base/Base.h @@ -106,10 +106,6 @@ inline void hash_combine(std::size_t& s, const T& v) { s ^= h(v) + 0x9e3779b9 + (s << 6) + (s >> 2); } -#define CRU_DEFINE_CLASS_LOG_TAG(tag) \ - private: \ - constexpr static const char* kLogTag = tag; - #ifdef _MSC_VER #pragma warning(disable : 4275) #endif diff --git a/include/cru/base/SubProcess.h b/include/cru/base/SubProcess.h index 609c4c4a..eb087c27 100644 --- a/include/cru/base/SubProcess.h +++ b/include/cru/base/SubProcess.h @@ -132,7 +132,8 @@ struct IPlatformSubProcessImpl : virtual Interface { * leak. */ class PlatformSubProcess : public Object { - CRU_DEFINE_CLASS_LOG_TAG("PlatformSubProcess") + private: + constexpr static auto kLogTag = "PlatformSubProcess"; private: struct State { @@ -210,7 +211,8 @@ class PlatformSubProcess : public Object { }; class CRU_BASE_API SubProcess { - CRU_DEFINE_CLASS_LOG_TAG("SubProcess") + private: + constexpr static auto kLogTag = "SubProcess"; public: static SubProcess Create( diff --git a/include/cru/base/platform/unix/EventLoop.h b/include/cru/base/platform/unix/EventLoop.h index 84d413fb..69a1c707 100644 --- a/include/cru/base/platform/unix/EventLoop.h +++ b/include/cru/base/platform/unix/EventLoop.h @@ -46,7 +46,9 @@ class UnixTimerFile : public Object { }; class UnixEventLoop : public Object { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::unix::UnixEventLoop") + private: + constexpr static auto kLogTag = "cru::platform::unix::UnixEventLoop"; + public: using PollEvents = decltype(std::declval<pollfd>().events); using PollRevents = decltype(std::declval<pollfd>().revents); diff --git a/include/cru/base/platform/unix/PosixSpawnSubProcess.h b/include/cru/base/platform/unix/PosixSpawnSubProcess.h index 11aa7372..f8159b10 100644 --- a/include/cru/base/platform/unix/PosixSpawnSubProcess.h +++ b/include/cru/base/platform/unix/PosixSpawnSubProcess.h @@ -16,7 +16,8 @@ namespace cru::platform::unix { class PosixSpawnSubProcessImpl : public Object, public virtual IPlatformSubProcessImpl { - CRU_DEFINE_CLASS_LOG_TAG("PosixSpawnSubProcess") + private: + constexpr static auto kLogTag = "PosixSpawnSubProcess"; public: explicit PosixSpawnSubProcessImpl(); diff --git a/include/cru/base/platform/win/Win32SubProcess.h b/include/cru/base/platform/win/Win32SubProcess.h index e7189b02..7205ef9e 100644 --- a/include/cru/base/platform/win/Win32SubProcess.h +++ b/include/cru/base/platform/win/Win32SubProcess.h @@ -13,7 +13,8 @@ namespace cru::platform::win { class CRU_BASE_API Win32SubProcessImpl : public Object, public virtual IPlatformSubProcessImpl { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::win::Win32SubProcessImpl") + private: + constexpr static auto kLogTag = "cru::platform::win::Win32SubProcessImpl"; public: explicit Win32SubProcessImpl(); diff --git a/include/cru/platform/graphics/cairo/CairoPainter.h b/include/cru/platform/graphics/cairo/CairoPainter.h index 039cef60..4688a7ff 100644 --- a/include/cru/platform/graphics/cairo/CairoPainter.h +++ b/include/cru/platform/graphics/cairo/CairoPainter.h @@ -10,7 +10,10 @@ namespace cru::platform::graphics::cairo { class CRU_PLATFORM_GRAPHICS_CAIRO_API CairoPainter : public CairoResource, public virtual IPainter { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::graphics::cairo::CairoPainter") + private: + constexpr static auto kLogTag = + "cru::platform::graphics::cairo::CairoPainter"; + public: CairoPainter(CairoGraphicsFactory* factory, cairo_t* cairo, bool auto_release, cairo_surface_t* cairo_surface = nullptr); diff --git a/include/cru/platform/graphics/direct2d/Painter.h b/include/cru/platform/graphics/direct2d/Painter.h index b0998c6b..92edf657 100644 --- a/include/cru/platform/graphics/direct2d/Painter.h +++ b/include/cru/platform/graphics/direct2d/Painter.h @@ -10,7 +10,9 @@ class CRU_WIN_GRAPHICS_DIRECT_API D2DDeviceContextPainter : public DirectGraphicsResource, public virtual IPainter, public virtual IComResource<ID2D1DeviceContext1> { - CRU_DEFINE_CLASS_LOG_TAG("D2DDeviceContextPainter") + private: + constexpr static auto kLogTag = "D2DDeviceContextPainter"; + public: explicit D2DDeviceContextPainter(DirectGraphicsFactory* graphics_factory, ID2D1DeviceContext1* device_context, diff --git a/include/cru/platform/graphics/quartz/Painter.h b/include/cru/platform/graphics/quartz/Painter.h index 7e86222d..591e0c4b 100644 --- a/include/cru/platform/graphics/quartz/Painter.h +++ b/include/cru/platform/graphics/quartz/Painter.h @@ -9,7 +9,8 @@ namespace cru::platform::graphics::quartz { class QuartzCGContextPainter : public OsxQuartzResource, public virtual IPainter { - CRU_DEFINE_CLASS_LOG_TAG("QuartzCGContextPainter") + private: + constexpr static auto kLogTag = "QuartzCGContextPainter"; public: explicit QuartzCGContextPainter( diff --git a/include/cru/platform/gui/DeleteLater.h b/include/cru/platform/gui/DeleteLater.h index c0578974..d7aa262b 100644 --- a/include/cru/platform/gui/DeleteLater.h +++ b/include/cru/platform/gui/DeleteLater.h @@ -8,7 +8,8 @@ namespace cru::platform::gui { template <typename TSelf> class DeleteLaterImpl { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::gui::DeleteLaterImpl") + private: + constexpr static auto kLogTag = "cru::platform::gui::DeleteLaterImpl"; public: virtual ~DeleteLaterImpl() {} diff --git a/include/cru/platform/gui/sdl/OpenGLRenderer.h b/include/cru/platform/gui/sdl/OpenGLRenderer.h index 18de3d55..8f92f9b4 100644 --- a/include/cru/platform/gui/sdl/OpenGLRenderer.h +++ b/include/cru/platform/gui/sdl/OpenGLRenderer.h @@ -15,7 +15,9 @@ namespace cru::platform::gui::sdl { class SdlWindow; class SdlOpenGLRenderer { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::gui::sdl::SdlOpenGLRenderer") + private: + constexpr static auto kLogTag = "cru::platform::gui::sdl::SdlOpenGLRenderer"; + public: SdlOpenGLRenderer(SdlWindow* window, int width, int height); ~SdlOpenGLRenderer(); diff --git a/include/cru/platform/gui/sdl/Window.h b/include/cru/platform/gui/sdl/Window.h index 41e5befb..48d7c70a 100644 --- a/include/cru/platform/gui/sdl/Window.h +++ b/include/cru/platform/gui/sdl/Window.h @@ -17,7 +17,8 @@ class SdlUiApplication; class SdlInputMethodContext; class SdlWindow : public SdlResource, public virtual INativeWindow { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::gui::xcb::SdlWindow") + private: + constexpr static auto kLogTag = "cru::platform::gui::xcb::SdlWindow"; friend SdlUiApplication; diff --git a/include/cru/platform/gui/win/Clipboard.h b/include/cru/platform/gui/win/Clipboard.h index d9ef0532..3468c456 100644 --- a/include/cru/platform/gui/win/Clipboard.h +++ b/include/cru/platform/gui/win/Clipboard.h @@ -5,7 +5,9 @@ namespace cru::platform::gui::win { class WinClipboard : public WinNativeResource, public virtual IClipboard { - CRU_DEFINE_CLASS_LOG_TAG("WinClipboard") + private: + constexpr static auto kLogTag = "WinClipboard"; + public: explicit WinClipboard(WinUiApplication* application); diff --git a/include/cru/platform/gui/win/Cursor.h b/include/cru/platform/gui/win/Cursor.h index 48817061..97970dfc 100644 --- a/include/cru/platform/gui/win/Cursor.h +++ b/include/cru/platform/gui/win/Cursor.h @@ -8,7 +8,8 @@ namespace cru::platform::gui::win { class CRU_WIN_GUI_API WinCursor : public WinNativeResource, public virtual ICursor { - CRU_DEFINE_CLASS_LOG_TAG("WinCursor") + private: + constexpr static auto kLogTag = "WinCursor"; public: WinCursor(HCURSOR handle, bool auto_destroy); diff --git a/include/cru/platform/gui/win/InputMethod.h b/include/cru/platform/gui/win/InputMethod.h index bf59387b..e71aedf0 100644 --- a/include/cru/platform/gui/win/InputMethod.h +++ b/include/cru/platform/gui/win/InputMethod.h @@ -12,7 +12,8 @@ namespace cru::platform::gui::win { class CRU_WIN_GUI_API AutoHIMC { - CRU_DEFINE_CLASS_LOG_TAG("AutoHIMC") + private: + constexpr static auto kLogTag = "AutoHIMC"; public: explicit AutoHIMC(HWND hwnd); @@ -36,7 +37,8 @@ class CRU_WIN_GUI_API AutoHIMC { class CRU_WIN_GUI_API WinInputMethodContext : public WinNativeResource, public virtual IInputMethodContext { - CRU_DEFINE_CLASS_LOG_TAG("WinInputMethodContext") + private: + constexpr static auto kLogTag = "WinInputMethodContext"; public: WinInputMethodContext(WinNativeWindow* window); diff --git a/include/cru/platform/gui/win/Window.h b/include/cru/platform/gui/win/Window.h index e690ad4e..648f6a5e 100644 --- a/include/cru/platform/gui/win/Window.h +++ b/include/cru/platform/gui/win/Window.h @@ -11,7 +11,8 @@ namespace cru::platform::gui::win { class CRU_WIN_GUI_API WinNativeWindow : public WinNativeResource, public virtual INativeWindow { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::gui::win::WinNativeWindow") + private: + constexpr static auto kLogTag = "cru::platform::gui::win::WinNativeWindow"; public: explicit WinNativeWindow(WinUiApplication* application); diff --git a/include/cru/platform/gui/xcb/InputMethod.h b/include/cru/platform/gui/xcb/InputMethod.h index 710ea2e5..1c8fe483 100644 --- a/include/cru/platform/gui/xcb/InputMethod.h +++ b/include/cru/platform/gui/xcb/InputMethod.h @@ -15,7 +15,9 @@ class XcbWindow; class XcbXimInputMethodContext; class XcbXimInputMethodManager : public XcbResource { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::gui::xcb::XcbXimInputMethodManager") + private: + constexpr static auto kLogTag = + "cru::platform::gui::xcb::XcbXimInputMethodManager"; friend XcbUiApplication; friend XcbXimInputMethodContext; @@ -42,7 +44,9 @@ class XcbXimInputMethodManager : public XcbResource { class XcbXimInputMethodContext : public XcbResource, public virtual IInputMethodContext { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::gui::xcb::XcbXimInputMethodContext") + private: + constexpr static auto kLogTag = + "cru::platform::gui::xcb::XcbXimInputMethodContext"; friend XcbXimInputMethodManager; diff --git a/include/cru/platform/gui/xcb/Window.h b/include/cru/platform/gui/xcb/Window.h index 6820e7a9..a58d85f8 100644 --- a/include/cru/platform/gui/xcb/Window.h +++ b/include/cru/platform/gui/xcb/Window.h @@ -15,7 +15,8 @@ class XcbCursor; class XcbXimInputMethodContext; class XcbWindow : public XcbResource, public virtual INativeWindow { - CRU_DEFINE_CLASS_LOG_TAG("cru::platform::gui::xcb::XcbWindow") + private: + constexpr static auto kLogTag = "cru::platform::gui::xcb::XcbWindow"; friend XcbUiApplication; diff --git a/include/cru/ui/ThemeResourceDictionary.h b/include/cru/ui/ThemeResourceDictionary.h index 3995fe25..122111b0 100644 --- a/include/cru/ui/ThemeResourceDictionary.h +++ b/include/cru/ui/ThemeResourceDictionary.h @@ -24,7 +24,8 @@ class CRU_UI_API BadThemeResourceException : public Exception { }; class CRU_UI_API ThemeResourceDictionary : public Object { - CRU_DEFINE_CLASS_LOG_TAG("ThemeResources"); + private: + constexpr static auto kLogTag = "ThemeResources"; public: static std::unique_ptr<ThemeResourceDictionary> FromFile( diff --git a/include/cru/ui/controls/Control.h b/include/cru/ui/controls/Control.h index c82956b5..8cd7a375 100644 --- a/include/cru/ui/controls/Control.h +++ b/include/cru/ui/controls/Control.h @@ -23,7 +23,8 @@ class CRU_UI_API Control : public Object, public SelfResolvable<Control> { friend class ControlHost; - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::controls::Control") + private: + constexpr static auto kLogTag = "cru::ui::controls::Control"; protected: explicit Control(std::string name); diff --git a/include/cru/ui/controls/ControlHost.h b/include/cru/ui/controls/ControlHost.h index fffbbb34..5e8d678b 100644 --- a/include/cru/ui/controls/ControlHost.h +++ b/include/cru/ui/controls/ControlHost.h @@ -10,7 +10,8 @@ namespace cru::ui::controls { class CRU_UI_API ControlHost : public Object { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::controls::ControlHost") + private: + constexpr static auto kLogTag = "cru::ui::controls::ControlHost"; friend Control; public: diff --git a/include/cru/ui/controls/TextHostControlService.h b/include/cru/ui/controls/TextHostControlService.h index 1430a215..14910b57 100644 --- a/include/cru/ui/controls/TextHostControlService.h +++ b/include/cru/ui/controls/TextHostControlService.h @@ -70,7 +70,8 @@ class TextControlMovePattern { }; class CRU_UI_API TextHostControlService : public Object { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::controls::TextControlService") + private: + constexpr static auto kLogTag = "cru::ui::controls::TextControlService"; public: TextHostControlService(Control* control); diff --git a/include/cru/ui/controls/Window.h b/include/cru/ui/controls/Window.h index 2c650c41..131d68a8 100644 --- a/include/cru/ui/controls/Window.h +++ b/include/cru/ui/controls/Window.h @@ -15,7 +15,8 @@ namespace cru::ui::controls { class CRU_UI_API Window : public LayoutControl<render::StackLayoutRenderObject> { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::controls::Window") + private: + constexpr static auto kLogTag = "cru::ui::controls::Window"; friend Control; public: diff --git a/include/cru/ui/helper/ClickDetector.h b/include/cru/ui/helper/ClickDetector.h index 2eb453d9..08728e18 100644 --- a/include/cru/ui/helper/ClickDetector.h +++ b/include/cru/ui/helper/ClickDetector.h @@ -36,7 +36,8 @@ enum class ClickState { }; class ClickDetector : public Object { - CRU_DEFINE_CLASS_LOG_TAG("ClickDetector") + private: + constexpr static auto kLogTag = "ClickDetector"; public: explicit ClickDetector(controls::Control* control); diff --git a/include/cru/ui/helper/ShortcutHub.h b/include/cru/ui/helper/ShortcutHub.h index 1b600c48..4d46f654 100644 --- a/include/cru/ui/helper/ShortcutHub.h +++ b/include/cru/ui/helper/ShortcutHub.h @@ -94,7 +94,9 @@ struct ShortcutInfo { }; class CRU_UI_API ShortcutHub : public Object { - CRU_DEFINE_CLASS_LOG_TAG("ShortcutHub") + private: + constexpr static auto kLogTag = "ShortcutHub"; + public: ShortcutHub() = default; ~ShortcutHub() override = default; diff --git a/include/cru/ui/mapper/style/StyleRuleMapper.h b/include/cru/ui/mapper/style/StyleRuleMapper.h index 5622d0f4..37790058 100644 --- a/include/cru/ui/mapper/style/StyleRuleMapper.h +++ b/include/cru/ui/mapper/style/StyleRuleMapper.h @@ -7,7 +7,9 @@ namespace cru::ui::mapper::style { class CRU_UI_API StyleRuleMapper : public BasicClonePtrMapper<ui::style::StyleRule> { - CRU_DEFINE_CLASS_LOG_TAG("StyleRuleMapper") + private: + constexpr static auto kLogTag = "StyleRuleMapper"; + public: CRU_DEFAULT_CONSTRUCTOR_DESTRUCTOR(StyleRuleMapper) diff --git a/include/cru/ui/render/BorderRenderObject.h b/include/cru/ui/render/BorderRenderObject.h index 8b8f3816..73fc85c1 100644 --- a/include/cru/ui/render/BorderRenderObject.h +++ b/include/cru/ui/render/BorderRenderObject.h @@ -6,7 +6,8 @@ namespace cru::ui::render { class CRU_UI_API BorderRenderObject : public SingleChildRenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::BorderRenderObject") + private: + constexpr static auto kLogTag = "cru::ui::render::BorderRenderObject"; public: static constexpr auto kRenderObjectName = "BorderRenderObject"; diff --git a/include/cru/ui/render/FlexLayoutRenderObject.h b/include/cru/ui/render/FlexLayoutRenderObject.h index 9fdecd28..b0d80961 100644 --- a/include/cru/ui/render/FlexLayoutRenderObject.h +++ b/include/cru/ui/render/FlexLayoutRenderObject.h @@ -93,7 +93,8 @@ struct FlexChildLayoutData { // class CRU_UI_API FlexLayoutRenderObject : public LayoutRenderObject<FlexChildLayoutData> { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::FlexLayoutRenderObject") + private: + constexpr static auto kLogTag = "cru::ui::render::FlexLayoutRenderObject"; public: static constexpr auto kRenderObjectName = "FlexLayoutRenderObject"; diff --git a/include/cru/ui/render/RenderObject.h b/include/cru/ui/render/RenderObject.h index bb772401..e696aefe 100644 --- a/include/cru/ui/render/RenderObject.h +++ b/include/cru/ui/render/RenderObject.h @@ -44,7 +44,8 @@ struct BoxConstraint { * void OnLayoutContent(const Rect& content_rect) override; */ class CRU_UI_API RenderObject : public Object { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::RenderObject") + private: + constexpr static auto kLogTag = "cru::ui::render::RenderObject"; public: RenderObject(std::string name); diff --git a/include/cru/ui/render/SingleChildRenderObject.h b/include/cru/ui/render/SingleChildRenderObject.h index 4c1891c5..7ecc4807 100644 --- a/include/cru/ui/render/SingleChildRenderObject.h +++ b/include/cru/ui/render/SingleChildRenderObject.h @@ -3,7 +3,8 @@ namespace cru::ui::render { class CRU_UI_API SingleChildRenderObject : public RenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::SingleChildRenderObject") + private: + constexpr static auto kLogTag = "cru::ui::render::SingleChildRenderObject"; public: SingleChildRenderObject(std::string name); diff --git a/include/cru/ui/render/StackLayoutRenderObject.h b/include/cru/ui/render/StackLayoutRenderObject.h index caddf5c5..a6ed47ba 100644 --- a/include/cru/ui/render/StackLayoutRenderObject.h +++ b/include/cru/ui/render/StackLayoutRenderObject.h @@ -28,7 +28,8 @@ struct StackChildLayoutData { // to min size. class CRU_UI_API StackLayoutRenderObject : public LayoutRenderObject<StackChildLayoutData> { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::StackLayoutRenderObject") + private: + constexpr static auto kLogTag = "cru::ui::render::StackLayoutRenderObject"; public: static constexpr auto kRenderObjectName = "StackLayoutRenderObject"; diff --git a/include/cru/ui/render/TextRenderObject.h b/include/cru/ui/render/TextRenderObject.h index e976f86d..0d17853b 100644 --- a/include/cru/ui/render/TextRenderObject.h +++ b/include/cru/ui/render/TextRenderObject.h @@ -19,7 +19,8 @@ namespace cru::ui::render { // If the result layout box is bigger than actual text box, then text is center // aligned. class CRU_UI_API TextRenderObject : public RenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::TextRenderObject") + private: + constexpr static auto kLogTag = "cru::ui::render::TextRenderObject"; public: static constexpr auto kRenderObjectName = "TextRenderObject"; diff --git a/include/cru/ui/render/TreeRenderObject.h b/include/cru/ui/render/TreeRenderObject.h index 090fe545..599e0f65 100644 --- a/include/cru/ui/render/TreeRenderObject.h +++ b/include/cru/ui/render/TreeRenderObject.h @@ -46,7 +46,8 @@ class CRU_UI_API TreeRenderObjectItem : public Object { }; class CRU_UI_API TreeRenderObject : public RenderObject { - CRU_DEFINE_CLASS_LOG_TAG("cru::ui::render::TreeRenderObject") + private: + constexpr static auto kLogTag = "cru::ui::render::TreeRenderObject"; public: static constexpr auto kRenderObjectName = "TreeRenderObject"; |
