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

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

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

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

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

示例1: download_file

CFDictionaryRef download_file(int socket, CFDictionaryRef dict){    UInt8 buffer[8192];    CFIndex bytesRead;    CFStringRef path = CFDictionaryGetValue(dict, CFSTR("Path"));    if(path == NULL || CFGetTypeID(path) != CFStringGetTypeID())        return NULL;    CFMutableDictionaryRef out  = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	    CFURLRef fileURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path, kCFURLPOSIXPathStyle, FALSE);    CFReadStreamRef stream = CFReadStreamCreateWithFile(kCFAllocatorDefault, fileURL);    CFRelease(fileURL);    if(!CFReadStreamOpen(stream))    {        CFErrorRef error = CFReadStreamCopyError(stream);        if (error != NULL)        {            CFStringRef errorDesc = CFErrorCopyDescription(error);            CFDictionaryAddValue(out, CFSTR("Error"), errorDesc);            CFRelease(errorDesc);            CFRelease(error);        }        CFRelease(stream);        return out;    }    CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0);    while(CFReadStreamHasBytesAvailable(stream))    {        if((bytesRead = CFReadStreamRead(stream, buffer, 8192)) <= 0)            break;        CFDataAppendBytes(data, buffer, bytesRead);    }    CFReadStreamClose(stream);    CFRelease(stream);    CFDictionaryAddValue(out, CFSTR("Data"), data);    CFRelease(data);    return out;}
开发者ID:0bj3ct1veC,项目名称:iphone-dataprotection,代码行数:42,


示例2: _CFNetDiagnosticSetDictionaryKeyAndReleaseIfNotNull

staticvoid _CFNetDiagnosticSetDictionaryKeyAndReleaseIfNotNull(	CFStringRef key,															CFTypeRef value,															CFMutableDictionaryRef dict) {	if(key != NULL) {		if(value != NULL) {			CFDictionaryAddValue(dict, key, value);			CFRelease(value);		}	}}
开发者ID:annp,项目名称:CFNetwork,代码行数:11,


示例3: addIntArray

void addIntArray(CFMutableDictionaryRef dest, CFStringRef key, UInt8 *Value, SInt64 num){    SInt64 i = 0;    CFMutableStringRef strValue = CFStringCreateMutable (kCFAllocatorDefault, 0);    for (i = 0; i < num; i++) {        CFStringAppendFormat(strValue, NULL, CFSTR("%02x"), Value[i]);    }    CFDictionaryAddValue( dest, key, strValue );    CFRelease(strValue);}
开发者ID:huaqli,项目名称:clover,代码行数:11,


示例4: addUString

