当前位置: 首页>>代码示例>>C++>>正文


C++ CFStringCompare函数代码示例

本文整理汇总了C++中CFStringCompare函数的典型用法代码示例。如果您正苦于以下问题:C++ CFStringCompare函数的具体用法?C++ CFStringCompare怎么用?C++ CFStringCompare使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CFStringCompare函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _glfwChangeToResourcesDirectory

void _glfwChangeToResourcesDirectory( void )
{
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    if( mainBundle == NULL )
    {
        UNBUNDLED;
    }

    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL( mainBundle );
    char resourcesPath[ _GLFW_MAX_PATH_LENGTH ];

    CFStringRef lastComponent = CFURLCopyLastPathComponent( resourcesURL );
    if( kCFCompareEqualTo != CFStringCompare(
            CFSTR( "Resources" ),
            lastComponent,
            0 ) )
    {
        UNBUNDLED;
    }

    CFRelease( lastComponent );

    if( !CFURLGetFileSystemRepresentation( resourcesURL,
                                           TRUE,
                                           (UInt8*)resourcesPath,
                                           _GLFW_MAX_PATH_LENGTH ) )
    {
        CFRelease( resourcesURL );
        UNBUNDLED;
    }

    CFRelease( resourcesURL );

#ifndef MMDAGENT
    if( chdir( resourcesPath ) != 0 )
    {
        UNBUNDLED;
    }
#endif /* !MMDAGENT */
}
开发者ID:ljmljz,项目名称:MMDAgent,代码行数:40,代码来源:carbon_init.c

示例2: _CFBundleInitPlugIn

