aboutsummaryrefslogtreecommitdiff
path: root/include/cru/base/Osx.h
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-06-15 01:02:30 +0800
committerYuqian Yang <crupest@crupest.life>2025-06-15 01:02:30 +0800
commitd868d7b0d463ede80b761f87f10d4e25f52989c3 (patch)
treeeb61e339f15b6b8b4cc1a246b4281631e701d6e0 /include/cru/base/Osx.h
parent7ac84c9d200d43f50155ce1e8316ada12043f7a8 (diff)
downloadcru-d868d7b0d463ede80b761f87f10d4e25f52989c3.tar.gz
cru-d868d7b0d463ede80b761f87f10d4e25f52989c3.tar.bz2
cru-d868d7b0d463ede80b761f87f10d4e25f52989c3.zip
Remove some files of OSX. Symbol Point is conflict and needs to be
fixed.
Diffstat (limited to 'include/cru/base/Osx.h')
-rw-r--r--include/cru/base/Osx.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/cru/base/Osx.h b/include/cru/base/Osx.h
new file mode 100644
index 00000000..711da9a3
--- /dev/null
+++ b/include/cru/base/Osx.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#ifndef CRU_PLATFORM_OSX
+#error "This header can only be included on OSX."
+#endif
+
+#include <CoreFoundation/CoreFoundation.h>
+
+namespace cru {
+template <typename CFClassRef>
+class CFWrapper {
+ public:
+ CFClassRef ref;
+
+ explicit CFWrapper(CFClassRef ref) { this->ref = ref; }
+ ~CFWrapper() {
+ if (this->ref) CFRelease(this->ref);
+ }
+
+ CFClassRef* release() {
+ auto ref = this->ref;
+ this->ref = nullptr;
+ return ref;
+ }
+};
+} // namespace cru