void addUString(CFMutableDictionaryRef dest, CFStringRef key, const UniChar* value){  if (!value) {    return;  }    assert(dest);    CFStringRef strValue = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%S"), value);    assert(strValue);    CFDictionaryAddValue( dest, key, strValue );    CFRelease(strValue);}
开发者ID:huaqli,项目名称:clover,代码行数:11,


示例5: addNumberToDictionary

// Utility to add an SInt32 to a CFMutableDictionary.static voidaddNumberToDictionary(CFMutableDictionaryRef dictionary, CFStringRef key, SInt32 numberSInt32){  CFNumberRef number = CFNumberCreate(NULL, kCFNumberSInt32Type, &numberSInt32);  if (! number)    return;  CFDictionaryAddValue(dictionary, key, number);  CFRelease(number);}
开发者ID:NextGenIntelligence,项目名称:webmquicktime,代码行数:12,


示例6: addDoubleToDictionary

// Utility to add a double to a CFMutableDictionary.static voidaddDoubleToDictionary(CFMutableDictionaryRef dictionary, CFStringRef key, double numberDouble){  CFNumberRef number = CFNumberCreate(NULL, kCFNumberDoubleType, &numberDouble);  if (! number)    return;  CFDictionaryAddValue(dictionary, key, number);  CFRelease(number);}
开发者ID:NextGenIntelligence,项目名称:webmquicktime,代码行数:12,


示例7: GetMetadataForURL

Boolean GetMetadataForURL(void* thisInterface, 			   CFMutableDictionaryRef attributes, 			   CFStringRef contentTypeUTI,			   CFURLRef url){	CGDataProviderRef dataProvider = CGDataProviderCreateWithURL(url);	if (!dataProvider) return FALSE;	CFDataRef data = CGDataProviderCopyData(dataProvider);	CGDataProviderRelease(dataProvider);	if (!data) return FALSE;		const UInt8 *buf = CFDataGetBytePtr(data);	int *height= ((int*) buf) + 3;	int *width = ((int*) buf) + 4;	int *pflags= ((int*) buf) + 20;	CFStringRef format=NULL;	if ((*pflags)&DDPF_FOURCC)		format = CFStringCreateWithBytes(kCFAllocatorDefault, buf + 0x54, 4, kCFStringEncodingASCII, false);	else if ((*pflags)&DDPF_RGB)		format = (*pflags)&DDPF_ALPHAPIXELS ? CFSTR("RGBA") : CFSTR("RGB");	if (format)	{		CFArrayRef codecs = CFArrayCreate(kCFAllocatorDefault, (const void **) &format, 1, &kCFTypeArrayCallBacks);		CFDictionaryAddValue(attributes, kMDItemCodecs, codecs);		CFRelease(format);		CFRelease(codecs);	}		CFNumberRef cfheight = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, height);	CFDictionaryAddValue(attributes, kMDItemPixelHeight, cfheight);	CFRelease(cfheight);		CFNumberRef cfwidth = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, width);	CFDictionaryAddValue(attributes, kMDItemPixelWidth, cfwidth);	CFRelease(cfwidth);	CFRelease(data);    return TRUE;}
开发者ID:UIKit0,项目名称:QLdds,代码行数:41,


示例8: query

CFDictionaryRef PolicyEngine::find(CFTypeRef target, AuthorityType type, SecAssessmentFlags flags, CFDictionaryRef context){	SQLite::Statement query(*this);	selectRules(query, "SELECT scan_authority.id, scan_authority.type, scan_authority.requirement, scan_authority.allow, scan_authority.label, scan_authority.priority, scan_authority.remarks, scan_authority.expires, scan_authority.disabled, bookmarkhints.bookmark FROM scan_authority LEFT OUTER JOIN bookmarkhints ON scan_authority.id = bookmarkhints.authority",		"scan_authority", target, type, flags, context,		" ORDER BY priority DESC");	CFRef<CFMutableArrayRef> found = makeCFMutableArray(0);	while (query.nextRow()) {		SQLite::int64 id = query[0];		int type = int(query[1]);		const char *requirement = query[2];		int allow = int(query[3]);		const char *label = query[4];		double priority = query[5];		const char *remarks = query[6];		double expires = query[7];		int disabled = int(query[8]);		CFRef<CFDataRef> bookmark = query[9].data();		CFRef<CFMutableDictionaryRef> rule = makeCFMutableDictionary(5,			kSecAssessmentRuleKeyID, CFTempNumber(id).get(),			kSecAssessmentRuleKeyType, CFRef<CFStringRef>(typeNameFor(type)).get(),			kSecAssessmentRuleKeyRequirement, CFTempString(requirement).get(),			kSecAssessmentRuleKeyAllow, allow ? kCFBooleanTrue : kCFBooleanFalse,			kSecAssessmentRuleKeyPriority, CFTempNumber(priority).get()			);		if (label)			CFDictionaryAddValue(rule, kSecAssessmentRuleKeyLabel, CFTempString(label));		if (remarks)			CFDictionaryAddValue(rule, kSecAssessmentRuleKeyRemarks, CFTempString(remarks));		if (expires != never)			CFDictionaryAddValue(rule, kSecAssessmentRuleKeyExpires, CFRef<CFDateRef>(julianToDate(expires)));		if (disabled)			CFDictionaryAddValue(rule, kSecAssessmentRuleKeyDisabled, CFTempNumber(disabled));		if (bookmark)			CFDictionaryAddValue(rule, kSecAssessmentRuleKeyBookmark, bookmark);		CFArrayAppendValue(found, rule);	}	if (CFArrayGetCount(found) == 0)		MacOSError::throwMe(errSecCSNoMatches);	return cfmake<CFDictionaryRef>("{%O=%O}", kSecAssessmentUpdateKeyFound, found.get());}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:41,