__private_extern__ void _CFBundleInitPlugIn(CFBundleRef bundle) {
    CFArrayCallBacks _pluginFactoryArrayCallbacks = {0, NULL, NULL, NULL, NULL};
    Boolean doDynamicReg = false;
    CFDictionaryRef infoDict;
    CFDictionaryRef factoryDict;
    CFDictionaryRef typeDict;
    CFStringRef tempStr;

    infoDict = CFBundleGetInfoDictionary(bundle);
    if (!infoDict) return;
    
    factoryDict = (CFDictionaryRef)CFDictionaryGetValue(infoDict, kCFPlugInFactoriesKey);
    if (factoryDict && CFGetTypeID(factoryDict) != CFDictionaryGetTypeID()) factoryDict = NULL;
    tempStr = (CFStringRef)CFDictionaryGetValue(infoDict, kCFPlugInDynamicRegistrationKey);
    if (tempStr && CFGetTypeID(tempStr) == CFStringGetTypeID() && CFStringCompare(tempStr, CFSTR("YES"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) doDynamicReg = true;
    if (!factoryDict && !doDynamicReg) return;  // This is not a plug-in.

    /* loadOnDemand is true by default if the plugIn does not do dynamic registration.  It is false, by default if it does do dynamic registration.  The dynamic register function can set this. */
    __CFBundleGetPlugInData(bundle)->_isPlugIn = true;
    __CFBundleGetPlugInData(bundle)->_loadOnDemand = true;
    __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = false;
    __CFBundleGetPlugInData(bundle)->_instanceCount = 0;

    __CFBundleGetPlugInData(bundle)->_factories = CFArrayCreateMutable(CFGetAllocator(bundle), 0, &_pluginFactoryArrayCallbacks);

    /* Now do the registration */

    /* First do static registrations, if any. */
    if (factoryDict) CFDictionaryApplyFunction(factoryDict, _registerFactory, bundle);
    typeDict = (CFDictionaryRef)CFDictionaryGetValue(infoDict, kCFPlugInTypesKey);
    if (typeDict && CFGetTypeID(typeDict) != CFDictionaryGetTypeID()) typeDict = NULL;
    if (typeDict) CFDictionaryApplyFunction(typeDict, _registerType, bundle);

    /* Now set key for dynamic registration if necessary */
    if (doDynamicReg) {
        CFDictionarySetValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"), CFSTR("YES"));
        if (CFBundleIsExecutableLoaded(bundle)) _CFBundlePlugInLoaded(bundle);
    }
}
开发者ID:Ashod,项目名称:WinCairoRequirements,代码行数:39,代码来源:CFPlugIn_PlugIn.c

示例3: SecPolicyCreateWithOID

/* new in 10.7 */
SecPolicyRef
SecPolicyCreateWithOID(CFTypeRef policyOID)
{
	//%%% FIXME: allow policyOID to be a CFDataRef or a CFStringRef for an arbitrary OID
	// for now, we only accept the policy constants that are defined in SecPolicy.h
	CFStringRef oidStr = (CFStringRef)policyOID;
	CSSM_OID *oidPtr = NULL;
	SecPolicyRef policy = NULL;
	const void* oidmap[] = {
		kSecPolicyAppleX509Basic, &CSSMOID_APPLE_X509_BASIC,
		kSecPolicyAppleSSL, &CSSMOID_APPLE_TP_SSL,
		kSecPolicyAppleSMIME, &CSSMOID_APPLE_TP_SMIME,
		kSecPolicyAppleEAP, &CSSMOID_APPLE_TP_EAP,
		kSecPolicyAppleIPsec, &CSSMOID_APPLE_TP_IP_SEC,
		kSecPolicyAppleiChat, &CSSMOID_APPLE_TP_ICHAT,
		kSecPolicyApplePKINITClient, &CSSMOID_APPLE_TP_PKINIT_CLIENT,
		kSecPolicyApplePKINITServer, &CSSMOID_APPLE_TP_PKINIT_SERVER,
		kSecPolicyAppleCodeSigning, &CSSMOID_APPLE_TP_CODE_SIGNING,
		kSecPolicyMacAppStoreReceipt, &CSSMOID_APPLE_TP_MACAPPSTORE_RECEIPT,
		kSecPolicyAppleIDValidation, &CSSMOID_APPLE_TP_APPLEID_SHARING
	};
	unsigned int i, oidmaplen = sizeof(oidmap) / sizeof(oidmap[0]);
	for (i=0; i<oidmaplen*2; i+=2) {
		CFStringRef str = (CFStringRef)oidmap[i];
		if (CFStringCompare(str, oidStr, 0) == kCFCompareEqualTo) {
			oidPtr = (CSSM_OID*)oidmap[i+1];
			break;
		}
	}
	if (oidPtr) {
		SecPolicySearchRef policySearch = NULL;
		OSStatus status = SecPolicySearchCreate(CSSM_CERT_X_509v3, oidPtr, NULL, &policySearch);
		if (!status && policySearch) {
			status = SecPolicySearchCopyNext(policySearch, &policy);
			CFRelease(policySearch);
		}
	}
	return policy;
}
开发者ID:phinze,项目名称:libsecurity_keychain,代码行数:40,代码来源:SecPolicy.cpp

示例4: IOPSCopyPowerSourcesInfo

bool CScreensaver::Host_is_running_on_batteries() {
    CFDictionaryRef pSource = NULL;
    CFStringRef psState;
    int i;
    bool retval = false;

    CFTypeRef blob = IOPSCopyPowerSourcesInfo();
    CFArrayRef list = IOPSCopyPowerSourcesList(blob);

    for (i=0; i<CFArrayGetCount(list); i++) {
        pSource = IOPSGetPowerSourceDescription(blob, CFArrayGetValueAtIndex(list, i));
        if(!pSource) break;
        psState = (CFStringRef)CFDictionaryGetValue(pSource, CFSTR(kIOPSPowerSourceStateKey));
        if(!CFStringCompare(psState,CFSTR(kIOPSBatteryPowerValue),0))
        retval = true;
    }

    CFRelease(blob);
    CFRelease(list);
        
    return retval;
}
开发者ID:DanAurea,项目名称:boinc,代码行数:22,代码来源:mac_saver_module.cpp

示例5: QObject

Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon, QWidget *parent):
    QObject(parent),
    parent(parent),
    programName(programName),
    mode(None),
    trayIcon(trayicon)
#ifdef USE_DBUS
    ,interface(0)
#endif
{
    if(trayicon && trayicon->supportsMessages())
    {
        mode = QSystemTray;
    }
#ifdef USE_DBUS
    interface = new QDBusInterface("org.freedesktop.Notifications",
          "/org/freedesktop/Notifications", "org.freedesktop.Notifications");
    if(interface->isValid())
    {
        mode = Freedesktop;
    }
#endif
#ifdef Q_OS_MAC
    // Check if Growl is installed (based on Qt's tray icon implementation)
    CFURLRef cfurl;
    OSStatus status = LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator, CFSTR("growlTicket"), kLSRolesAll, 0, &cfurl);
    if (status != kLSApplicationNotFoundErr) {
        CFBundleRef bundle = CFBundleCreate(0, cfurl);
        if (CFStringCompare(CFBundleGetIdentifier(bundle), CFSTR("com.Growl.GrowlHelperApp"), kCFCompareCaseInsensitive | kCFCompareBackwards) == kCFCompareEqualTo) {
            if (CFStringHasSuffix(CFURLGetString(cfurl), CFSTR("/Growl.app/")))
                mode = Growl13;
            else
                mode = Growl12;
        }
        CFRelease(cfurl);
        CFRelease(bundle);
    }
#endif
}
开发者ID:iadix,项目名称:iadixcoin,代码行数:39,代码来源:notificator.cpp

