aboutsummaryrefslogtreecommitdiff
path: root/include/cru/base
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-25 17:15:16 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-25 17:15:16 +0800
commit376d5bfe0f3b9658cbf2d4ca9b00c0600341ee85 (patch)
tree9a4326fbc15a164631c950d37551df372888f6b3 /include/cru/base
parenteb280d0ed73c7b3a410c94f4eb995b23cccb9e6a (diff)
downloadcru-376d5bfe0f3b9658cbf2d4ca9b00c0600341ee85.tar.gz
cru-376d5bfe0f3b9658cbf2d4ca9b00c0600341ee85.tar.bz2
cru-376d5bfe0f3b9658cbf2d4ca9b00c0600341ee85.zip
Clean code. Clean events of native window.
Diffstat (limited to 'include/cru/base')
-rw-r--r--include/cru/base/Base.h7
-rw-r--r--include/cru/base/Event.h7
2 files changed, 13 insertions, 1 deletions
diff --git a/include/cru/base/Base.h b/include/cru/base/Base.h
index fda45f66..3cd04f8c 100644
--- a/include/cru/base/Base.h
+++ b/include/cru/base/Base.h
@@ -137,12 +137,17 @@ class CRU_BASE_API Exception : public std::exception {
std::shared_ptr<std::exception> inner_;
};
+class CRU_BASE_API NotImplementedException : public Exception {
+ public:
+ using Exception::Exception; // inherit constructors
+};
+
class CRU_BASE_API PlatformException : public Exception {
public:
using Exception::Exception; // inherit constructors
};
-class ErrnoException : public Exception {
+class CRU_BASE_API ErrnoException : public Exception {
public:
ErrnoException();
explicit ErrnoException(int error_code);
diff --git a/include/cru/base/Event.h b/include/cru/base/Event.h
index bdaf3ea6..71c0ac6b 100644
--- a/include/cru/base/Event.h
+++ b/include/cru/base/Event.h
@@ -141,6 +141,13 @@ class Event : public EventBase, public IEvent<TEventArgs> {
public: \
::cru::IEvent<arg_type>* name##Event() { return &name##Event_; }
+#define CRU_DEFINE_EVENT_OVERRIDE(name, arg_type) \
+ private: \
+ ::cru::Event<arg_type> name##Event_; \
+ \
+ public: \
+ ::cru::IEvent<arg_type>* name##Event() override { return &name##Event_; }
+
namespace details {
struct EventHandlerRevokerCaller {
void operator()(const EventHandlerRevoker& revoker) { revoker(); }