示例9: SecTrustCopyProperties

CFArrayRef SecTrustCopyProperties(SecTrustRef trust) {    /* OS X creates a completely different structure with one dictionary for each certificate */    CFIndex ix, count = SecTrustGetCertificateCount(trust);    CFMutableArrayRef properties = CFArrayCreateMutable(kCFAllocatorDefault, count,                                                        &kCFTypeArrayCallBacks);    for (ix = 0; ix < count; ix++) {        CFMutableDictionaryRef certDict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks,                                                                    &kCFTypeDictionaryValueCallBacks);        /* Populate the certificate title */        SecCertificateRef cert = SecTrustGetCertificateAtIndex(trust, ix);        if (cert) {            CFStringRef subjectSummary = SecCertificateCopySubjectSummary(cert);            if (subjectSummary) {                CFDictionaryAddValue(certDict, kSecPropertyTypeTitle, subjectSummary);                CFRelease(subjectSummary);            }        }        /* Populate a revocation reason if the cert was revoked */        unsigned int numStatusCodes;        CSSM_RETURN *statusCodes = NULL;        statusCodes = copyCssmStatusCodes(trust, (uint32_t)ix, &numStatusCodes);        if (statusCodes) {            int32_t reason = statusCodes[numStatusCodes];  // stored at end of status codes array            if (reason > 0) {                CFNumberRef cfreason = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &reason);                if (cfreason) {                    CFDictionarySetValue(certDict, kSecTrustRevocationReason, cfreason);                    CFRelease(cfreason);                }            }            free(statusCodes);        }        /* Populate the error in the leaf dictionary */        if (ix == 0) {            OSStatus error = errSecSuccess;            (void)SecTrustGetCssmResultCode(trust, &error);            CFStringRef errorStr = SecCopyErrorMessageString(error, NULL);            if (errorStr) {                CFDictionarySetValue(certDict, kSecPropertyTypeError, errorStr);                CFRelease(errorStr);            }        }        CFArrayAppendValue(properties, certDict);        CFRelease(certDict);    }    return properties;}
开发者ID:darlinghq,项目名称:darling-security,代码行数:53,


示例10: createAudioTrackProperties

CFMutableDictionaryRef createAudioTrackProperties(uint32_t trackLength){	CFMutableDictionaryRef	properties = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	CFNumberRef				value;	uint32_t				temp;		/* Create a properties dictionary for all of the tracks. This dictionary	   is common to each since each will be an audio track and other than the size	   will be identical. */		temp = kDRBlockSizeAudio;	value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &temp);	CFDictionaryAddValue(properties, kDRBlockSizeKey, value);	CFRelease(value);	temp = kDRBlockTypeAudio;	value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &temp);	CFDictionaryAddValue(properties, kDRBlockTypeKey, value);	CFRelease(value);	temp = kDRDataFormAudio;	value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &temp);	CFDictionaryAddValue(properties, kDRDataFormKey, value);	CFRelease(value);	temp = kDRSessionFormatAudio;	value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &temp);	CFDictionaryAddValue(properties, kDRSessionFormatKey, value);	CFRelease(value);	temp = kDRTrackModeAudio;	value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &temp);	CFDictionaryAddValue(properties, kDRTrackModeKey, value);	CFRelease(value);	value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &trackLength);	CFDictionarySetValue(properties, kDRTrackLengthKey, value);	CFRelease(value);		return properties;}
开发者ID:fruitsamples,项目名称:audioburntest,代码行数:40,


示例11: mmc_scan_for_devices

