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


C++ CFArrayCreate函数代码示例

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


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

示例1:

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	SampleEffectUnit::GetParameterValueStrings
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus			SampleEffectUnit::GetParameterValueStrings(	AudioUnitScope			inScope,
                                                                AudioUnitParameterID	inParameterID,
                                                                CFArrayRef *			outStrings)
{
    if ( (inScope == kAudioUnitScope_Global) && (inParameterID == kParam_Three_Indexed) ) {
        if (outStrings == NULL) return noErr; //called by GetPropInfo
		
		CFStringRef	strings[] = {	kParameterValueStringsOne, kParameterValueStringsTwo, kParameterValueStringsThree };
	   
		*outStrings = CFArrayCreate( NULL, (const void **)strings, 3, NULL);
        
        return noErr;
    }
    
    return kAudioUnitErr_InvalidProperty;
}
开发者ID:fruitsamples,项目名称:SampleAUs,代码行数:20,代码来源:SampleEffectUnit.cpp

示例2: CFSTR

OSStatus			SinSynthWithMidi::GetProperty(	AudioUnitPropertyID		inID,
											AudioUnitScope			inScope,
											AudioUnitElement		inElement,
											void *					outData)
{
	if (inScope == kAudioUnitScope_Global) {
		if (inID == kAudioUnitProperty_MIDIOutputCallbackInfo) {
			CFStringRef strs[1];
			strs[0] = CFSTR("MIDI Callback");
			
			CFArrayRef callbackArray = CFArrayCreate(NULL, (const void **)strs, 1, &kCFTypeArrayCallBacks);
			*(CFArrayRef *)outData = callbackArray;
			return noErr;
		}
	}
	return SinSynth::GetProperty (inID, inScope, inElement, outData);
}
开发者ID:fruitsamples,项目名称:SinSynth,代码行数:17,代码来源:SinSynthWithMidi.cpp

示例3: iSCSIDiscoveryRecCreateArrayOfTargets

/*! Creates a CFArray object containing CFString objects with names of
 *  all of the targets in the discovery record.
 *  @param discoveryRec the discovery record.
 *  @return an array of strings with names of the targets in the record. */
CFArrayRef iSCSIDiscoveryRecCreateArrayOfTargets(iSCSIDiscoveryRecRef discoveryRec)
{
    // Validate input
    if(!discoveryRec)
        return NULL;
    
    // Get all keys, which correspond to the targets
    const CFIndex count = CFDictionaryGetCount(discoveryRec);
    const void * keys[count];
    CFDictionaryGetKeysAndValues(discoveryRec,keys,NULL);
    
    CFArrayRef targets = CFArrayCreate(kCFAllocatorDefault,
                                       keys,
                                       count,
                                       &kCFTypeArrayCallBacks);
    return targets;
}
开发者ID:anvena,项目名称:iSCSIInitiator,代码行数:21,代码来源:iSCSITypes.c

示例4: tests

