diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-08-18 17:22:22 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-08-18 17:22:22 +0800 |
commit | d54052bccefe3bc4332a1636d348a10b197ad869 (patch) | |
tree | adb41c6b79f6dc6fd12b68341e2a2f3a6d8e6816 /src | |
parent | 63807c3064002ec75b48c444a767e396c273f403 (diff) | |
download | cru-d54052bccefe3bc4332a1636d348a10b197ad869.tar.gz cru-d54052bccefe3bc4332a1636d348a10b197ad869.tar.bz2 cru-d54052bccefe3bc4332a1636d348a10b197ad869.zip |
Rename ToCFStringRef to ToCFString.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/Osx.cpp | 2 | ||||
-rw-r--r-- | src/platform/graphics/quartz/Font.cpp | 2 | ||||
-rw-r--r-- | src/platform/graphics/quartz/ImageFactory.cpp | 2 | ||||
-rw-r--r-- | src/platform/graphics/quartz/TextLayout.cpp | 2 | ||||
-rw-r--r-- | src/platform/gui/osx/Clipboard.mm | 2 | ||||
-rw-r--r-- | src/platform/gui/osx/Menu.mm | 2 | ||||
-rw-r--r-- | src/platform/gui/osx/UiApplication.mm | 16 | ||||
-rw-r--r-- | src/platform/gui/osx/Window.mm | 6 |
8 files changed, 17 insertions, 17 deletions
diff --git a/src/base/Osx.cpp b/src/base/Osx.cpp index 8dc70598..46b923fe 100644 --- a/src/base/Osx.cpp +++ b/src/base/Osx.cpp @@ -1,7 +1,7 @@ #include "cru/base/Osx.h" namespace cru { -CFWrapper<CFStringRef> ToCFStringRef(StringView string) { +CFWrapper<CFStringRef> ToCFString(StringView string) { return CFWrapper<CFStringRef>(CFStringCreateWithBytes( nullptr, reinterpret_cast<const UInt8*>(string.data()), string.size() * sizeof(std::uint16_t), kCFStringEncodingUTF16, false)); diff --git a/src/platform/graphics/quartz/Font.cpp b/src/platform/graphics/quartz/Font.cpp index 4d03c56e..0c03e5e0 100644 --- a/src/platform/graphics/quartz/Font.cpp +++ b/src/platform/graphics/quartz/Font.cpp @@ -7,7 +7,7 @@ namespace cru::platform::graphics::quartz { OsxCTFont::OsxCTFont(IGraphicsFactory* graphics_factory, const String& name, float size) : OsxQuartzResource(graphics_factory), name_(name) { - auto n = ToCFStringRef(name); + auto n = ToCFString(name); if (name.empty()) { ct_font_ = diff --git a/src/platform/graphics/quartz/ImageFactory.cpp b/src/platform/graphics/quartz/ImageFactory.cpp index 1fb04132..93e452e1 100644 --- a/src/platform/graphics/quartz/ImageFactory.cpp +++ b/src/platform/graphics/quartz/ImageFactory.cpp @@ -52,7 +52,7 @@ void QuartzImageFactory::EncodeToStream(IImage* image, io::Stream* stream, auto quartz_image = CheckPlatform<QuartzImage>(image, GetPlatformId()); auto cg_image = quartz_image->GetCGImage(); - auto uti = ToCFStringRef(GetImageFormatUniformTypeIdentifier(format)); + auto uti = ToCFString(GetImageFormatUniformTypeIdentifier(format)); CGDataConsumerRef data_consumer = ConvertStreamToCGDataConsumer(stream); CGImageDestinationRef destination = CGImageDestinationCreateWithDataConsumer( data_consumer, uti.ref, 1, nullptr); diff --git a/src/platform/graphics/quartz/TextLayout.cpp b/src/platform/graphics/quartz/TextLayout.cpp index 1be52c48..8c573c7a 100644 --- a/src/platform/graphics/quartz/TextLayout.cpp +++ b/src/platform/graphics/quartz/TextLayout.cpp @@ -72,7 +72,7 @@ void OsxCTTextLayout::DoSetText(String text) { } } - auto s = ToCFStringRef(actual_text_); + auto s = ToCFString(actual_text_); cf_attributed_text_ = CFAttributedStringCreateMutable(nullptr, 0); CFAttributedStringReplaceString(cf_attributed_text_, CFRangeMake(0, 0), s.ref); Ensures(cf_attributed_text_); diff --git a/src/platform/gui/osx/Clipboard.mm b/src/platform/gui/osx/Clipboard.mm index b3469795..f15232e2 100644 --- a/src/platform/gui/osx/Clipboard.mm +++ b/src/platform/gui/osx/Clipboard.mm @@ -37,7 +37,7 @@ String OsxClipboardPrivate::GetText() { } void OsxClipboardPrivate::SetText(String text) { - auto cf_string = ToCFStringRef(text); + auto cf_string = ToCFString(text); [pasteboard_ clearContents]; [pasteboard_ writeObjects:@[ (NSString*)cf_string.ref ]]; } diff --git a/src/platform/gui/osx/Menu.mm b/src/platform/gui/osx/Menu.mm index 648bc392..45beddee 100644 --- a/src/platform/gui/osx/Menu.mm +++ b/src/platform/gui/osx/Menu.mm @@ -63,7 +63,7 @@ OsxMenuItem::~OsxMenuItem() { delete p_; } String OsxMenuItem::GetTitle() { return FromCFStringRef((CFStringRef)[p_->menu_item_ title]); } void OsxMenuItem::SetTitle(String title) { - auto cf_title = ToCFStringRef(title); + auto cf_title = ToCFString(title); [p_->menu_item_ setTitle:(NSString*)(cf_title.ref)]; } diff --git a/src/platform/gui/osx/UiApplication.mm b/src/platform/gui/osx/UiApplication.mm index 2733e8af..7e744928 100644 --- a/src/platform/gui/osx/UiApplication.mm +++ b/src/platform/gui/osx/UiApplication.mm @@ -179,15 +179,15 @@ graphics::IGraphicsFactory* OsxUiApplication::GetGraphicsFactory() { std::optional<String> OsxUiApplication::ShowSaveDialog(SaveDialogOptions options) { NSSavePanel* panel = [NSSavePanel savePanel]; - [panel setTitle:(NSString*)ToCFStringRef(options.title).ref]; - [panel setPrompt:(NSString*)ToCFStringRef(options.prompt).ref]; - [panel setMessage:(NSString*)ToCFStringRef(options.message).ref]; + [panel setTitle:(NSString*)ToCFString(options.title).ref]; + [panel setPrompt:(NSString*)ToCFString(options.prompt).ref]; + [panel setMessage:(NSString*)ToCFString(options.message).ref]; NSMutableArray* allowed_content_types = [NSMutableArray array]; for (const auto& file_type : options.allowed_file_types) { [allowed_content_types - addObject:[UTType typeWithFilenameExtension:(NSString*)ToCFStringRef(file_type).ref]]; + addObject:[UTType typeWithFilenameExtension:(NSString*)ToCFString(file_type).ref]]; } [panel setAllowedContentTypes:allowed_content_types]; @@ -203,15 +203,15 @@ std::optional<String> OsxUiApplication::ShowSaveDialog(SaveDialogOptions options std::optional<std::vector<String>> OsxUiApplication::ShowOpenDialog(OpenDialogOptions options) { NSOpenPanel* panel = [NSOpenPanel openPanel]; - [panel setTitle:(NSString*)ToCFStringRef(options.title).ref]; - [panel setPrompt:(NSString*)ToCFStringRef(options.prompt).ref]; - [panel setMessage:(NSString*)ToCFStringRef(options.message).ref]; + [panel setTitle:(NSString*)ToCFString(options.title).ref]; + [panel setPrompt:(NSString*)ToCFString(options.prompt).ref]; + [panel setMessage:(NSString*)ToCFString(options.message).ref]; NSMutableArray* allowed_content_types = [NSMutableArray array]; for (const auto& file_type : options.allowed_file_types) { [allowed_content_types - addObject:[UTType typeWithFilenameExtension:(NSString*)ToCFStringRef(file_type).ref]]; + addObject:[UTType typeWithFilenameExtension:(NSString*)ToCFString(file_type).ref]]; } [panel setAllowedContentTypes:allowed_content_types]; diff --git a/src/platform/gui/osx/Window.mm b/src/platform/gui/osx/Window.mm index 4279e73e..f3a95fad 100644 --- a/src/platform/gui/osx/Window.mm +++ b/src/platform/gui/osx/Window.mm @@ -29,7 +29,7 @@ constexpr int key_down_debug = 0; } using ::cru::FromCFStringRef; -using ::cru::ToCFStringRef; +using ::cru::ToCFString; using cru::platform::graphics::quartz::Convert; namespace cru::platform::gui::osx { namespace { @@ -188,7 +188,7 @@ void OsxWindowPrivate::CreateWindow() { frame:Rect(Point{}, content_rect_.GetSize())]; [window_ setContentView:content_view]; - [window_ setTitle:(NSString*)ToCFStringRef(title_).ref]; + [window_ setTitle:(NSString*)ToCFString(title_).ref]; draw_layer_ = CreateLayer(Convert(content_rect_.GetSize())); @@ -256,7 +256,7 @@ void OsxWindow::SetTitle(String title) { p_->title_ = title; if (p_->window_) { - [p_->window_ setTitle:(NSString*)ToCFStringRef(title).ref]; + [p_->window_ setTitle:(NSString*)ToCFString(title).ref]; } } |