int mmc_scan_for_devices(struct mmc_device *devices, int max_devices){    // Only look for removable media    CFMutableDictionaryRef toMatch =            CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFDictionaryAddValue(toMatch, kDADiskDescriptionMediaWholeKey, kCFBooleanTrue);    CFDictionaryAddValue(toMatch, kDADiskDescriptionMediaRemovableKey, kCFBooleanTrue);    struct scan_context context;    context.devices = devices;    context.max_devices = max_devices;    context.count = 0;    DARegisterDiskAppearedCallback(da_session, toMatch, scan_disk_appeared_cb, &context);    // Scan for removable media for 100 ms    // NOTE: It's not clear how long the event loop has to run. Ideally, it would    // terminate after all devices have been found, but I don't know how to do that.    run_loop_for_time(0.1);    return context.count;}
开发者ID:GregMefford,项目名称:fwup,代码行数:22,


示例12: addHex

void addHex(CFMutableDictionaryRef dest, CFStringRef key, UInt64 value){  CFStringRef strValue = NULL;  assert(dest);  if (value > 0xFFFF) {    strValue = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("0x%08llx"), value);  } else {    strValue = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("0x%04llx"), value);  }    assert(strValue);    CFDictionaryAddValue( dest, key, strValue );    CFRelease(strValue);}
开发者ID:huaqli,项目名称:clover,代码行数:14,


示例13: CFDictionaryCreateMutable

void	CarbonEventHandler::WantEventTypes(EventTargetRef target, UInt32 inNumTypes, const EventTypeSpec *inList){	if (mHandlers == NULL)		mHandlers = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);			EventHandlerRef handler;		if (CFDictionaryGetValueIfPresent (mHandlers, target, (const void **)&handler))	// if there is already a handler for the target, add the type		verify_noerr(AddEventTypesToHandler(handler, inNumTypes, inList));	else {		verify_noerr(InstallEventHandler(target, TheEventHandler, inNumTypes, inList, this, &handler));		CFDictionaryAddValue(mHandlers, target, handler);	}}
开发者ID:fruitsamples,项目名称:AudioUnits,代码行数:14,


示例14: OutMarkers

// output a packet and return its sequence numbervoid ARec::OutPacket(PhraseType k, string wrd, string tag,                     int pred, int alt, float ac, float lm, float score,                     float confidence, float nact, HTime start, HTime end){   OutMarkers(start);   ++outseqnum;   APhraseData *pd = (APhraseData *)new APhraseData(k,outseqnum,pred);   pd->alt = alt; pd->ac = ac; pd->lm = lm; pd->score = score;   pd->confidence = confidence;   pd->word = wrd;  pd->tag = tag; pd->nact = nact;   APacket p(pd);   p.SetStartTime(start); p.SetEndTime(end);   out->PutPacket(p);   if (showRD) DrawOutLine(k,start,wrd,tag);   if (trace&T_OUT) p.Show();	#ifdef __APPLE__	CFMutableDictionaryRef userInfo = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	CFNumberRef cfPhraseType = CFNumberCreate(NULL, kCFNumberIntType, &k);	CFDictionaryAddValue(userInfo, CFSTR("PhraseType"), cfPhraseType);	CFRelease(cfPhraseType);		CFStringRef cfWord = CFStringCreateWithCString(NULL, wrd.c_str(), kCFStringEncodingUTF8);	CFDictionaryAddValue(userInfo, CFSTR("Word"), cfWord);	CFRelease(cfWord);		CFStringRef cfTag = CFStringCreateWithCString(NULL, tag.c_str(), kCFStringEncodingUTF8);	CFDictionaryAddValue(userInfo, CFSTR("Tag"), cfTag);	CFRelease(cfTag);		CFNotificationCenterPostNotification(CFNotificationCenterGetLocalCenter(), CFSTR("ARec::OutPacket"), NULL, userInfo, false);		CFRelease(userInfo);#endif}
开发者ID:deardaniel,项目名称:PizzaTest,代码行数:38,


示例15: der_decode_dictionary

const uint8_t* der_decode_dictionary(CFAllocatorRef allocator, CFOptionFlags mutability,                                     CFDictionaryRef* dictionary, CFErrorRef *error,                                     const uint8_t* der, const uint8_t *der_end){    if (NULL == der)        return NULL;    const uint8_t *payload_end = 0;    const uint8_t *payload = ccder_decode_constructed_tl(CCDER_CONSTRUCTED_SET, &payload_end, der, der_end);    if (NULL == payload) {        SecCFDERCreateError(kSecDERErrorUnknownEncoding, CFSTR("Unknown data encoding, expected CCDER_CONSTRUCTED_SET"), NULL, error);        return NULL;    }            CFMutableDictionaryRef dict = CFDictionaryCreateMutable(allocator, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);        if (NULL == dict) {        SecCFDERCreateError(kSecDERErrorAllocationFailure, CFSTR("Failed to create dictionary"), NULL, error);        payload = NULL;        goto exit;    }    while (payload != NULL && payload < payload_end) {        CFTypeRef key = NULL;        CFTypeRef value = NULL;                payload = der_decode_key_value(allocator, mutability, &key, &value, error, payload, payload_end);                if (payload) {            CFDictionaryAddValue(dict, key, value);        }                CFReleaseNull(key);        CFReleaseNull(value);    }        exit:    if (payload == payload_end) {        *dictionary = dict;        dict = NULL;    }    CFReleaseNull(dict);    return payload;}
开发者ID:darlinghq,项目名称:darling-security,代码行数:49,


示例16: PortBurn_StartErasing

/* Erase the media in the currently opened device */int PortBurn_StartErasing(void *handle, int type){   CFMutableDictionaryRef props;   PBHandle *h = (PBHandle *)handle;   if (h == NULL) {      return pbErrNoHandle;   }   if (h->device == NULL) {      return pbErrDeviceNotOpen;   }   if (h->burn != NULL || h->erase != NULL) {      return pbErrCannotStartErasing;   }   h->erase = DREraseCreate(h->device);   if (h->erase == NULL) {      return pbErrCannotPrepareToErase;   }   props = CFDictionaryCreateMutableCopy(NULL, 0, DREraseGetProperties(h->erase));   if (props == NULL) {      CFRelease(h->erase);      h->erase = NULL;      return pbErrCannotPrepareToErase;   }   CFDictionaryAddValue(props,                        kDREraseTypeKey,                        type ? kDREraseTypeComplete : kDREraseTypeQuick);   DREraseSetProperties(h->erase, props);   CFRelease(props);   h->frac = 0.0;   h->err = DREraseStart(h->erase);   if (h->err != noErr) {      CFRelease(h->erase);      h->erase = NULL;      return pbErrCannotStartErasing;   }   return pbSuccess;}
开发者ID:AkiraShirase,项目名称:audacity,代码行数:50,


示例17: PutStringIntoDictionary

static bool PutStringIntoDictionary( const VString& inString, CFMutableDictionaryRef inDictionary, CFStringRef inDictionaryKey){	bool ok = false;	if (!inString.IsEmpty() && (inDictionary != NULL) )	{		CFStringRef cfString = inString.MAC_RetainCFStringCopy();		if (cfString != NULL)		{			CFDictionaryAddValue( inDictionary,	inDictionaryKey, cfString);			CFRelease( cfString);			ok = true;		}	}	return ok;}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:15,


示例18: GetMetadataForFile

Boolean GetMetadataForFile(void* thisInterface, 			   CFMutableDictionaryRef attributes, 			   CFStringRef contentTypeUTI,			   CFStringRef pathToFile){    CFStringRef str = CreateStringWithContentsOfDVIFile(pathToFile);    Boolean success = FALSE;    if (str) {        CFDictionaryAddValue(attributes, kMDItemTextContent, str);        success = TRUE;        CFRelease(str);    }    return success;}
开发者ID:amaxwell,项目名称:DVIImporter,代码行数:15,


示例19: makeCFMutableDictionary