static void tests(void)
{
    SecTrustResultType trustResult = kSecTrustResultProceed;
	SecPolicyRef policy = NULL;
	SecTrustRef trust = NULL;
	CFArrayRef certs = NULL;
	
	CFDataRef appleid_record_signing_cert_data = NULL;
	isnt(appleid_record_signing_cert_data = CFDataCreate(kCFAllocatorDefault, kLeafCert, sizeof(kLeafCert)), 
		NULL, "Get the AppleID Record Signing Leaf Certificate Data");
		
	SecCertificateRef appleid_record_signing_cert = NULL;
	isnt(appleid_record_signing_cert = SecCertificateCreateWithData(kCFAllocatorDefault, appleid_record_signing_cert_data),
		NULL, "Get the AppleID Record Signing Leaf Certificate Data");
		
	CFDataRef appleid_intermediate_cert_data = NULL;
	isnt(appleid_intermediate_cert_data = CFDataCreate(kCFAllocatorDefault, kIntermediateCert, sizeof(kIntermediateCert)), 
		NULL, "Get the AppleID Intermediate Certificate Data");
		
	SecCertificateRef appleid_intermediate_cert = NULL;
	isnt(appleid_intermediate_cert = SecCertificateCreateWithData(kCFAllocatorDefault, appleid_intermediate_cert_data),
		NULL, "Get the AppleID Intermediate Certificate");
		
	SecCertificateRef certs_to_use[] = {appleid_record_signing_cert, appleid_intermediate_cert};
		
	certs = CFArrayCreate(NULL, (const void **)certs_to_use, 2, NULL);
		
	isnt(policy = SecPolicyCreateAppleIDValidationRecordSigningPolicy(),
		NULL, "Create AppleID Record signing policy SecPolicyRef");
				
	ok_status(SecTrustCreateWithCertificates(certs, policy, &trust),
        "Create AppleID record signing leaf");

	ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate escrow service trust for club 1");
		
	is_status(trustResult, kSecTrustResultUnspecified,
		"Trust is kSecTrustResultUnspecified AppleID record signing leaf");
		
	CFReleaseSafe(trust);
	CFReleaseSafe(policy);
	CFReleaseSafe(certs);
	CFReleaseSafe(appleid_record_signing_cert);
    CFReleaseSafe(appleid_intermediate_cert_data);
    CFReleaseSafe(appleid_record_signing_cert_data);
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:45,代码来源:si-75-AppleIDRecordSigning.c

示例5: main

int
main(int argc, char *argv[])
{
    /* Define variables and create a CFArray object containing
	CFString objects containing paths to watch.
	*/
    CFStringRef mypath = CFSTR("/");
    CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **)&mypath, 1, NULL);
    void *callbackInfo = NULL; // could put stream-specific data here.
    FSEventStreamRef stream;
    CFAbsoluteTime latency = 3.0; /* Latency in seconds */
	struct stat Status;
 	stat("/", &Status);
	dev_t device = Status.st_dev;
	
	
	CFUUIDRef uuidO;
	CFStringRef uuid;
	uuidO = FSEventsCopyUUIDForDevice(device); 
	uuid = CFUUIDCreateString(NULL, uuidO);
	
	show(CFSTR("%@:256"), uuid);
	
	
	
    /* Create the stream, passing in a callback, */
    stream =  FSEventStreamCreateRelativeToDevice(NULL,
	&myCallbackFunction,
	callbackInfo,
	device,
	pathsToWatch,
	atoi(argv[2]), /* Or a previous event ID */
	latency,
	kFSEventStreamCreateFlagNone /* Flags explained in reference */
	);
	  /* Create the stream before calling this. */
    FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(),         kCFRunLoopDefaultMode);
	FSEventStreamStart(stream);
	//CFRunLoopRun();
	CFRunLoopRunInMode(kCFRunLoopDefaultMode,atoi(argv[1]),false);
	//sleep(10);
	
	
  
}
开发者ID:chregu,项目名称:tmcli,代码行数:45,代码来源:fse.c

示例6: ShowErrorVa

static void ShowErrorVa(const wchar_t *de, const wchar_t *en, va_list args)
{
	// Get current language
	const wchar_t *stringToUse = en;
#ifdef _WIN32
	if ((GetUserDefaultLangID() & 0xFF) == LANG_GERMAN) stringToUse = de;		
#elif defined(__APPLE_CC__)
	CFStringRef localisations[2] = { CFSTR("en"), CFSTR("de") };
	CFArrayRef allLocalisations = CFArrayCreate(kCFAllocatorDefault, (const void **) localisations, 2, &kCFTypeArrayCallBacks);
	CFArrayRef preferredLocalisations = CFBundleCopyPreferredLocalizationsFromArray(allLocalisations);
	CFStringRef oldStyleLang = (CFStringRef) CFArrayGetValueAtIndex(preferredLocalisations, 0);
	CFStringRef newStyleLang = CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, oldStyleLang);
	
	if (CFStringHasPrefix(newStyleLang, CFSTR("de"))) stringToUse = de;
	
	CFRelease(allLocalisations);
	CFRelease(preferredLocalisations);
	CFRelease(newStyleLang);