示例6: switch

const void *subsurface_get_conf(char *name, pref_type_t type)
{
	CFStringRef dict_entry;

	/* if no settings exist, we return the value for FALSE */
	if (!propertyList)
		return NULL;

	switch (type) {
	case PREF_BOOL:
		dict_entry = CFDictionaryGetValue(propertyList, CFSTR_VAR(name));
		if (dict_entry && ! CFStringCompare(CFSTR("1"), dict_entry, 0))
			return (void *) 1;
		else
			return NULL;
	case PREF_STRING:
		return CFStringGetCStringPtr(CFDictionaryGetValue(propertyList,
						CFSTR_VAR(name)), kCFStringEncodingMacRoman);
	}
	/* we shouldn't get here, but having this line makes the compiler happy */
	return NULL;
}
开发者ID:vavincavent,项目名称:subsurface,代码行数:22,代码来源:macos.c

示例7: kim_os_string_compare

kim_error kim_os_string_compare (kim_string      in_string,
                                 kim_string      in_compare_to_string,
                                 kim_boolean     in_case_insensitive,
                                 kim_comparison *out_comparison)
{
    kim_error err = KIM_NO_ERROR;
    CFStringRef cfstring = NULL;
    CFStringRef compare_to_cfstring = NULL;
    
    if (!err && !in_string           ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
    if (!err && !in_compare_to_string) { err = check_error (KIM_NULL_PARAMETER_ERR); }
    if (!err && !out_comparison      ) { err = check_error (KIM_NULL_PARAMETER_ERR); }
    
    if (!err) {
        err = kim_os_string_get_cfstring (in_string, 
                                          &cfstring);
    }
    
    if (!err) {
        err = kim_os_string_get_cfstring (in_compare_to_string, 
                                          &compare_to_cfstring);
    }
    
    if (!err) {
        CFOptionFlags options = (in_case_insensitive ? 
                                 1 : kCFCompareCaseInsensitive);
        
        /* Returned CFComparisonResult is compatible with kim_comparison_t */
        *out_comparison = CFStringCompare (cfstring, 
                                           compare_to_cfstring, 
                                           options);            
    }
    
    if (cfstring           ) { CFRelease (cfstring); }
    if (compare_to_cfstring) { CFRelease (compare_to_cfstring); }
    
    return check_error (err);
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:38,代码来源:kim_os_string.c

示例8: CreateDisplayNameForURL

CFStringRef
CreateDisplayNameForURL(CFURLRef url)
{
    assert(nullptr != url);

    CFStringRef displayName = nullptr;

#if !TARGET_OS_IPHONE
    CFStringRef scheme = CFURLCopyScheme(url);
    if(scheme) {
        bool isFileURL = (kCFCompareEqualTo == CFStringCompare(CFSTR("file"), scheme, kCFCompareCaseInsensitive));
        CFRelease(scheme), scheme = nullptr;

        if(isFileURL) {
            OSStatus result = LSCopyDisplayNameForURL(url, &displayName);

            if(noErr != result) {
                LOGGER_WARNING("org.sbooth.AudioEngine", "LSCopyDisplayNameForURL failed: " << result);
                displayName = CFURLCopyLastPathComponent(url);
            }
        }
        else {
            displayName = CFURLGetString(url);
            CFRetain(displayName);
        }
    }
    // If scheme is nullptr the URL is probably invalid, but can still be logged
    else {
        displayName = CFURLGetString(url);
        CFRetain(displayName);
    }
#else
    displayName = CFURLGetString(url);
    CFRetain(displayName);
#endif

    return displayName;
}
开发者ID:Hyacinth,项目名称:SFBAudioEngine,代码行数:38,代码来源:CreateDisplayNameForURL.cpp

示例9: SecureDownloadCopyTicketLocation

OSStatus SecureDownloadCopyTicketLocation (CFURLRef url, CFURLRef *ticketLocation)
{
	API_BEGIN
		Required (ticketLocation);
		Required (url);
		
		// copy the resource specifier
		CFStringRef resourceSpecifier = CFURLCopyResourceSpecifier (url);
		if (resourceSpecifier == NULL)
		{
			CFError::throwMe ();
		}

		// make a new URL from the resource specifier
		*ticketLocation = CFURLCreateWithString (NULL, resourceSpecifier, NULL);
		if (*ticketLocation == NULL)
		{
			CFError::throwMe ();
		}
		
		// check the scheme to make sure that it isn't a file url
		CFStringRef scheme = CFURLCopyScheme (*ticketLocation);
		if (scheme != NULL)
		{
			CFComparisonResult equal = CFStringCompare (scheme, CFSTR("file"), kCFCompareCaseInsensitive);
			CFRelease (scheme);
			
			if (equal == kCFCompareEqualTo)
			{
				CFRelease (*ticketLocation);
				*ticketLocation = NULL;
				MacOSError::throwMe (errSecureDownloadInvalidDownload);
			}
		}
		
		CFRelease (resourceSpecifier);
	API_END
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:38,代码来源:SecureDownload.cpp

示例10: IOURLCreateDataAndPropertiesFromResource

Boolean IOURLCreateDataAndPropertiesFromResource(CFAllocatorRef alloc, CFURLRef url, CFDataRef *fetchedData, CFDictionaryRef *fetchedProperties, CFArrayRef desiredProperties, SInt32 *errorCode) {

    CFStringRef scheme = CFURLCopyScheme(url);

    if (!scheme) {
        if (errorCode) *errorCode = kIOURLImproperArgumentsError;
        if (fetchedData) *fetchedData = NULL;
        if (fetchedProperties) *fetchedProperties = NULL;
        return FALSE;
    } else {
        Boolean result;
        if (CFStringCompare(scheme, CFSTR("file"), 0) == kCFCompareEqualTo) {
            result = _IOFileURLCreateDataAndPropertiesFromResource(alloc, url, fetchedData, desiredProperties, fetchedProperties, errorCode);
        } else {
            if (fetchedData) *fetchedData = NULL;
            if (fetchedProperties) *fetchedProperties = NULL;
            if (errorCode) *errorCode = kIOURLUnknownSchemeError;
            result = FALSE;
        }
        CFRelease(scheme);
        return result;
    }
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:23,代码来源:IOCFURLAccess.c

示例11: test_apple_Sessioned_AMDeviceCopyValue

kern_return_t test_apple_Sessioned_AMDeviceCopyValue(struct am_device *apple, CFTypeRef *value) {
	kern_return_t apple_return = kAMDUndefinedError;
	CFTypeRef apple_value = NULL;
	kern_return_t result = AMDeviceConnect(apple);
	if (SDM_MD_CallSuccessful(result)) {
		result = AMDeviceStartSession(apple);
		if (SDM_MD_CallSuccessful(result)) {
			apple_value = AMDeviceCopyValue(apple, CFSTR(kInternationalDomain), CFSTR(kLanguage));
			if (apple_value == NULL || CFStringCompare(apple_value, CFSTR("GetProhibited"), 0) == kCFCompareEqualTo) {
				printf("\t\tappleMD_AMDeviceCopyValue (w/ Session): GetProhibited\n");
				apple_return = kAMDGetProhibitedError;
				CFSafeRelease(apple_value);
			}
			else {
				*value = apple_value;
				apple_return = kAMDSuccess;
			}
			AMDeviceStopSession(apple);
		}
		AMDeviceDisconnect(apple);
	}
	return apple_return;
}
开发者ID:JeremyAgost,项目名称:SDMMobileDevice,代码行数:23,代码来源:test_apple_AMDevice.c

示例12: CFNotificationObserverEqual

static inline Boolean CFNotificationObserverEqual(CFNotificationObserver *observer1, CFNotificationObserver *observer2) {
    if (observer1 == observer2) {
        return true;
    }

    if (observer1->observer != observer2->observer) {
        return false;
    }
    
    if (observer1->callBack != observer2->callBack) {
        return false;
    }

    if (CFStringCompare(observer1->name, observer2->name, 0) != kCFCompareEqualTo) {
        return false;
    }

    if (observer1->object != observer2->object) {
        return false;
    }

    return true;
}
开发者ID:Gamecharger,项目名称:Foundation,代码行数:23,代码来源:CFNotificationCenter.c

示例13: _mongoc_secure_transport_dict_get

CFTypeRef
_mongoc_secure_transport_dict_get (CFArrayRef values, CFStringRef label)
{
   if (!values || CFGetTypeID (values) != CFArrayGetTypeID ()) {
      return NULL;
   }

   for (CFIndex i = 0; i < CFArrayGetCount (values); ++i) {
      CFStringRef item_label;
      CFDictionaryRef item = CFArrayGetValueAtIndex (values, i);

      if (CFGetTypeID (item) != CFDictionaryGetTypeID ()) {
         continue;
      }

      item_label = CFDictionaryGetValue (item, kSecPropertyKeyLabel);
      if (item_label && CFStringCompare (item_label, label, 0) == kCFCompareEqualTo) {
         return CFDictionaryGetValue (item, kSecPropertyKeyValue);
      }
   }

   return NULL;
}
开发者ID:derickr,项目名称:mongo-c-driver,代码行数:23,代码来源:mongoc-secure-transport.c

示例14: CFStringCreateWithCString

CFMutableDictionaryRef
CAuthAuthority::GetValueForTagAsCFDict( const char *inTagStr )
{
	CFMutableDictionaryRef theDict = NULL;
	CFMutableDictionaryRef aDict = NULL;
	CFIndex arrayCount = 0;
	CFIndex index = 0;
	CFStringRef tagValueString = NULL;
	CFStringRef searchTagValueString = NULL;
	
	if ( mValueArray == NULL )
		return NULL;
	
	searchTagValueString = CFStringCreateWithCString( kCFAllocatorDefault, inTagStr, kCFStringEncodingUTF8 );
	if ( searchTagValueString == NULL )
		return NULL;
	
	arrayCount = CFArrayGetCount( mValueArray );
	for ( index = 0; index < arrayCount; index++ )
	{
		aDict = (CFMutableDictionaryRef) CFArrayGetValueAtIndex( mValueArray, index );
		if ( aDict != NULL )
		{
			tagValueString = (CFStringRef) CFDictionaryGetValue( aDict, CFSTR("tag") );
			if ( tagValueString != NULL &&
				 CFStringCompare(tagValueString, searchTagValueString, kCFCompareCaseInsensitive) == kCFCompareEqualTo )
			{
				theDict = aDict;
				break;
			}
		}
	}
	
	CFRelease( searchTagValueString );
	
	return theDict;
}
开发者ID:aosm,项目名称:DSTools,代码行数:37,代码来源:CAuthAuthority.cpp

示例15: iSCSIIORegistryIOMediaApplyFunction

/*! Applies a callback function all IOMedia objects of a particular target.
 *  @param target search children of this node for IOMedia objects.
 *  @param callback the callback function to call on each IOMedia object.
 *  @param context a user-defined parameter to pass to the callback function. */
void iSCSIIORegistryIOMediaApplyFunction(io_object_t target,
                                         iSCSIIOMediaCallback callback,
                                         void * context)
{
    io_object_t entry = IO_OBJECT_NULL;
    io_iterator_t iterator = IO_OBJECT_NULL;
    IORegistryEntryGetChildIterator(target,kIOServicePlane,&iterator);
    
    // Iterate over all children of the target object
    while((entry = IOIteratorNext(iterator)) != IO_OBJECT_NULL)
    {
        // Recursively call this function for each child of the target
        iSCSIIORegistryIOMediaApplyFunction(entry,callback,context);
        
        // Find the IOMedia's root provider class (IOBlockStorageDriver) and
        // get the first child.  This ensures that we grab the IOMedia object
        // for the disk itself and not each individual partition
        CFStringRef providerClass = IORegistryEntryCreateCFProperty(entry,CFSTR(kIOClassKey),kCFAllocatorDefault,0);

        if(providerClass && CFStringCompare(providerClass,CFSTR(kIOBlockStorageDriverClass),0) == kCFCompareEqualTo)
        {
            // Apply callback function to the child (the child is the the
            // IOMedia object that pertains to the whole disk)
            io_object_t child;
            IORegistryEntryGetChildEntry(entry,kIOServicePlane,&child);
            callback(child,context);
            IOObjectRelease(child);
        }
        
        if(providerClass)
            CFRelease(providerClass);
        
        IOObjectRelease(entry);
    }
    
    IOObjectRelease(iterator);
}
开发者ID:BestMacsBen,项目名称:iSCSIInitiator,代码行数:41,代码来源:iSCSIIORegistry.c


注:本文中的CFStringCompare函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。