From 40bbf3c14a782673bbd36c8a98adb0934b06add5 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Mon, 3 Nov 2025 20:48:22 +0800 Subject: Osx remove Resource.h. --- include/cru/base/platform/osx/Base.h | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 include/cru/base/platform/osx/Base.h (limited to 'include/cru/base/platform/osx/Base.h') diff --git a/include/cru/base/platform/osx/Base.h b/include/cru/base/platform/osx/Base.h new file mode 100644 index 00000000..290d9b3d --- /dev/null +++ b/include/cru/base/platform/osx/Base.h @@ -0,0 +1,38 @@ +#pragma once + +// TODO: Move This file to platform dir. + +#ifndef __APPLE__ +#error "This header can only be included on OSX platforms." +#endif + +#include "../../Range.h" + +#include +#include +#include + +namespace cru { +template +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; + } +}; + +CFWrapper ToCFString(std::string_view string); +std::string FromCFStringRef(CFStringRef string); + +CFRange ToCFRange(const Range& range); +Range FromCFRange(const CFRange& range); +} // namespace cru -- cgit v1.2.3