#else
	// TODO: Implement something here for android.
#endif
	// Create output string
	wchar_t text[1024];
	vswprintf(text, 1024, stringToUse, args);
	
	// Show message
#ifdef _WIN32
	MessageBoxW(NULL, text, L"Mindstorms Simulator", MB_TASKMODAL & MB_ICONWARNING);
#elif defined(IPHONE)
	// Ignore it
#elif defined(__APPLE_CC__)
	CFStringRef messageString = CFStringCreateWithBytes(kCFAllocatorDefault, (const UInt8 *) text, sizeof(wchar_t) * wcslen(text), (CFByteOrderGetCurrent() == CFByteOrderBigEndian) ? kCFStringEncodingUTF32BE : kCFStringEncodingUTF32LE, false);
	CFUserNotificationDisplayAlert(0.0, kCFUserNotificationStopAlertLevel, NULL, NULL, NULL, messageString, NULL, NULL, NULL, NULL, NULL);
	CFRelease(messageString);
#else
	// TODO: Implement something here for android.
	size_t length = wcslen(text)+1;
	char *englishMangledASCII = new char[length];
	for (unsigned i = 0; i < length; i++)
		englishMangledASCII[i] = (char) en[i];
	
	__android_log_print(ANDROID_LOG_FATAL, "librobosim.so", "Error: %s", englishMangledASCII);
	delete englishMangledASCII;
#endif	
}
开发者ID:InfoSphereAC,项目名称:RoboSim,代码行数:45,代码来源:ShowMessageBoxAndExit.cpp

示例7: EAPOLClientConfigurationCopyProfiles

/*
 * Function: EAPOLClientConfigurationCopyProfiles
 *
 * Purpose:
 *   Get the list of defined profiles.   If there are no profiles defined,
 *   returns NULL.
 *
 * Returns:
 *   NULL if no profiles are defined, non-NULL non-empty array of profiles
 *   otherwise.
 */
CFArrayRef /* of EAPOLClientProfileRef */
EAPOLClientConfigurationCopyProfiles(EAPOLClientConfigurationRef cfg)
{
    CFAllocatorRef		allocator = CFGetAllocator(cfg);
    int				count;
    CFArrayRef			profiles;
    const void * *		values;

    count = CFDictionaryGetCount(cfg->profiles);
    if (count == 0) {
	return (NULL);
    }
    values = (const void * *)malloc(sizeof(*values) * count);
    CFDictionaryGetKeysAndValues(cfg->profiles, NULL, values);
    profiles = CFArrayCreate(allocator, values, count, &kCFTypeArrayCallBacks);
    free(values);
    return (profiles);
}
开发者ID:aosm,项目名称:eap8021x,代码行数:29,代码来源:EAPOLClientConfiguration.c

示例8: CFStringCreateWithCString

/**
 * initially this logic was being threaded off using pthreads, but the FSEventStreamCreate call itself has its own threading, and there's no need
 * for this extra layer of threading, especially as it makes it difficult to consume from Java because of the extra complexity of threading in JNI code
 */
void *event_processing_thread( char * path ) {

    char *pathToMonitor =  path ;

    CFStringRef mypath = CFStringCreateWithCString(NULL, pathToMonitor, NULL);
	
    CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **)&mypath, 1, NULL);

    CFAbsoluteTime latency = 0.3;
    FSEventStreamRef stream = FSEventStreamCreate(NULL, &file_system_changed_callback, NULL ,
             pathsToWatch, kFSEventStreamEventIdSinceNow, latency, kFSEventStreamCreateFlagNoDefer);
	
    FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
    FSEventStreamStart(stream);
	
    CFRunLoopRun();
    return NULL;
}
开发者ID:cameronbraid,项目名称:spring-integration-sandbox-fork,代码行数:22,代码来源:fsmon.c

示例9: IONetworkSetPacketFiltersMask

IOReturn
IONetworkSetPacketFiltersMask( io_connect_t    connect,
                               const io_name_t filterGroup,
                               UInt32          filtersMask,
                               IOOptionBits options __unused )
{
	IOReturn        kr = kIOReturnNoMemory;
    CFStringRef     keys[3];
    CFArrayRef      keysArray = 0;
    CFStringRef     group     = 0;
    CFNumberRef     num       = 0;
    CFDictionaryRef dict      = 0;

    do {
        num = CFNumberCreate( kCFAllocatorDefault, 
                              kCFNumberSInt32Type, 
                              &filtersMask );
        if ( num == 0 ) break;

        group = CFStringCreateWithCString( kCFAllocatorDefault, filterGroup,
					                       CFStringGetSystemEncoding() );
        if ( group == 0 ) break;

        keys[0] = CFSTR( kIONetworkInterfaceProperties );
        keys[1] = CFSTR( kIORequiredPacketFilters );
        keys[2] = group;

        keysArray = CFArrayCreate( NULL, (void *)keys, 3, &kCFTypeArrayCallBacks );
        if ( keysArray == 0 ) break;

        dict = CreateNestedDictionariesUsingKeys( keysArray, num );
        if ( dict == 0 ) break;

        kr = IOConnectSetCFProperties( connect, dict );
    }
    while ( 0 );

	if ( num )       CFRelease( num );
    if ( group )     CFRelease( group );
    if ( keysArray ) CFRelease( keysArray );
    if ( dict )      CFRelease( dict );

    return kr;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:44,代码来源:IONetworkLib.c

示例10: add_watch

static FSEventStreamRef add_watch (SeafWTMonitorPriv *priv, const char* repo_id)
{
    SeafRepo *repo = NULL;
    const char *path = NULL;

    repo = seaf_repo_manager_get_repo (seaf->repo_mgr, repo_id);
    if (!repo) {
        seaf_warning ("[wt mon] cannot find repo %s.\n", repo_id);
        return 0;
    }

    path = repo->worktree;
    CFStringRef mypath = CFStringCreateWithCString (kCFAllocatorDefault,
                                                    path, kCFStringEncodingUTF8);
    CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **)&mypath, 1, NULL);
    FSEventStreamRef stream;

    /* Create the stream, passing in a callback */
    struct FSEventStreamContext ctx = {0, priv, NULL, NULL, NULL};
    stream = FSEventStreamCreate(kCFAllocatorDefault,
                                 stream_callback,
                                 &ctx,
                                 pathsToWatch,
                                 kFSEventStreamEventIdSinceNow,
                                 1.0,
                                 kFSEventStreamCreateFlagWatchRoot
        );

    CFRelease (mypath);
    CFRelease (pathsToWatch);

    if (!stream) {
        seaf_warning ("[wt] Failed to create event stream \n");
        return stream;
    }

    FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
    FSEventStreamStart (stream);
#ifdef FSEVENT_DEBUG
    FSEventStreamShow (stream);
    seaf_debug ("[wt mon] Add repo %s watch success :%s.\n", repo_id, repo->worktree);
#endif
    return stream;
}
开发者ID:sheyong,项目名称:seafile,代码行数:44,代码来源:wt-monitor-macos.c

示例11: SecACLCopyAuthorizations

CFArrayRef SecACLCopyAuthorizations(SecACLRef acl)
{
	CFArrayRef result = NULL;
	if (NULL == acl)
	{
		return result;
	}
	
	AclAuthorizationSet auths = ACL::required(acl)->authorizations();
	uint32 numAuths = (uint32)auths.size();				
	
    CSSM_ACL_AUTHORIZATION_TAG* tags = new CSSM_ACL_AUTHORIZATION_TAG[numAuths];
    int i;
    for (i = 0; i < numAuths; ++i)
    {
        tags[i] = NULL;
    }
	
	OSStatus err = SecACLGetAuthorizations(acl, tags, &numAuths);
	if (errSecSuccess != err)
	{
		
		return result;
	}
	
	CFTypeRef* strings = new CFTypeRef[numAuths];
    for (i = 0; i < numAuths; ++i)
    {
        strings[i] = NULL;
    }
    
	for (size_t iCnt = 0; iCnt < numAuths; iCnt++)
	{
		strings[iCnt] = (CFTypeRef)GetAuthStringFromACLAuthorizationTag(tags[iCnt]);
	}

	result = CFArrayCreate(kCFAllocatorDefault, (const void **)strings, numAuths, &kCFTypeArrayCallBacks);

	delete[] strings;
    delete[] tags;

	return result;
	
}
开发者ID:darlinghq,项目名称:darling-security,代码行数:44,代码来源:SecACL.cpp

示例12: RegisterConsoleUserChangeCallback

static Boolean RegisterConsoleUserChangeCallback() {
	CFStringRef	consoleUserNameChangeKey = NULL;
	CFArrayRef	notificationKeys = NULL;
	Boolean		success = TRUE;
	
	write_log(LOG_NOTICE, "Creating ConsoleUser key.");
	
	consoleUserNameChangeKey = SCDynamicStoreKeyCreateConsoleUser(NULL);
    if(consoleUserNameChangeKey == NULL) {
		write_log(LOG_ERR, "Couldn't create ConsoleUser key!");
		success = FALSE;
        goto EXIT;
    }
	
	write_log(LOG_NOTICE, "Creating notification key array.");
	
    notificationKeys = CFArrayCreate(NULL, (void*)&consoleUserNameChangeKey, 
									 (CFIndex)1, &kCFTypeArrayCallBacks);
    if(notificationKeys == NULL) {
		write_log(LOG_ERR, "Couldn't create notification key array!"); 
		success = FALSE;
        goto EXIT;
    }
	
	write_log(LOG_NOTICE, "Setting up DynamicStore notification.");
	
	if(SCDynamicStoreSetNotificationKeys(dsSession, notificationKeys, NULL) == 
	   FALSE) {
		write_log(LOG_ERR, "Couldn't set up DynamicStore notification!"); 
		success = FALSE;
        goto EXIT;
	}
	
EXIT:
	if(notificationKeys != NULL) {
		CFRelease(notificationKeys);
		notificationKeys = NULL;
	}
	if(consoleUserNameChangeKey != NULL) {
		CFRelease(consoleUserNameChangeKey);
		consoleUserNameChangeKey = NULL;
	}
	return success;
}
开发者ID:razzfazz,项目名称:iscroll2,代码行数:44,代码来源:iScroll2Daemon.c

示例13: tests

static void tests(void)
{
    SecTrustRef trust;
    SecCertificateRef leaf, wwdr_intermediate;
    SecPolicyRef policy;

    isnt(wwdr_intermediate = SecCertificateCreateWithBytes(kCFAllocatorDefault,
        wwdr_intermediate_cert, sizeof(wwdr_intermediate_cert)), NULL, "create WWDR intermediate");
    isnt(leaf = SecCertificateCreateWithBytes(kCFAllocatorDefault,
        codesigning_certificate, sizeof(codesigning_certificate)), NULL, "create leaf");

    const void *vcerts[] = { leaf, wwdr_intermediate };
    CFArrayRef certs = CFArrayCreate(kCFAllocatorDefault, vcerts, 2, NULL);

    isnt(policy = SecPolicyCreateiPhoneProfileApplicationSigning(), NULL,
        "create iPhoneProfileApplicationSigning policy instance");
    ok_status(SecTrustCreateWithCertificates(certs, policy, &trust), "create trust for leaf");
    CFDateRef verifyDate = CFDateCreate(kCFAllocatorDefault, 228244066);
    ok_status(SecTrustSetVerifyDate(trust, verifyDate), "set verify date");
    CFReleaseNull(verifyDate);
    SecTrustResultType trustResult;
    CFArrayRef properties = NULL;
    properties = SecTrustCopyProperties(trust);
    is(properties, NULL, "no properties returned before eval");
    CFReleaseNull(properties);
    ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
    is_status(trustResult, kSecTrustResultUnspecified, "trust is kSecTrustResultUnspecified");
    properties = SecTrustCopyProperties(trust);

    if (properties) {
        print_plist(properties);
        print_cert(leaf, true);
        print_cert(wwdr_intermediate, false);
    }

    CFReleaseNull(properties);
    CFReleaseNull(trust);
    CFReleaseNull(wwdr_intermediate);
    CFReleaseNull(leaf);
    CFReleaseNull(certs);
    CFReleaseNull(policy);
	CFReleaseNull(trust);
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:43,代码来源:si-26-applicationsigning.c

示例14: gst_mio_video_src_output_available_formats

static CFArrayRef
gst_mio_video_src_output_available_formats (gpointer instance,
    gboolean ensure_only)
{
  GstMIOVideoSrc *self = GST_MIO_VIDEO_SRC (instance);
  CMFormatDescriptionRef format_desc;

  GST_DEBUG_OBJECT (self, "%s: ensure_only=%d", G_STRFUNC, ensure_only);

  if (ensure_only)
    return NULL;

  g_assert (self->device != NULL);
  format_desc = gst_mio_video_device_get_selected_format (self->device);
  g_assert (format_desc != NULL);

  return CFArrayCreate (kCFAllocatorDefault, (const void **) &format_desc, 1,
      &kCFTypeArrayCallBacks);
}
开发者ID:collects,项目名称:gst-plugins-bad,代码行数:19,代码来源:miovideosrc.c

示例15: match_fonts

static void match_fonts(ASS_Library *lib, ASS_FontProvider *provider,
                        char *name)
{
    const size_t attributes_n = 3;
    CTFontDescriptorRef ctdescrs[attributes_n];
    CFMutableDictionaryRef cfattrs[attributes_n];
    CFStringRef attributes[attributes_n] = {
        kCTFontFamilyNameAttribute,
        kCTFontDisplayNameAttribute,
        kCTFontNameAttribute,
    };

    CFStringRef cfname =
        CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);

    for (int i = 0; i < attributes_n; i++) {
        cfattrs[i] = CFDictionaryCreateMutable(NULL, 0, 0, 0);
        CFDictionaryAddValue(cfattrs[i], attributes[i], cfname);
        ctdescrs[i] = CTFontDescriptorCreateWithAttributes(cfattrs[i]);
    }

    CFArrayRef descriptors =
        CFArrayCreate(NULL, (const void **)&ctdescrs, attributes_n, NULL);

    CTFontCollectionRef ctcoll =
        CTFontCollectionCreateWithFontDescriptors(descriptors, 0);

    CFArrayRef fontsd =
        CTFontCollectionCreateMatchingFontDescriptors(ctcoll);

    process_descriptors(provider, fontsd);

    SAFE_CFRelease(fontsd);
    SAFE_CFRelease(ctcoll);

    for (int i = 0; i < attributes_n; i++) {
        SAFE_CFRelease(cfattrs[i]);
        SAFE_CFRelease(ctdescrs[i]);
    }

    SAFE_CFRelease(descriptors);
    SAFE_CFRelease(cfname);
}
开发者ID:DiamondStudio,项目名称:libass,代码行数:43,代码来源:ass_coretext.c


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