CFMutableDictionaryRef makeCFMutableDictionary(unsigned count, ...){	CFMutableDictionaryRef dict = makeCFMutableDictionary();	if (count > 0) {		va_list args;		va_start(args, count);		for (unsigned n = 0; n < count; n++) {			CFTypeRef key = va_arg(args, CFTypeRef);			CFTypeRef value = va_arg(args, CFTypeRef);			CFDictionaryAddValue(dict, key, value);		}		va_end(args);	}	return dict;}
开发者ID:Proteas,项目名称:codesign,代码行数:15,


示例20: addArray

CFMutableArrayRef addArray(CFMutableDictionaryRef dest, CFStringRef key){  assert(dest);  CFMutableArrayRef array = CFArrayCreateMutable (                                                   kCFAllocatorDefault,                                                   0,                                                   &kCFTypeArrayCallBacks                                                  );  if (!array) {    errx(1,"Error can't allocate array for key '%s'",         CFStringGetCStringPtr( key, kCFStringEncodingMacRoman ));  }  CFDictionaryAddValue(dest, key, array );  return array;}
开发者ID:huaqli,项目名称:clover,代码行数:15,


示例21: SOSItemUpdateOrAdd

bool SOSItemUpdateOrAdd(CFStringRef service, CFStringRef accessibility, CFDataRef data, CFErrorRef *error){    CFDictionaryRef query = SOSItemCopyQueryForSyncItems(service, false);    CFDictionaryRef update = CFDictionaryCreateForCFTypes(kCFAllocatorDefault,                                                          kSecValueData,         data,                                                          kSecAttrAccessible,    accessibility,                                                          NULL);    OSStatus saveStatus = SecItemUpdate(query, update);    if (errSecItemNotFound == saveStatus) {        CFMutableDictionaryRef add = CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, query);        CFDictionaryForEach(update, ^(const void *key, const void *value) {            CFDictionaryAddValue(add, key, value);        });
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:15,


示例22: _NPN_GetIntIdentifier

NPIdentifier _NPN_GetIntIdentifier(int32_t intid){    PrivateIdentifier *identifier = 0;        identifier = (PrivateIdentifier *)CFDictionaryGetValue (getIntIdentifierDictionary(), (const void *)intid);    if (identifier == 0) {        identifier = (PrivateIdentifier *)malloc (sizeof(PrivateIdentifier));        // We never release identifier names, so this dictionary will grow.        identifier->isString = false;        identifier->value.number = intid;        CFDictionaryAddValue (getIntIdentifierDictionary(), (const void *)intid, (const void *)identifier);    }    return (NPIdentifier)identifier;}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:15,


示例23: dictionary_set

static intdictionary_set(st_data_t key, st_data_t value, CFMutableDictionaryRef dict) {  CFStringRef keyRef = str_to_cfstr(key);  CFTypeRef valueRef = NULL;  if (TYPE(value) == T_HASH) {    valueRef = CFDictionaryCreateMutable(NULL,                                         0,                                         &kCFTypeDictionaryKeyCallBacks,                                         &kCFTypeDictionaryValueCallBacks);    rb_hash_foreach(value, dictionary_set, (st_data_t)valueRef);  } else if (TYPE(value) == T_ARRAY) {    long i, count = RARRAY_LEN(value);    valueRef = CFArrayCreateMutable(NULL, count, &kCFTypeArrayCallBacks);    for (i = 0; i < count; i++) {      VALUE element = RARRAY_PTR(value)[i];      CFTypeRef elementRef = NULL;      if (TYPE(element) == T_HASH) {        elementRef = CFDictionaryCreateMutable(NULL,                                               0,                                               &kCFTypeDictionaryKeyCallBacks,                                               &kCFTypeDictionaryValueCallBacks);        rb_hash_foreach(element, dictionary_set, (st_data_t)elementRef);      } else {        // otherwise coerce to string        elementRef = str_to_cfstr(element);      }      CFArrayAppendValue((CFMutableArrayRef)valueRef, elementRef);      CFRelease(elementRef);    }  } else if (value == Qtrue) {    valueRef = kCFBooleanTrue;  } else if (value == Qfalse) {    valueRef = kCFBooleanFalse;  } else {    valueRef = str_to_cfstr(value);  }  if (valueRef == NULL) {    rb_raise(rb_eTypeError, "Unable to convert value of key `%s'.", RSTRING_PTR(rb_inspect(key)));  }  CFDictionaryAddValue(dict, keyRef, valueRef);  CFRelease(keyRef);  CFRelease(valueRef);  return ST_CONTINUE;}
开发者ID:1dividedby0,项目名称:Nudge-Debate,代码行数:48,


示例24: bonjour_start_service

static voidbonjour_start_service(CFNetServiceRef *svc, char *service_type,                      uint32_t port, txt_rec_t *txt){  CFStringRef str;  CFStreamError error = {0};  CFNetServiceClientContext context = {0, NULL, NULL, NULL, NULL};    str = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, service_type,                                        kCFStringEncodingASCII,                                        kCFAllocatorNull);  *svc = CFNetServiceCreate(NULL, CFSTR(""), str, CFSTR("Tvheadend"), port);  if (!*svc) {    tvhlog(LOG_ERR, "bonjour", "service creation failed");     return;  }  CFNetServiceSetClient(*svc, bonjour_callback, &context);  CFNetServiceScheduleWithRunLoop(*svc, CFRunLoopGetCurrent(),                                  kCFRunLoopCommonModes);  if (txt) {    CFDataRef data = NULL;    CFMutableDictionaryRef dict;    dict = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks,                                     &kCFTypeDictionaryValueCallBacks);        while(txt->key) {      str = CFStringCreateWithCString (NULL, txt->key, kCFStringEncodingASCII);      data = CFDataCreate (NULL, (uint8_t *) txt->value, strlen(txt->value));      CFDictionaryAddValue(dict, str, data);      txt++;    }        data = CFNetServiceCreateTXTDataWithDictionary(NULL, dict);    CFNetServiceSetTXTData(*svc, data);    CFRelease(data);    CFRelease(dict);  }  if (!CFNetServiceRegisterWithOptions(*svc, 0, &error))    tvhlog(LOG_ERR, "bonjour", "registration failed (service type = %s, "           "domain = %ld, error =%d)", service_type, error.domain, error.error);   else    tvhlog(LOG_INFO, "bonjour", "service '%s' successfully established",           service_type);}
开发者ID:0p1pp1,项目名称:tvheadend,代码行数:48,


示例25: keyCodeForChar

MMKeyCode keyCodeForChar(const char c){#if defined(IS_MACOSX)	/* OS X does not appear to have a built-in function for this, so instead we	 * have to write our own. */	static CFMutableDictionaryRef charToCodeDict = NULL;	CGKeyCode code;	UniChar character = c;	CFStringRef charStr = NULL;	/* Generate table of keycodes and characters. */	if (charToCodeDict == NULL) {		size_t i;		charToCodeDict = CFDictionaryCreateMutable(kCFAllocatorDefault,		                                           128,		                                           &kCFCopyStringDictionaryKeyCallBacks,		                                           NULL);		if (charToCodeDict == NULL) return UINT16_MAX;		/* Loop through every keycode (0 - 127) to find its current mapping. */		for (i = 0; i < 128; ++i) {			CFStringRef string = createStringForKey((CGKeyCode)i);			if (string != NULL) {				CFDictionaryAddValue(charToCodeDict, string, (const void *)i);				CFRelease(string);			}		}	}	charStr = CFStringCreateWithCharacters(kCFAllocatorDefault, &character, 1);	/* Our values may be NULL (0), so we need to use this function. */	if (!CFDictionaryGetValueIfPresent(charToCodeDict, charStr,	                                   (const void **)&code)) {		code = UINT16_MAX; /* Error */	}	CFRelease(charStr);	return (MMKeyCode)code;#elif defined(IS_WINDOWS)	return VkKeyScan(c);#elif defined(USE_X11)	char buf[2];	buf[0] = c;	buf[1] = '/0';	return XStringToKeysym(buf);#endif}
开发者ID:kmnb,项目名称:autopy,代码行数:48,


示例26: addDict

CFMutableDictionaryRef addDict(CFMutableDictionaryRef dest, CFStringRef key){    assert(dest);    CFMutableDictionaryRef dict = CFDictionaryCreateMutable (                                                             kCFAllocatorDefault,                                                             0,                                                             &kCFTypeDictionaryKeyCallBacks,                                                             &kCFTypeDictionaryValueCallBacks                                                             );    if (!dict)        errx(1,"Error can't allocate dictionnary for key '%s'",             CFStringGetCStringPtr( key, kCFStringEncodingMacRoman ));    CFDictionaryAddValue( dest, key, dict );    return dict;}
开发者ID:huaqli,项目名称:clover,代码行数:16,


示例27: codeInvalidityExceptions

//// Process special overrides for invalidly signed code.// This is the (hopefully minimal) concessions we make to keep hurting our customers// for our own prior mistakes...//static bool codeInvalidityExceptions(SecStaticCodeRef code, CFMutableDictionaryRef result){	if (OSAIsRecognizedExecutableURL) {		CFRef<CFDictionaryRef> info;		MacOSError::check(SecCodeCopySigningInformation(code, kSecCSDefaultFlags, &info.aref()));		if (CFURLRef executable = CFURLRef(CFDictionaryGetValue(info, kSecCodeInfoMainExecutable))) {			SInt32 error;			if (OSAIsRecognizedExecutableURL(executable, &error)) {				if (result)					CFDictionaryAddValue(result,						kSecAssessmentAssessmentAuthorityOverride, CFSTR("ignoring known invalid applet signature"));				return true;			}		}	}	return false;}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:22,


示例28: dictAddValueToArrayForKey

static void dictAddValueToArrayForKey(CFMutableDictionaryRef dict,	const void *key, const void *value) {	if (!key)		return;	CFMutableArrayRef values =		(CFMutableArrayRef)CFDictionaryGetValue(dict, key);	if (!values) {		values = CFArrayCreateMutable(kCFAllocatorDefault, 0,			&kCFTypeArrayCallBacks);		CFDictionaryAddValue(dict, key, values);		CFRelease(values);	}	if (values)		CFArrayAppendValue(values, value);}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:17,


示例29: refresh_disks

intrefresh_disks(struct diskstats *stats, pmdaIndom *indom){    io_registry_entry_t		drive;    CFMutableDictionaryRef	match;    int				i, status;    static int			inited = 0;    static mach_port_t		mach_master_port;    static io_iterator_t	mach_device_list;    if (!inited) {	/* Get ports and services for device statistics. */	if (IOMasterPort(bootstrap_port, &mach_master_port)) {	    fprintf(stderr, "%s: IOMasterPort error/n", __FUNCTION__);	    return -oserror();	}	memset(stats, 0, sizeof(struct diskstats));	inited = 1;    }    /* Get an interator for IOMedia objects (drives). */    match = IOServiceMatching("IOMedia");    CFDictionaryAddValue(match, CFSTR(kIOMediaWholeKey), kCFBooleanTrue);    status = IOServiceGetMatchingServices(mach_master_port,						match, &mach_device_list);    if (status != KERN_SUCCESS) {	    fprintf(stderr, "%s: IOServiceGetMatchingServices error/n",			__FUNCTION__);	    return -oserror();    }    indom->it_numinst = 0;    clear_disk_totals(stats);    for (i = 0; (drive = IOIteratorNext(mach_device_list)) != 0; i++) {	status = update_disk(stats, drive, i);	if (status)		break;	IOObjectRelease(drive);    }    IOIteratorReset(mach_device_list);    if (!status)	status = update_disk_indom(stats, i, indom);    return status;}
开发者ID:goodwinos,项目名称:pcp,代码行数:45,



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


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