Skip to content

Instantly share code, notes, and snippets.

@dpogue
Last active February 19, 2023 06:46
Show Gist options
  • Save dpogue/a2e000b2e67665f835c9cdbd454370c8 to your computer and use it in GitHub Desktop.
Save dpogue/a2e000b2e67665f835c9cdbd454370c8 to your computer and use it in GitHub Desktop.
#include <CoreFoundation/CoreFoundation.h>
[[nodiscard]]
CFStringRef CFStringCreateWithSTString(CFAllocatorRef alloc, const ST::string& stString)
{
return CFStringCreateWithCString(alloc, stString.c_str(), kCFStringEncodingUTF8);
}
[[nodiscard]]
const ST::string CFStringGetSTString(CFStringRef theString)
{
return ST::string(CFStringGetCStringPtr(theString, kCFStringEncodingUTF8));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment