您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CFDictionaryCreate函数代码示例

51自学网 2021-06-01 19:58:37
  C++
这篇教程C++ CFDictionaryCreate函数代码示例写得很实用,希望能帮到您。

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

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

示例1: setCookies

void setCookies(const KURL& url, const KURL& policyURL, const String& value){#if USE(CFNETWORK)    if (!ResourceHandle::cookieStorage())        return;    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());    RetainPtr<CFURLRef> policyURLCF(AdoptCF, policyURL.createCFURL());    // <http://bugzilla.opendarwin.org/show_bug.cgi?id=6531>, <rdar://4409034>    // cookiesWithResponseHeaderFields doesn't parse cookies without a value    String cookieString = value.contains('=') ? value : value + "=";    RetainPtr<CFStringRef> cookieStringCF(AdoptCF, cookieString.createCFString());    RetainPtr<CFDictionaryRef> headerFieldsCF(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault, (const void**)&s_setCookieKeyCF,         (const void**)&cookieStringCF, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,        headerFieldsCF.get(), urlCF.get()));    CFHTTPCookieStorageSetCookies(ResourceHandle::cookieStorage(), cookiesCF.get(), urlCF.get(), policyURLCF.get());#else    // FIXME: Deal with the policy URL.    DeprecatedString str = url.url();    str.append((UChar)'/0');    DeprecatedString val = value.deprecatedString();    val.append((UChar)'/0');    InternetSetCookie((UChar*)str.unicode(), 0, (UChar*)val.unicode());#endif}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:30,


示例2: _CFErrorFromStreamError

CF_PRIVATE CFErrorRef _CFErrorFromStreamError(CFAllocatorRef alloc, CFStreamError *streamError) {    CFErrorRef result;    Boolean canUpCall;        __CFLock(&(CFNetworkSupport.lock));    if (!__CFBitIsSet(CFNetworkSupport.flags, kTriedToLoad)) initializeCFNetworkSupport();    canUpCall = (CFNetworkSupport._CFErrorCreateWithStreamError != NULL);    __CFUnlock(&(CFNetworkSupport.lock));    if (canUpCall) {        result = CFNETWORK_CALL(_CFErrorCreateWithStreamError, (alloc, streamError));    } else {        if (streamError->domain == kCFStreamErrorDomainPOSIX) {            return CFErrorCreate(alloc, kCFErrorDomainPOSIX, streamError->error, NULL);        } else if (streamError->domain == kCFStreamErrorDomainMacOSStatus) {            return CFErrorCreate(alloc, kCFErrorDomainOSStatus, streamError->error, NULL);        } else {            CFStringRef key = CFSTR("CFStreamErrorDomainKey");            CFNumberRef value = CFNumberCreate(alloc, kCFNumberCFIndexType, &streamError->domain);            CFDictionaryRef dict = CFDictionaryCreate(alloc, (const void **)(&key), (const void **)(&value), 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);            result = CFErrorCreate(alloc, CFSTR("BogusCFStreamErrorCompatibilityDomain"), streamError->error, dict);            CFRelease(value);            CFRelease(dict);        }    }    return result;}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:27,


示例3: SendSkypeCommand

void SendSkypeCommand(CFStringRef command){	if (delegate == NULL)	{		printf("Can't send message, no delegate set/n");		return;	}	if (command == NULL)		return;	if (!client_id)	{		printf("Can't send message, not connected/n");		return;	}	CFRetain(command);	CFNumberRef id_number = CFNumberCreate(NULL, kCFNumberIntType, &client_id);	CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();	const void *keys[] = {(void *)CFSTR("SKYPE_API_COMMAND"), (void *)CFSTR("SKYPE_API_CLIENT_ID")};	const void *values[] = {command, id_number};	CFDictionaryRef userInfo = CFDictionaryCreate(NULL, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);			//send message	CFNotificationCenterPostNotification(		center,		CFSTR("SKSkypeAPICommand"),		NULL,		userInfo,		FALSE);		CFRelease(command);	CFRelease(id_number);	CFRelease(userInfo);}
开发者ID:dndump,项目名称:XboxLivePlugin,代码行数:35,


示例4: CFDictionaryCreate

boolOSXKeyState::getGroups(GroupList& groups) const{	CFIndex n;	bool gotLayouts = false;	// get number of layouts	CFStringRef keys[] = { kTISPropertyInputSourceCategory };	CFStringRef values[] = { kTISCategoryKeyboardInputSource };	CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 1, NULL, NULL);	CFArrayRef kbds = TISCreateInputSourceList(dict, false);	n = CFArrayGetCount(kbds);	gotLayouts = (n != 0);	if (!gotLayouts) {		LOG((CLOG_DEBUG1 "can't get keyboard layouts"));		return false;	}	// get each layout	groups.clear();	for (CFIndex i = 0; i < n; ++i) {		bool addToGroups = true;		TISInputSourceRef keyboardLayout = 			(TISInputSourceRef)CFArrayGetValueAtIndex(kbds, i);		if (addToGroups)    		groups.push_back(keyboardLayout);	}	return true;}
开发者ID:abner-ma,项目名称:synergy,代码行数:31,


示例5: __JSONParserAppendMapEnd

inline int __JSONParserAppendMapEnd(void *context) {  int success = 0;  __JSONRef json = (__JSONRef)context;  __JSONStackEntryRef entry = __JSONStackPop(json->stack);  if (entry) {    if (entry->keysIndex == entry->valuesIndex) {      CFTypeRef *keys = __JSONStackEntryCreateKeys(entry, json->elements);      if (keys) {        CFTypeRef *values = __JSONStackEntryCreateValues(entry, json->elements);        if (values) {          json->elements[entry->index] = CFDictionaryCreate(json->allocator, keys, values, entry->keysIndex, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);          CFAllocatorDeallocate(entry->allocator, values);          success = 1;        }        CFAllocatorDeallocate(entry->allocator, keys);      }    } else {      // TODO: The number of keys and values does not match    }    __JSONStackEntryRelease(entry);  } else {    // TODO: Container on the stack can't be NULL (too deep?)  }  return success;}
开发者ID:childhood,项目名称:CoreJSON,代码行数:25,


示例6: GTMCFLaunchCreateUnlocalizedError

static CFErrorRef GTMCFLaunchCreateUnlocalizedError(CFIndex code,                                                    CFStringRef format, ...) {  CFDictionaryRef user_info = NULL;  if (format) {    va_list args;    va_start(args, format);    CFStringRef string      = CFStringCreateWithFormatAndArguments(kCFAllocatorDefault,                                             NULL,                                             format,                                             args);    user_info = CFDictionaryCreate(kCFAllocatorDefault,                                   (const void **)&kCFErrorDescriptionKey,                                   (const void **)&string,                                   1,                                   &kCFTypeDictionaryKeyCallBacks,                                   &kCFTypeDictionaryValueCallBacks);    CFRelease(string);    va_end(args);  }  CFErrorRef error = CFErrorCreate(kCFAllocatorDefault,                                   kCFErrorDomainPOSIX,                                   code,                                   user_info);  if (user_info) {    CFRelease(user_info);  }  return error;}
开发者ID:shevc07,项目名称:google-toolbox-for-mac,代码行数:29,


示例7: CFNetworkCopyProxiesForURL

CFArrayRef CFNetworkCopyProxiesForURL(CFURLRef url, CFDictionaryRef proxySettings) {    CFDictionaryRef noSettings = CFDictionaryCreate(NULL,        (CFTypeRef*)&kCFProxyTypeKey, (CFTypeRef*)&kCFProxyTypeNone, 1,        &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFArrayRef proxies = CFArrayCreate(NULL, (CFTypeRef*)&noSettings, 1, &kCFTypeArrayCallBacks);    CFRelease(noSettings);    return proxies;}
开发者ID:Gamecharger,项目名称:Foundation,代码行数:8,


示例8: createPixelBufferOptionsDictionary

static CFDictionaryRef createPixelBufferOptionsDictionary(QTPixelBuffer::Type contextType){    const void* key = kQTVisualContextPixelBufferAttributesKey;    const void* value = QTPixelBuffer::createPixelBufferAttributesDictionary(contextType);    CFDictionaryRef pixelBufferOptions = CFDictionaryCreate(kCFAllocatorDefault, &key, &value, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFRelease(value);    return pixelBufferOptions;}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:8,


示例9: IPv6ConfigDictCreate

static CFDictionaryRefIPv6ConfigDictCreate(const char * ifname, 		     int argc, char * argv[], const char * cmd,		     const char * method_name,		     CFStringRef config_method){    CFDictionaryRef		dict;    CFMutableDictionaryRef	ipv6_dict;    CFStringRef			ipv6_key;    ipv6_dict = CFDictionaryCreateMutable(NULL, 0,					  &kCFTypeDictionaryKeyCallBacks,					  &kCFTypeDictionaryValueCallBacks);    CFDictionarySetValue(ipv6_dict, kSCPropNetIPv6ConfigMethod,			 config_method);    if (config_method == kSCValNetIPv6ConfigMethodManual) {	struct in6_addr		ip_address;	int			prefix_length;	if (argc != 2) {	    fprintf(stderr, "usage: ipconfig %s %s "		    "%s6 <ipv6-address> <prefix-length>/n", 		    cmd, ifname, method_name);	    goto failed;	}	if (inet_pton(AF_INET6, argv[0], &ip_address) != 1) {	    fprintf(stderr, "Invalid IPv6 address %s/n", argv[0]);	    goto failed;	}	my_CFDictionarySetIPv6AddressAsArrayValue(ipv6_dict,						  kSCPropNetIPv6Addresses,						  &ip_address);	prefix_length = (int)strtol(argv[1], NULL, 0);	if (prefix_length < 0 || prefix_length > 128) {	    fprintf(stderr, "Invalid prefix_length %s/n", argv[1]);	    goto failed;	}	my_CFDictionarySetIntegerAsArrayValue(ipv6_dict,					      kSCPropNetIPv6PrefixLength,					      prefix_length);    }    else if (argc != 0) {	fprintf(stderr, "too many arguments for method/n");	goto failed;    }    ipv6_key = kSCEntNetIPv6;    dict = CFDictionaryCreate(NULL,			      (const void * *)&ipv6_key,			      (const void * *)&ipv6_dict, 1,			      &kCFTypeDictionaryKeyCallBacks,			      &kCFTypeDictionaryValueCallBacks);    CFRelease(ipv6_dict);    return (dict); failed:    my_CFRelease(&ipv6_dict);    return (NULL);}
开发者ID:aosm,项目名称:bootp,代码行数:58,


示例10: createImageSourceOptions

static RetainPtr<CFDictionaryRef> createImageSourceOptions(SubsamplingLevel subsamplingLevel){    if (!subsamplingLevel) {        const unsigned numOptions = 3;        const void* keys[numOptions] = { kCGImageSourceShouldCache, kCGImageSourceShouldPreferRGB32, kCGImageSourceSkipMetadata };        const void* values[numOptions] = { kCFBooleanTrue, kCFBooleanTrue, kCFBooleanTrue };        return CFDictionaryCreate(nullptr, keys, values, numOptions, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    }    short constrainedSubsamplingLevel = std::min<short>(3, std::max<short>(0, subsamplingLevel));    int subsampleInt = 1 << constrainedSubsamplingLevel; // [0..3] => [1, 2, 4, 8]    RetainPtr<CFNumberRef> subsampleNumber = adoptCF(CFNumberCreate(nullptr,  kCFNumberIntType,  &subsampleInt));    const CFIndex numOptions = 4;    const void* keys[numOptions] = { kCGImageSourceShouldCache, kCGImageSourceShouldPreferRGB32, kCGImageSourceSkipMetadata, kCGImageSourceSubsampleFactor };    const void* values[numOptions] = { kCFBooleanTrue, kCFBooleanTrue, kCFBooleanTrue, subsampleNumber.get() };    return adoptCF(CFDictionaryCreate(nullptr, keys, values, numOptions, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));}
开发者ID:houzhenggang,项目名称:webkit,代码行数:18,


示例11: CFDataCreate

CFDictionaryRefAppleVTDecoder::CreateDecoderExtensions(){  AutoCFRelease<CFDataRef> avc_data =    CFDataCreate(kCFAllocatorDefault,                 mExtraData->Elements(),                 mExtraData->Length());  const void* atomsKey[] = { CFSTR("avcC") };  const void* atomsValue[] = { avc_data };  static_assert(ArrayLength(atomsKey) == ArrayLength(atomsValue),                "Non matching keys/values array size");  AutoCFRelease<CFDictionaryRef> atoms =    CFDictionaryCreate(kCFAllocatorDefault,                       atomsKey,                       atomsValue,                       ArrayLength(atomsKey),                       &kCFTypeDictionaryKeyCallBacks,                       &kCFTypeDictionaryValueCallBacks);  const void* extensionKeys[] =    { kCVImageBufferChromaLocationBottomFieldKey,      kCVImageBufferChromaLocationTopFieldKey,      AppleCMLinker::skPropExtensionAtoms,      AppleCMLinker::skPropFullRangeVideo /* Not defined in 10.6 */ };  const void* extensionValues[] =    { kCVImageBufferChromaLocation_Left,      kCVImageBufferChromaLocation_Left,      atoms,      kCFBooleanTrue };  static_assert(ArrayLength(extensionKeys) == ArrayLength(extensionValues),                "Non matching keys/values array size");  return CFDictionaryCreate(kCFAllocatorDefault,                            extensionKeys,                            extensionValues,                            AppleCMLinker::skPropFullRangeVideo ?                              ArrayLength(extensionKeys) :                              ArrayLength(extensionKeys) - 1,                            &kCFTypeDictionaryKeyCallBacks,                            &kCFTypeDictionaryValueCallBacks);}
开发者ID:rhelmer,项目名称:gecko-dev,代码行数:44,


示例12: CFQDictionaryCreateWithArrayOfKeysAndValues

extern pascal OSStatus CFQDictionaryCreateWithArrayOfKeysAndValues(CFArrayRef keys, 																   CFArrayRef values, 																   CFDictionaryRef *result)	// See comment in header.{	OSStatus    err;	CFIndex 	count;	CFTypeRef * keysBuffer;	CFTypeRef * valuesBuffer;		assert(keys != NULL);	assert(values != NULL);	assert( CFArrayGetCount(keys) == CFArrayGetCount(values) );	assert( result != NULL);	assert(*result == NULL);		keysBuffer   = NULL;	valuesBuffer = NULL;	// Check that the arrays are of a like size.			err = noErr;	count = CFArrayGetCount(keys);	if ( count != CFArrayGetCount(values) ) {		err = paramErr;	}		// Allocate a buffer for both keys and values.		if (err == noErr) {		err = CFQAllocate(sizeof(CFTypeRef) * count, (void **) &keysBuffer);	}	if (err == noErr) {		err = CFQAllocate(sizeof(CFTypeRef) * count, (void **) &valuesBuffer);	}		// Get the keys and values into their buffers, and create a 	// dictionary based on the buffer.		if (err == noErr) {		CFArrayGetValues(keys,   CFRangeMake(0, count), keysBuffer);		CFArrayGetValues(values, CFRangeMake(0, count), valuesBuffer);				*result = CFDictionaryCreate(NULL, keysBuffer, valuesBuffer, count, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);		if (*result == NULL) {			err = coreFoundationUnknownErr;		}	}		// Clean up.		CFQDeallocate(keysBuffer);	CFQDeallocate(valuesBuffer);		return err;}
开发者ID:paullalonde,项目名称:B,代码行数:56,


示例13: AddIdentityToKeychain

/* Create and identity and try to retrieve it. */static void AddIdentityToKeychain(void){    SecCertificateRef cert = NULL;    SecKeyRef privKey = NULL;    //SecIdentityRef identity = NULL;    isnt(cert = SecCertificateCreateWithBytes(NULL, _c1, sizeof(_c1)),            NULL, "create certificate");#if TARGET_OS_IPHONE    privKey = SecKeyCreateRSAPrivateKey(NULL, _k1, sizeof(_k1),                                        kSecKeyEncodingPkcs1);#else#warning TODO    privKey = NULL;#endif    isnt(privKey, NULL, "create private key");    const void *certkeys[] = {        kSecValueRef    };    const void *certvalues[] = {        cert    };    CFDictionaryRef certDict = CFDictionaryCreate(NULL, certkeys, certvalues,            array_size(certkeys), NULL, NULL);    ok_status(SecItemAdd(certDict, NULL), "add certificate");    CFReleaseNull(certDict);    CFReleaseNull(cert);    const void *privkeys[] = {        kSecValueRef    };    const void *privvalues[] = {        privKey    };    CFDictionaryRef privDict = CFDictionaryCreate(NULL, privkeys, privvalues,            array_size(privkeys), NULL, NULL);    ok_status(SecItemAdd(privDict, NULL), "add private key");    CFReleaseNull(privDict);    CFReleaseNull(privKey);}
开发者ID:darlinghq,项目名称:darling-security,代码行数:44,


示例14: _CFErrorCreateEmptyDictionary

/* Returns a shared empty dictionary (unless the allocator is not kCFAllocatorSystemDefault, in which case returns a newly allocated one).*/static CFDictionaryRef _CFErrorCreateEmptyDictionary(CFAllocatorRef allocator) {    if (allocator == NULL) allocator = __CFGetDefaultAllocator();    if (_CFAllocatorIsSystemDefault(allocator)) {        static CFDictionaryRef emptyErrorDictionary = NULL;        static dispatch_once_t onceToken;        dispatch_once(&onceToken, ^{            emptyErrorDictionary = CFDictionaryCreate(allocator, NULL, NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);        });        return (CFDictionaryRef)CFRetain(emptyErrorDictionary);    } else {
开发者ID:JGiola,项目名称:swift-corelibs-foundation,代码行数:12,


示例15: SDMMD__CreateTemporaryServConn

SDMMD_AMConnectionRef SDMMD__CreateTemporaryServConn(uint32_t socket, SSL *ssl) {	SDMMD_AMConnectionRef handle = NULL;	CFStringRef closeInvalid = CFSTR("CloseOnInvalidate");	CFDictionaryRef dict = CFDictionaryCreate(kCFAllocatorDefault, (const void**)&closeInvalid, (const void**)&kCFBooleanFalse, 0x1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	if (dict) {		handle = SDMMD_AMDServiceConnectionCreate(socket, ssl, dict);		CFSafeRelease(dict);	}	return handle;}
开发者ID:bigfei,项目名称:SDMMobileDevice,代码行数:10,


示例16: main

int main(){    IOReturn            ret = 0;    IOPMAssertionID     _id = 0;    CFDictionaryRef     _props = 0;    CFStringRef         keys[10];    CFTypeRef           vals[10];    int                 val = 0;        ret = PMTestInitialize("PMAssertions", "com.apple.iokit.powertesting");    if(kIOReturnSuccess != ret)    {        fprintf(stderr,"PMTestInitialize failed with IOReturn error code 0x%08x/n", ret);        exit(-1);    }            keys[0] =       kIOPMAssertionTypeKey;    vals[0] =       kIOPMAssertionTypePreventUserIdleSystemSleep;        keys[1] =       kIOPMAssertionHumanReadableReasonKey;    vals[1] =       CFSTR("I did this because I had to.");        val =           500; // seconds    keys[2] =       kIOPMAssertionTimeoutKey;    vals[2] =       CFNumberCreate(0, kCFNumberIntType, &val);        keys[3] =       kIOPMAssertionLocalizationBundlePathKey;    vals[3] =       CFSTR("/System/Library/CoreServices/powerd.bundle");        _props = CFDictionaryCreate(0, (const void **)keys, (const void **)vals, 4,                                 &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);        ret = IOPMAssertionCreateWithProperties(_props, &_id);        CFRelease(_props);    CFRelease(vals[0]);    CFRelease(vals[2]);    if (kIOReturnSuccess != ret) {        PMTestFail("IOPMAssertionCreateWithProperties returns non-success 0x%08x/n", ret);        exit(1);    }    ret = IOPMAssertionRelease(_id);        if (kIOReturnSuccess != ret) {        PMTestFail("IOPMAssertionRelease returns non-success 0x%08x/n", ret);        exit(1);    }        PMTestPass("Successfully created and released via IOPMAssertionCrateWithProperties/n");        return 0;}
开发者ID:hashier,项目名称:caffeinate_fix,代码行数:55,


示例17: createConnectionProperties

static CFDictionaryRef createConnectionProperties(bool shouldUseCredentialStorage, CFDictionaryRef clientProperties){    static const CFStringRef webKitPrivateSessionCF = CFSTR("WebKitPrivateSession");    static const CFStringRef _kCFURLConnectionSessionID = CFSTR("_kCFURLConnectionSessionID");    static const CFStringRef kCFURLConnectionSocketStreamProperties = CFSTR("kCFURLConnectionSocketStreamProperties");    CFDictionaryRef sessionID = shouldUseCredentialStorage ?        CFDictionaryCreate(0, 0, 0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) :        CFDictionaryCreate(0, (const void**)&_kCFURLConnectionSessionID, (const void**)&webKitPrivateSessionCF, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFMutableDictionaryRef propertiesDictionary;    if (clientProperties)        propertiesDictionary = CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, clientProperties);    else        propertiesDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFDictionaryAddValue(propertiesDictionary, (const void*)kCFURLConnectionSocketStreamProperties, (const void*)sessionID);    CFRelease(sessionID);    return propertiesDictionary;}
开发者ID:sanyaade-mobiledev,项目名称:Webkit-Projects,代码行数:20,


示例18: _CFErrorCreateEmptyDictionary

/* Returns a shared empty dictionary (unless the allocator is not kCFAllocatorSystemDefault, in which case returns a newly allocated one).*/static CFDictionaryRef _CFErrorCreateEmptyDictionary(CFAllocatorRef allocator) {    if (allocator == NULL) allocator = __CFGetDefaultAllocator();    if (_CFAllocatorIsSystemDefault(allocator)) {        static CFDictionaryRef emptyErrorDictionary = NULL;        if (emptyErrorDictionary == NULL) {            CFDictionaryRef tmp = CFDictionaryCreate(allocator, NULL, NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);            __CFSpinLock(&_CFErrorSpinlock);            if (emptyErrorDictionary == NULL) {                emptyErrorDictionary = tmp;                __CFSpinUnlock(&_CFErrorSpinlock);            } else {                __CFSpinUnlock(&_CFErrorSpinlock);                CFRelease(tmp);            }        }        return (CFDictionaryRef)CFRetain(emptyErrorDictionary);    } else {        return CFDictionaryCreate(allocator, NULL, NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    }}
开发者ID:cooljeanius,项目名称:opencflite-code,代码行数:22,


示例19: fprintf

OSStatusMoonVDADecoder::CreateDecoder (SInt32 inHeight, SInt32 inWidth, OSType inSourceFormat, CFDataRef inAVCCData){	OSStatus status;	CFMutableDictionaryRef decoderConfiguration = NULL;	CFMutableDictionaryRef destinationImageBufferAttributes = NULL;	CFDictionaryRef emptyDictionary;	CFNumberRef height = NULL;	CFNumberRef width= NULL;	CFNumberRef sourceFormat = NULL;	CFNumberRef pixelFormat = NULL;	// source must be H.264	if (inSourceFormat != 'avc1') {		fprintf (stderr, "Source format is not H.264!/n");		return paramErr;	}	// the avcC data chunk from the bitstream must be present	if (inAVCCData == NULL) {		fprintf (stderr, "avc1 decoder configuration data cannot be NULL!/n");		return paramErr;	}	decoderConfiguration = CFDictionaryCreateMutable (kCFAllocatorDefault, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	height = CFNumberCreate (kCFAllocatorDefault, kCFNumberSInt32Type, &inHeight);	width = CFNumberCreate (kCFAllocatorDefault, kCFNumberSInt32Type, &inWidth);	sourceFormat = CFNumberCreate (kCFAllocatorDefault, kCFNumberSInt32Type, &inSourceFormat);	CFDictionarySetValue (decoderConfiguration, kVDADecoderConfiguration_Height, height);	CFDictionarySetValue (decoderConfiguration, kVDADecoderConfiguration_Width, width);	CFDictionarySetValue (decoderConfiguration, kVDADecoderConfiguration_SourceFormat, sourceFormat);	CFDictionarySetValue (decoderConfiguration, kVDADecoderConfiguration_avcCData, inAVCCData);	destinationImageBufferAttributes = CFDictionaryCreateMutable (kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	OSType cvPixelFormatType = kCVPixelFormatType_422YpCbCr8;	pixelFormat = CFNumberCreate (kCFAllocatorDefault, kCFNumberSInt32Type, &cvPixelFormatType);	emptyDictionary = CFDictionaryCreate (kCFAllocatorDefault, NULL, NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	CFDictionarySetValue (destinationImageBufferAttributes, kCVPixelBufferPixelFormatTypeKey, pixelFormat);	CFDictionarySetValue (destinationImageBufferAttributes, kCVPixelBufferIOSurfacePropertiesKey, emptyDictionary);	status = VDADecoderCreate (decoderConfiguration, destinationImageBufferAttributes, (VDADecoderOutputCallback*) VDADecoderCallback, this, (VDADecoder*) &decoder);	if (decoderConfiguration) CFRelease (decoderConfiguration);	if (destinationImageBufferAttributes) CFRelease (destinationImageBufferAttributes);	if (emptyDictionary) CFRelease (emptyDictionary);	return status;}
开发者ID:499940913,项目名称:moon,代码行数:54,


示例20: OSX_Mouse_Thread

static int OSX_Mouse_Thread(void *ctx){	if (!ctx)		return 0;	struct osx_mouse_data *mdata = static_cast<struct osx_mouse_data *>(ctx);		IOHIDManagerRef hid_manager = IOHIDManagerCreate(kCFAllocatorSystemDefault, kIOHIDOptionsTypeNone);	if (!hid_manager) {		SDL_DestroyMutex(mdata->mouse_mutex);		delete mdata;		return 0;	}		if (IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone) != kIOReturnSuccess) {		CFRelease(hid_manager);		SDL_DestroyMutex(mdata->mouse_mutex);		delete mdata;		return 0;	}		IOHIDManagerRegisterInputValueCallback(hid_manager, input_callback, mdata);	IOHIDManagerScheduleWithRunLoop(hid_manager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);			uint32_t page = kHIDPage_GenericDesktop;	uint32_t usage = kHIDUsage_GD_Mouse;	CFDictionaryRef dict = NULL;	CFNumberRef pageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);	CFNumberRef usageNumRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);	const void *keys[2] = { CFSTR(kIOHIDDeviceUsagePageKey), CFSTR(kIOHIDDeviceUsageKey) };	const void *vals[2] = { pageNumRef, usageNumRef };	if (pageNumRef && usageNumRef)		dict = CFDictionaryCreate(kCFAllocatorDefault, keys, vals, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	if (pageNumRef)		CFRelease(pageNumRef);	if (usageNumRef)		CFRelease(usageNumRef);	IOHIDManagerSetDeviceMatching(hid_manager, dict);	if (dict)		CFRelease(dict);	while (!mdata->should_exit) {		CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, false);	}	IOHIDManagerUnscheduleFromRunLoop(hid_manager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);	IOHIDManagerClose(hid_manager, kIOHIDOptionsTypeNone);		CFRelease(hid_manager);	SDL_DestroyMutex(mdata->mouse_mutex);	delete mdata;	return 0;}
开发者ID:blezek,项目名称:marathon-ios,代码行数:53,


示例21: CFErrorCreateWithUserInfoKeysAndValues

/* Note that there are two entry points for creating CFErrors. This one does it with individual keys and values which are used to create the userInfo dictionary.*/CFErrorRef CFErrorCreateWithUserInfoKeysAndValues(CFAllocatorRef allocator, CFStringRef domain, CFIndex code, const void *const *userInfoKeys, const void *const *userInfoValues, CFIndex numUserInfoValues) {    __CFGenericValidateType(domain, CFStringGetTypeID());    CFErrorRef err = (CFErrorRef)_CFRuntimeCreateInstance(allocator, __kCFErrorTypeID, sizeof(struct __CFError) - sizeof(CFRuntimeBase), NULL);    if (NULL == err) return NULL;    err->domain = CFStringCreateCopy(allocator, domain);    err->code = code;    err->userInfo = CFDictionaryCreate(allocator, (const void **)userInfoKeys, (const void **)userInfoValues, numUserInfoValues, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    return err;}
开发者ID:cooljeanius,项目名称:opencflite-code,代码行数:14,


示例22: static_assert

CFDictionaryRefAppleVDADecoder::CreateOutputConfiguration(){  // Construct IOSurface Properties  const void* IOSurfaceKeys[] = { MacIOSurfaceLib::kPropIsGlobal };  const void* IOSurfaceValues[] = { kCFBooleanTrue };  static_assert(ArrayLength(IOSurfaceKeys) == ArrayLength(IOSurfaceValues),                "Non matching keys/values array size");  // Contruct output configuration.  AutoCFRelease<CFDictionaryRef> IOSurfaceProperties =    CFDictionaryCreate(kCFAllocatorDefault,                       IOSurfaceKeys,                       IOSurfaceValues,                       ArrayLength(IOSurfaceKeys),                       &kCFTypeDictionaryKeyCallBacks,                       &kCFTypeDictionaryValueCallBacks);  SInt32 PixelFormatTypeValue = kCVPixelFormatType_32BGRA;  AutoCFRelease<CFNumberRef> PixelFormatTypeNumber =    CFNumberCreate(kCFAllocatorDefault,                   kCFNumberSInt32Type,                   &PixelFormatTypeValue);  const void* outputKeys[] = { kCVPixelBufferIOSurfacePropertiesKey,                               kCVPixelBufferPixelFormatTypeKey,                               kCVPixelBufferOpenGLCompatibilityKey };  const void* outputValues[] = { IOSurfaceProperties,                                 PixelFormatTypeNumber,                                 kCFBooleanTrue };  static_assert(ArrayLength(outputKeys) == ArrayLength(outputValues),                "Non matching keys/values array size");  return CFDictionaryCreate(kCFAllocatorDefault,                            outputKeys,                            outputValues,                            ArrayLength(outputKeys),                            &kCFTypeDictionaryKeyCallBacks,                            &kCFTypeDictionaryValueCallBacks);}
开发者ID:alexey-kalashnikov,项目名称:gecko-dev,代码行数:40,


示例23: vda_dictionary_with_pts

/* Helper to create a dictionary according to the given pts. */static CFDictionaryRef vda_dictionary_with_pts(int64_t i_pts){    CFStringRef key = CFSTR("FF_VDA_DECODER_PTS_KEY");    CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &i_pts);    CFDictionaryRef user_info = CFDictionaryCreate(kCFAllocatorDefault,                                                   (const void **)&key,                                                   (const void **)&value,                                                   1,                                                   &kCFTypeDictionaryKeyCallBacks,                                                   &kCFTypeDictionaryValueCallBacks);    CFRelease(value);    return user_info;}
开发者ID:KindDragon,项目名称:FFmpeg,代码行数:14,


示例24: makeCFDictionary

//// Make CFDictionaries from stuff//CFDictionaryRef makeCFDictionary(unsigned count, ...){	CFTypeRef keys[count], values[count];	va_list args;	va_start(args, count);	for (unsigned n = 0; n < count; n++) {		keys[n] = va_arg(args, CFTypeRef);		values[n] = va_arg(args, CFTypeRef);	}	va_end(args);	return CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, count,		&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);}
开发者ID:Proteas,项目名称:codesign,代码行数:16,



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


C++ CFDictionaryCreateMutableCopy函数代码示例
C++ CFDictionaryAddValue函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。