Skip to content

Commit 555aa54

Browse files
committed
Implement PIMPL pattern for TrayManager in Linux and macOS
- Introduced a private implementation (PIMPL) class for TrayManager to enhance encapsulation. - Updated constructor to initialize the PIMPL instance, improving code organization and maintainability.
1 parent 8e8b3b0 commit 555aa54

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/platform/linux/tray_manager_linux.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919

2020
namespace nativeapi {
2121

22-
TrayManager::TrayManager() : next_tray_id_(1) {}
22+
class TrayManager::Impl {
23+
public:
24+
Impl() {}
25+
~Impl() {}
26+
};
27+
28+
TrayManager::TrayManager() : next_tray_id_(1), pimpl_(std::make_unique<Impl>()) {}
2329

2430
TrayManager::~TrayManager() {
2531
std::lock_guard<std::mutex> lock(mutex_);

src/platform/macos/tray_manager_macos.mm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111

1212
namespace nativeapi {
1313

14-
TrayManager::TrayManager() : next_tray_id_(1) {}
14+
class TrayManager::Impl {
15+
public:
16+
Impl() {}
17+
~Impl() {}
18+
};
19+
20+
TrayManager::TrayManager() : next_tray_id_(1), pimpl_(std::make_unique<Impl>()) {}
1521

1622
TrayManager::~TrayManager() {
1723
std::lock_guard<std::mutex> lock(mutex_);

0 commit comments

Comments
 (0)