本文整理匯總了C++中CFBundleGetBundleWithIdentifier函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFBundleGetBundleWithIdentifier函數的具體用法?C++ CFBundleGetBundleWithIdentifier怎麽用?C++ CFBundleGetBundleWithIdentifier使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFBundleGetBundleWithIdentifier函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: CFBundleGetBundleWithIdentifier
void HeadlessView::loadExtensions() {
if (extensionsLoaded) {
return;
}
#ifdef MBGL_USE_CGL
gl::InitializeExtensions([](const char * name) {
static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
if (!framework) {
throw std::runtime_error("Failed to load OpenGL framework.");
}
CFStringRef str = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingASCII);
void* symbol = CFBundleGetFunctionPointerForName(framework, str);
CFRelease(str);
return reinterpret_cast<gl::glProc>(symbol);
});
#endif
#ifdef MBGL_USE_GLX
gl::InitializeExtensions([](const char * name) {
return glXGetProcAddress(reinterpret_cast<const GLubyte *>(name));
});
#endif
extensionsLoaded = true;
}
示例2: GetHIToolboxVersion
long GetHIToolboxVersion(void)
{
CFBundleRef bundle;
CFStringRef versStr = nil;
static unsigned long version = 0;
if (version != 0)
return version;
bundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.HIToolbox"));
if (bundle)
versStr = (CFStringRef) CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("CFBundleShortVersionString"));
if (versStr && (CFGetTypeID(versStr) == CFStringGetTypeID()))
{
int major = 0, minor = 0, bugfix = 0;
char sz[20];
CFStringGetCString(versStr, sz, sizeof(sz), kCFStringEncodingUTF8);
sscanf(sz, "%d.%d.%d", &major, &minor, &bugfix);
version = (major << 8) + (minor << 4) + bugfix;
}
return version;
}
示例3: _intlize
static_inline const char *
_intlize(const char *msg, int base, char *str, size_t len)
{
char domain[12 +20];
CFStringRef cfstring = CFStringCreateWithCString(kCFAllocatorSystemDefault,
msg,
kCFStringEncodingUTF8);
CFStringRef cfdomain;
CFBundleRef OpenAFSBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.openafs.filesystems.afs"));
if (!str) {
CFRelease(cfstring);
return msg;
}
snprintf(domain, sizeof(domain), "heim_com_err%d", base);
cfdomain = CFStringCreateWithCString(kCFAllocatorSystemDefault, domain,
kCFStringEncodingUTF8);
if (OpenAFSBundle != NULL) {
CFStringRef cflocal;
cflocal = CFBundleCopyLocalizedString(OpenAFSBundle, cfstring,
cfstring, cfdomain);
CFStringGetCString(cflocal, str, len, kCFStringEncodingUTF8);
CFRelease(cflocal);
} else {
CFStringGetCString(cfstring, str, len, kCFStringEncodingUTF8);
}
CFRelease(cfstring);
CFRelease(cfdomain);
return str;
}
示例4: switch
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ÇPROJECTNAMEÈ::GetProperty
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult ÇPROJECTNAMEÈ::GetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData )
{
if (inScope == kAudioUnitScope_Global) {
switch (inID) {
case kAudioUnitProperty_CocoaUI:
{
// Look for a resource in the main bundle by name and type.
CFBundleRef bundle = CFBundleGetBundleWithIdentifier( CFSTR("com.Demo.audiounit.ÇPROJECTNAMEÈ") );
if (bundle == NULL) return fnfErr;
CFURLRef bundleURL = CFBundleCopyResourceURL( bundle,
CFSTR("CocoaViewFactory"),
CFSTR("bundle"),
NULL);
if (bundleURL == NULL) return fnfErr;
CFStringRef className = CFSTR("CocoaViewFactory");
AudioUnitCocoaViewInfo cocoaInfo = { bundleURL, className };
*((AudioUnitCocoaViewInfo *)outData) = cocoaInfo;
return noErr;
}
}
}
return AUEffectBase::GetProperty (inID, inScope, inElement, outData);
}
示例5: AUBase
//_____________________________________________________________________________
//
AUPannerBase::AUPannerBase(AudioComponentInstance inAudioUnit)
: AUBase(inAudioUnit, 1, 1), mBypassEffect(false)
{
{
CABundleLocker lock;
if (!sLocalized)
{
CFBundleRef bundle = CFBundleGetBundleWithIdentifier( CFSTR("com.apple.audio.units.Components") );
if (bundle != NULL)
{
kPanner_Azimuth_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Azimuth_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_Elevation_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Elevation_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_Distance_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Distance_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_CoordScale_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_CoordScale_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_RefDistance_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_RefDistance_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
kPanner_Gain_Name = CFCopyLocalizedStringFromTableInBundle(kPanner_Gain_Name, CFSTR("AudioUnits"), bundle, CFSTR(""));
}
sLocalized = true;
}
}
CreateElements();
SetParameter(kPannerParam_Azimuth, kPannerParamDefault_Azimuth);
SetParameter(kPannerParam_Elevation, kPannerParamDefault_Elevation);
SetParameter(kPannerParam_Distance, kPannerParamDefault_Distance);
SetParameter(kPannerParam_CoordScale, kPannerParamDefault_CoordScale);
SetParameter(kPannerParam_RefDistance, kPannerParamDefault_RefDistance);
SetParameter(kPannerParam_Gain, kPannerParamDefault_Gain);
}
示例6: AUEffectBase
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// RadioEffectUnit::RadioEffectUnit
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RadioEffectUnit::RadioEffectUnit(AudioUnit Component)
: AUEffectBase(Component)
{
CreateElements();
if (!bGLocalized) {
// Because we are in a component, we need to load our bundle by identifier so we can access our localized strings
// It is important that the string passed here exactly matches that in the Info.plist Identifier string
CFBundleRef bundle = CFBundleGetBundleWithIdentifier( CFSTR("com.epicgames.audiounit.radio") );
if (bundle != NULL) {
kChebyshevPowerMultiplierName = CFCopyLocalizedStringFromTableInBundle(kChebyshevPowerMultiplierName, CFSTR("Localizable"), bundle, CFSTR(""));
kChebyshevPowerName = CFCopyLocalizedStringFromTableInBundle(kChebyshevPowerName, CFSTR("Localizable"), bundle, CFSTR(""));
kChebyshevMultiplierName = CFCopyLocalizedStringFromTableInBundle(kChebyshevMultiplierName, CFSTR("Localizable"), bundle, CFSTR(""));
kChebyshevCubedMultiplierName = CFCopyLocalizedStringFromTableInBundle(kChebyshevCubedMultiplierName, CFSTR("Localizable"), bundle, CFSTR(""));
}
bGLocalized = TRUE; //so never pass the test again...
}
GFinalBandPassFilter.Initialize( 2000.0f, 400.0f, GetSampleRate() );
SetParameter(RadioParam_ChebyshevPowerMultiplier, kDefaultValue_ChebyshevPowerMultiplier );
SetParameter(RadioParam_ChebyshevPower, kDefaultValue_ChebyshevPower );
SetParameter(RadioParam_ChebyshevMultiplier, kDefaultValue_ChebyshevMultiplier );
SetParameter(RadioParam_ChebyshevCubedMultiplier, kDefaultValue_ChebyshevCubedMultiplier );
}
示例7: getFrameworkFromBundle
static string getFrameworkFromBundle()
{
// Attempt to locate the Firebird.framework bundle
CFBundleRef fbFramework = CFBundleGetBundleWithIdentifier(CFSTR(DARWIN_FRAMEWORK_ID));
if (fbFramework)
{
CFURLRef msgFileUrl = CFBundleCopyResourceURL(fbFramework,
CFSTR(DARWIN_GEN_DIR), NULL, NULL);
if (msgFileUrl)
{
CFStringRef msgFilePath = CFURLCopyFileSystemPath(msgFileUrl,
kCFURLPOSIXPathStyle);
if (msgFilePath)
{
char file_buff[MAXPATHLEN];
if (CFStringGetCString(msgFilePath, file_buff, MAXPATHLEN,
kCFStringEncodingMacRoman))
{
string dir = file_buff;
dir += PathUtils::dir_sep;
return dir;
}
}
}
}
// No luck
return "";
}
示例8: CFBundleGetBundleWithIdentifier
void CAUGuiGraphic::loadImagePNG ( char* pngFileName )
{
CFBundleRef bundleRef = CFBundleGetBundleWithIdentifier(CFSTR( AU_BUNDLE_IDENTIFIER ));
CGDataProviderRef provider;
if ( bundleRef )
{
SInt16 tmp = CurResFile();
CFStringRef fileName = ::CFStringCreateWithCString( NULL, pngFileName, kCFStringEncodingASCII );
if ( fileName != NULL )
{
CFURLRef url = ::CFBundleCopyResourceURL( bundleRef, fileName, NULL, NULL );
provider = CGDataProviderCreateWithURL( url );
Image = CGImageCreateWithPNGDataProvider( provider, NULL, false, kCGRenderingIntentDefault );
CGDataProviderRelease( provider );
CFRelease( url );
CFRelease( fileName );
}
else
{
Image = NULL;
}
UseResFile(tmp);
}
}
示例9: hu_XMLLoad
/*************************************************************************
*
* hu_XMLLoad( inResourceName, inResourceExtension )
*
* Purpose: Load a resource( XML ) file into a CFPropertyListRef
*
* Inputs: inResourceName - name of the resource file
* inResourceExtension - extension of the resource file
*
* Returns: CFPropertyListRef - the data
*/
static CFPropertyListRef hu_XMLLoad(CFStringRef inResourceName, CFStringRef inResourceExtension) {
CFURLRef resFileCFURLRef;
CFPropertyListRef tCFPropertyListRef = NULL;
// check the main (application) bundle
resFileCFURLRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), inResourceName, inResourceExtension, NULL);
if ( !resFileCFURLRef ) {
// check this specific (HID_Utilities framework) bundle
CFBundleRef tCFBundleRef = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.HID_Utilities"));
if ( tCFBundleRef ) {
resFileCFURLRef = CFBundleCopyResourceURL( tCFBundleRef, inResourceName, inResourceExtension, NULL );
}
}
if ( !resFileCFURLRef ) {
// check bundles already loaded or otherwise known to the current process
CFArrayRef tCFArrayRef = CFBundleGetAllBundles();
CFIndex idx, cnt = CFArrayGetCount(tCFArrayRef);
for ( idx = 0; idx < cnt; idx++ ) {
CFBundleRef tCFBundleRef = (CFBundleRef) CFArrayGetValueAtIndex(tCFArrayRef, idx) ;
if ( tCFBundleRef ) {
resFileCFURLRef = CFBundleCopyResourceURL( tCFBundleRef, inResourceName, inResourceExtension, NULL );
if ( resFileCFURLRef ) {
break;
}
}
}
}
if ( resFileCFURLRef ) {
tCFPropertyListRef = hu_LoadFromXMLFile(resFileCFURLRef);
CFRelease(resFileCFURLRef);
}
return (tCFPropertyListRef);
} // hu_XMLLoad
示例10: uv__set_process_title
int uv__set_process_title(const char* title) {
#if TARGET_OS_IPHONE
return -1;
#else
typedef CFTypeRef (*LSGetCurrentApplicationASNType)(void);
typedef OSStatus (*LSSetApplicationInformationItemType)(int,
CFTypeRef,
CFStringRef,
CFStringRef,
CFDictionaryRef*);
CFBundleRef launch_services_bundle;
LSGetCurrentApplicationASNType ls_get_current_application_asn;
LSSetApplicationInformationItemType ls_set_application_information_item;
CFStringRef* display_name_key;
ProcessSerialNumber psn;
CFTypeRef asn;
CFStringRef display_name;
OSStatus err;
launch_services_bundle =
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.LaunchServices"));
if (launch_services_bundle == NULL)
return -1;
ls_get_current_application_asn = (LSGetCurrentApplicationASNType)
CFBundleGetFunctionPointerForName(launch_services_bundle,
CFSTR("_LSGetCurrentApplicationASN"));
if (ls_get_current_application_asn == NULL)
return -1;
ls_set_application_information_item = (LSSetApplicationInformationItemType)
CFBundleGetFunctionPointerForName(launch_services_bundle,
CFSTR("_LSSetApplicationInformationItem"));
if (ls_set_application_information_item == NULL)
return -1;
display_name_key = CFBundleGetDataPointerForName(launch_services_bundle,
CFSTR("_kLSDisplayNameKey"));
if (display_name_key == NULL || *display_name_key == NULL)
return -1;
/* Force the process manager to initialize. */
GetCurrentProcess(&psn);
display_name = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
asn = ls_get_current_application_asn();
err = ls_set_application_information_item(-2, /* Magic value. */
asn,
*display_name_key,
display_name,
NULL);
return (err == noErr) ? 0 : -1;
#endif /* !TARGET_OS_IPHONE */
}
示例11: GetCodecBundle
CFBundleRef GetCodecBundle()
{
static CFBundleRef sAudioCodecBundle = 0;
if (!sAudioCodecBundle)
{
#if TARGET_OS_WIN32
sAudioCodecBundle = CFBundleGetBundleWithIdentifier(CFSTR(kCodecBundleID));
#else
sAudioCodecBundle = CFBundleGetBundleWithIdentifier(kCodecBundleID);
#endif
if (sAudioCodecBundle)
{
CFRetain(sAudioCodecBundle);
}
}
return sAudioCodecBundle;
}
示例12: htmlURLRef
String WebInspectorProxy::inspectorPageURL() const
{
RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
if (!htmlURLRef)
return String();
return String(CFURLGetString(htmlURLRef.get()));
}
示例13: open_libgl
static void open_libgl(void)
{
bundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengles")); // we are always linked to OpenGLES.framework statically, so it is already loaded and could be found by id
assert(bundle != NULL);
CFRetain(bundle);
bundleURL = CFBundleCopyBundleURL(bundle);
}
示例14: GetCodecBundle
CFBundleRef GetCodecBundle()
{
static CFBundleRef sAudioCodecBundle = 0;
if (!sAudioCodecBundle)
{
#ifdef _MSC_VER // QuickTime 6.4 and before is broken
sAudioCodecBundle = CFBundleGetBundleWithIdentifier(CFSTR(kCodecBundleID));
#else
sAudioCodecBundle = CFBundleGetBundleWithIdentifier(kCodecBundleID);
#endif
if (sAudioCodecBundle)
{
CFRetain(sAudioCodecBundle);
}
}
return sAudioCodecBundle;
}
示例15: _glfwPlatformInit
int _glfwPlatformInit( void )
{
struct timeval tv;
UInt32 nullDummy = 0;
_glfwWin.MacWindow = NULL;
_glfwWin.AGLContext = NULL;
_glfwWin.WindowFunctions = NULL;
_glfwWin.MouseUPP = NULL;
_glfwWin.CommandUPP = NULL;
_glfwWin.KeyboardUPP = NULL;
_glfwWin.WindowUPP = NULL;
_glfwInput.Modifiers = 0;
_glfwLibs.OpenGLFramework
= CFBundleGetBundleWithIdentifier( CFSTR( "com.apple.opengl" ) );
if( _glfwLibs.OpenGLFramework == NULL )
{
return GL_FALSE;
}
_glfwDesktopVideoMode = CGDisplayCurrentMode( kCGDirectMainDisplay );
if( _glfwDesktopVideoMode == NULL )
{
return GL_FALSE;
}
_glfwInitThreads();
if( !_glfwChangeToResourcesDirectory() )
{
return GL_FALSE;
}
if( !_glfwInstallEventHandlers() )
{
_glfwPlatformTerminate();
return GL_FALSE;
}
// Ugly hack to reduce the nasty jump that occurs at the first non-
// sys keypress, caused by OS X loading certain meta scripts used
// for lexical- and raw keycode translation - instead of letting
// this happen while our application is running, we do some blunt
// function calls in advance just to get the script caching out of
// the way, BEFORE our window/screen is opened. These calls might
// generate err return codes, but we don't care in this case.
// NOTE: KCHRPtr is declared globally, because we need it later on.
KCHRPtr = (void *)GetScriptVariable( smCurrentScript, smKCHRCache );
KeyTranslate( KCHRPtr, 0, &nullDummy );
UppercaseText( (char *)&nullDummy, 0, smSystemScript );
gettimeofday( &tv, NULL );
_glfwTimer.t0 = tv.tv_sec + (double) tv.tv_usec / 1000000.0;
return GL_TRUE;
}