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

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

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

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

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

示例1: decode

bool decode(ArgumentDecoder* decoder, RetainPtr<CFNumberRef>& result){    CFNumberType numberType;    if (!decoder->decodeEnum(numberType))        return false;    CoreIPC::DataReference dataReference;    if (!decoder->decode(dataReference))        return false;    size_t neededBufferSize = sizeForNumberType(numberType);    if (!neededBufferSize || dataReference.size() != neededBufferSize)        return false;    ASSERT(dataReference.data());    CFNumberRef number = CFNumberCreate(0, numberType, dataReference.data());    result.adoptCF(number);    return true;}
开发者ID:Moondee,项目名称:Artemis,代码行数:20,


示例2: kim_os_preferences_set_lifetime_for_key

kim_error kim_os_preferences_set_lifetime_for_key (kim_preference_key in_key,                                                   kim_lifetime       in_lifetime){    kim_error err = KIM_NO_ERROR;    CFNumberRef value = NULL;    SInt32 number = (SInt32) in_lifetime;    if (!err) {        value = CFNumberCreate (kCFAllocatorDefault, kCFNumberSInt32Type, &number);        if (!value) { err = KIM_OUT_OF_MEMORY_ERR; }    }    if (!err) {        err = kim_os_preferences_set_value (in_key, value);    }    if (value) { CFRelease (value); }    return check_error (err);}
开发者ID:Brainiarc7,项目名称:pbis,代码行数:20,


示例3: CFQDictionarySetNumber

extern pascal OSStatus CFQDictionarySetNumber(CFMutableDictionaryRef dict, const void *key, long value)	// See comment in header.{	OSStatus    err;	CFNumberRef valueNum;	// Create a CFNumber and add it to the dictionary.			err = noErr;	valueNum = CFNumberCreate(NULL, kCFNumberLongType, &value);	if (valueNum == NULL) {		err = coreFoundationUnknownErr;	}	if (err == noErr) {		CFDictionarySetValue(dict, key, valueNum);	}	CFQRelease(valueNum);		return err;}
开发者ID:paullalonde,项目名称:B,代码行数:20,


示例4: MovieWriterExcAlreadyFinished

void MovieWriter::Obj::addFrame( const ImageSourceRef &imageSource, float duration ){	if( mFinished )		throw MovieWriterExcAlreadyFinished();	if( duration <= 0 )		duration = mFormat.mDefaultTime;	::CVPixelBufferRef pixelBuffer = createCvPixelBuffer( imageSource, false );	::CFNumberRef gammaLevel = CFNumberCreate( kCFAllocatorDefault, kCFNumberFloatType, &mFormat.mGamma );	::CVBufferSetAttachment( pixelBuffer, kCVImageBufferGammaLevelKey, gammaLevel, kCVAttachmentMode_ShouldPropagate );	::CFRelease( gammaLevel );	::ICMValidTimeFlags validTimeFlags = kICMValidTime_DisplayTimeStampIsValid | kICMValidTime_DisplayDurationIsValid;	::ICMCompressionFrameOptionsRef frameOptions = NULL;	int64_t durationVal = static_cast<int64_t>( duration * mFormat.mTimeBase );	OSStatus err = ::ICMCompressionSessionEncodeFrame( mCompressionSession, pixelBuffer,				mCurrentTimeValue, durationVal, validTimeFlags,                frameOptions, NULL, NULL );	mFrameTimes.push_back( std::pair<int64_t,int64_t>( mCurrentTimeValue, durationVal ) );	if( mDoingMultiPass ) {		mMultiPassFrameCache->write( (uint32_t)::CVPixelBufferGetWidth( pixelBuffer ) );		mMultiPassFrameCache->write( (uint32_t)::CVPixelBufferGetHeight( pixelBuffer ) );		mMultiPassFrameCache->write( (uint32_t)::CVPixelBufferGetPixelFormatType( pixelBuffer ) );		mMultiPassFrameCache->write( (uint32_t)::CVPixelBufferGetBytesPerRow( pixelBuffer ) );		::CVPixelBufferLockBaseAddress( pixelBuffer, 0 );		mMultiPassFrameCache->write( (uint32_t) ::CVPixelBufferGetDataSize( pixelBuffer ) );		mMultiPassFrameCache->writeData( ::CVPixelBufferGetBaseAddress( pixelBuffer ), ::CVPixelBufferGetDataSize( pixelBuffer ) );		::CVPixelBufferUnlockBaseAddress( pixelBuffer, 0 );	}	mCurrentTimeValue += durationVal;	++mNumFrames;	::CVPixelBufferRelease( pixelBuffer );	if( err )		throw MovieWriterExcFrameEncode();}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:41,


示例5: DoGetVersion

static OSStatus DoGetVersion(	AuthorizationRef			auth,    const void *                userData,	CFDictionaryRef				request,	CFMutableDictionaryRef      response,    aslclient                   asl,    aslmsg                      aslMsg)    // Implements the kGetVersionCommand.  Returns the version number of     // the helper tool.{		OSStatus					retval = noErr;	CFNumberRef					value;    static const int kCurrentVersion = kToolCurrentVersion;          // something very easy to spot    	asl_log(asl, aslMsg, ASL_LEVEL_DEBUG, "DoGetVersion()");		// Pre-conditions		assert(auth != NULL);    // userData may be NULL	assert(request != NULL);	assert(response != NULL);    // asl may be NULL    // aslMsg may be NULL	    // Add them to the response.    	value = CFNumberCreate(NULL, kCFNumberIntType, &kCurrentVersion);	if (value == NULL) {		retval = coreFoundationUnknownErr;    } else {        CFDictionaryAddValue(response, CFSTR(kGetVersionResponse), value);	}		if (value != NULL) {		CFRelease(value);	}	return retval;}
开发者ID:Bia10,项目名称:pocketfork,代码行数:41,


示例6: GPDuplexClient_AddObserver

// FIXME: Make these thread-safe / re-entrant.extern void GPDuplexClient_AddObserver(GPDuplexClientRef client, void* observer, GPDuplexClientCallback callback, SInt32 type) {	if (client != NULL) {		CFNumberRef typeNumber = CFNumberCreate(NULL, kCFNumberSInt32Type, &type);		CFMutableSetRef observerSet = (CFMutableSetRef)CFDictionaryGetValue(client->observers, typeNumber);		Boolean needRelease = false;		if (observerSet == NULL) {			needRelease = true;			observerSet = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);		}				CFDataRef observerData = GPDuplexClientCreateObserver(observer, callback);		CFSetAddValue(observerSet, observerData);		CFRelease(observerData);				CFDictionarySetValue(client->observers, typeNumber, observerSet);		if (needRelease)			CFRelease(observerSet);				CFRelease(typeNumber);	}}
开发者ID:525828027,项目名称:networkpx,代码行数:22,


示例7: CreateStringToNumDictionary

staticCFDictionaryRef CreateStringToNumDictionary(){	int numItems = (sizeof(gValues) / sizeof(sint32));	CFMutableDictionaryRef tempDict = CFDictionaryCreateMutable(kCFAllocatorDefault, numItems, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);	for (int iCnt = 0; iCnt < numItems; iCnt++)	{		sint32 aNumber = gValues[iCnt];		CFNumberRef aNum = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &aNumber);		CFStringRef aString = gKeys[iCnt];		CFDictionaryAddValue(tempDict, aString, aNum);		CFRelease(aNum);	}	CFDictionaryRef result = CFDictionaryCreateCopy(kCFAllocatorDefault, tempDict);	CFRelease(tempDict);	return result;}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:21,


示例8: outOfSpace

bool outOfSpace(CFStringRef pathName){	Boolean			validKey;	unsigned int	minMeg;	struct statfs	fileSys;		minMeg = CFPreferencesGetAppIntegerValue(MINMEG_PREF_KEY,PREF_DOMAIN,&validKey);	if (!validKey)	{		minMeg = DEFAULT_MEG;		CFPreferencesSetAppValue(MINMEG_PREF_KEY,CFNumberCreate(kCFAllocatorDefault,kCFNumberIntType,&minMeg),PREF_DOMAIN);	}	if (statfs(CFStringGetCStringPtr(pathName,CFStringGetFastestEncoding(pathName)),&fileSys))		return false;	if ((fileSys.f_bsize/1024)*(fileSys.f_bavail/1024) < minMeg)		return true;			return false;}
开发者ID:ChaseJohnson,项目名称:LogKext,代码行数:21,


示例9: 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,


示例10: rb_add_value_to_cf_dictionary

static void rb_add_value_to_cf_dictionary(CFMutableDictionaryRef dict, CFStringRef key, VALUE value){  switch(TYPE(value)){    case T_STRING:      {        if(!CFStringCompare(key, kSecValueData,0) || !CFStringCompare(key, kSecAttrGeneric,0)){          CFDataRef dataValue = rb_create_cf_data(value);          CFDictionarySetValue(dict,key,dataValue);          CFRelease(dataValue);        }        else{          CFStringRef stringValue = rb_create_cf_string(value);          CFDictionarySetValue(dict,key,stringValue);          CFRelease(stringValue);        }      }      break;    case T_BIGNUM:    case T_FIXNUM:      {        long long longLongValue = NUM2LL(value);        CFNumberRef numberValue = CFNumberCreate(NULL,kCFNumberLongLongType,&longLongValue);        CFDictionarySetValue(dict,key,numberValue);        CFRelease(numberValue);        break;      }    case T_DATA:      {        if(rb_obj_is_kind_of(value, rb_cTime)){          VALUE floatTime = rb_funcall(value, rb_intern("to_f"),0);          CFAbsoluteTime abstime = RFLOAT_VALUE(floatTime) - kCFAbsoluteTimeIntervalSince1970;          CFDateRef cfdate = CFDateCreate(NULL, abstime);          CFDictionarySetValue(dict, key, cfdate);          CFRelease(cfdate);          break;        }      }    default:      rb_raise(rb_eTypeError, "Can't convert value to cftype: %s", rb_obj_classname(value));  }}
开发者ID:fcheung,项目名称:keychain_c,代码行数:40,


示例11: appendScopeID

static voidappendScopeID(CFMutableDictionaryRef dict, struct sockaddr_in6 *sin6){	CFNumberRef		scope;	CFArrayRef		scopes;	CFMutableArrayRef	newScopes;	scopes = CFDictionaryGetValue(dict, kSCPropNetIPv6ScopeID);	if (scopes) {		newScopes = CFArrayCreateMutableCopy(NULL, 0, scopes);	} else {		newScopes = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);	}	scope = CFNumberCreate(NULL, kCFNumberSInt32Type, &sin6->sin6_scope_id);	CFArrayAppendValue(newScopes, scope);	CFRelease(scope);	CFDictionarySetValue(dict, kSCPropNetIPv6ScopeID, newScopes);	CFRelease(newScopes);	return;}
开发者ID:010001111,项目名称:darling,代码行数:22,


示例12: appendFlags

static voidappendFlags(CFMutableDictionaryRef dict, int flags6){	CFArrayRef		flags;	CFMutableArrayRef	newFlags;	CFNumberRef		v6Flags;	flags = CFDictionaryGetValue(dict, kSCPropNetIPv6Flags);	if (flags) {		newFlags = CFArrayCreateMutableCopy(NULL, 0, flags);	} else {		newFlags = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);	}	v6Flags = CFNumberCreate(NULL, kCFNumberIntType, &flags6);	CFArrayAppendValue(newFlags, v6Flags);	CFRelease(v6Flags);	CFDictionarySetValue(dict, kSCPropNetIPv6Flags, newFlags);	CFRelease(newFlags);	return;}
开发者ID:010001111,项目名称:darling,代码行数:22,


示例13: adoptCF

CFDictionaryRef Font::getCFStringAttributes(bool enableKerning, FontOrientation orientation) const{    auto& attributesDictionary = enableKerning ? m_kernedCFStringAttributes : m_nonKernedCFStringAttributes;    if (attributesDictionary)        return attributesDictionary.get();    attributesDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));    CFMutableDictionaryRef mutableAttributes = (CFMutableDictionaryRef)attributesDictionary.get();    CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, platformData().ctFont());    if (!enableKerning) {        const float zero = 0;        static CFNumberRef zeroKerningValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);        CFDictionarySetValue(mutableAttributes, kCTKernAttributeName, zeroKerningValue);    }    if (orientation == Vertical)        CFDictionarySetValue(mutableAttributes, kCTVerticalFormsAttributeName, kCFBooleanTrue);    return attributesDictionary.get();}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:22,


示例14: DisconnectFromSkype

void DisconnectFromSkype(void){	CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();			if (client_id)	{		CFNumberRef id_number = CFNumberCreate(NULL, kCFNumberIntType, &client_id);		const void *keys[] = {(void *)CFSTR("SKYPE_API_CLIENT_ID")};		const void *values[] = {id_number};		CFDictionaryRef userInfo = CFDictionaryCreate(NULL, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);				//disconnect		CFNotificationCenterPostNotification(			center,			CFSTR("SKSkypeAPIDetachRequest"),			NULL,			userInfo,			FALSE);					client_id = 0;	}}
开发者ID:dndump,项目名称:XboxLivePlugin,代码行数:22,


示例15: os_updateindicators

void os_updateindicators(usbdevice* kb, int force){    // Set NumLock on permanently    char ileds = 1;    // Set Caps Lock if enabled. Unlike Linux, OSX keyboards have independent caps lock states, so    // we use the last-assigned value rather than fetching it from the system    if(kb->modifiers & kCGEventFlagMaskAlphaShift)        ileds |= 2;    kb->hw_ileds = ileds;    if(kb->active){        usbmode* mode = kb->profile->currentmode;        ileds = (ileds & ~mode->ioff) | mode->ion;    }    if(force || ileds != kb->ileds){        kb->ileds = ileds;        // Get a list of LED elements from handle 0        long ledpage = kHIDPage_LEDs;        const void* keys[] = { CFSTR(kIOHIDElementUsagePageKey) };        const void* values[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberLongType, &ledpage) };        CFDictionaryRef matching = CFDictionaryCreate(kCFAllocatorDefault, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);        CFRelease(values[0]);        CFArrayRef leds;        kern_return_t res = (*kb->handles[0])->copyMatchingElements(kb->handles[0], matching, &leds, 0);        CFRelease(matching);        if(res != kIOReturnSuccess)            return;        // Iterate through them and update the LEDs which have changed        DELAY_SHORT(kb);        CFIndex count = CFArrayGetCount(leds);        for(CFIndex i = 0; i < count; i++){            IOHIDElementRef led = (void*)CFArrayGetValueAtIndex(leds, i);            uint32_t usage = IOHIDElementGetUsage(led);            IOHIDValueRef value = IOHIDValueCreateWithIntegerValue(kCFAllocatorDefault, led, 0, !!(ileds & (1 << (usage - 1))));            (*kb->handles[0])->setValue(kb->handles[0], led, value, 5000, 0, 0, 0);            CFRelease(value);        }        CFRelease(leds);    }}
开发者ID:shazron,项目名称:ckb,代码行数:38,


示例16: main

int main() {    io_service_t service = IOServiceGetMatchingService( kIOMasterPortDefault, IOServiceMatching("IOWatchDogTimer"));    assert(service);    //assert(!IORegistryEntrySetCFProperty(service, CFSTR("IOWatchDogEnabled"), kCFBooleanFalse));    long zero = 0;    CFNumberRef number = CFNumberCreate(NULL, kCFNumberLongType, &zero);    assert(!IORegistryEntrySetCFProperties(service, number));    void *kern_hdr;    size_t kern_size;    void *devicetree;    size_t devicetree_size;    load("kern", &kern_hdr, &kern_size);    load("devicetree", &devicetree, &devicetree_size);    // todo use reboot2    system("launchctl unload /System/Library/LaunchDaemons/com.apple.SpringBoard.plist");    syscall(8, kern_hdr, kern_size, devicetree, devicetree_size);    return 0;}
开发者ID:0xDEC0DE8,项目名称:star_,代码行数:23,


示例17: createImageSourceOptions

static RetainPtr<CFDictionaryRef> createImageSourceOptions(SubsamplingLevel subsamplingLevel, DecodingMode decodingMode){    RetainPtr<CFMutableDictionaryRef> options = adoptCF(CFDictionaryCreateMutable(nullptr, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));    CFDictionarySetValue(options.get(), kCGImageSourceShouldCache, kCFBooleanTrue);    CFDictionarySetValue(options.get(), kCGImageSourceShouldPreferRGB32, kCFBooleanTrue);    CFDictionarySetValue(options.get(), kCGImageSourceSkipMetadata, kCFBooleanTrue);    if (subsamplingLevel > SubsamplingLevel::First) {        RetainPtr<CFNumberRef> subsampleNumber;        subsamplingLevel = std::min(SubsamplingLevel::Last, std::max(SubsamplingLevel::First, subsamplingLevel));        int subsampleInt = 1 << static_cast<int>(subsamplingLevel); // [0..3] => [1, 2, 4, 8]        subsampleNumber = adoptCF(CFNumberCreate(nullptr,  kCFNumberIntType,  &subsampleInt));        CFDictionarySetValue(options.get(), kCGImageSourceSubsampleFactor, subsampleNumber.get());    }    if (decodingMode == DecodingMode::Immediate) {        CFDictionarySetValue(options.get(), kCGImageSourceShouldCacheImmediately, kCFBooleanTrue);        CFDictionarySetValue(options.get(), kCGImageSourceCreateThumbnailFromImageAlways, kCFBooleanTrue);    }    return options;}
开发者ID:ollie314,项目名称:webkit,代码行数:23,


示例18: CFNumberCreate

static void *do_add(void *arg){    int tid=(int)(arg);        for(int i=0;i<20;i++) {        /* Creating a password */        SInt32 v_eighty = (tid+1)*1000+i;        CFNumberRef eighty = CFNumberCreate(NULL, kCFNumberSInt32Type, &v_eighty);        const char *v_data = "test";        CFDataRef pwdata = CFDataCreate(NULL, (UInt8 *)v_data, strlen(v_data));        const void *keys[] = {            kSecClass,            kSecAttrServer,            kSecAttrAccount,            kSecAttrPort,            kSecAttrProtocol,            kSecAttrAuthenticationType,            kSecValueData        };        const void *values[] = {            kSecClassInternetPassword,            CFSTR("members.spamcop.net"),            CFSTR("smith"),            eighty,            CFSTR("http"),            CFSTR("dflt"),            pwdata        };        CFDictionaryRef item = CFDictionaryCreate(NULL, keys, values,                                                  array_size(keys), NULL, NULL);        ok_status(SecItemAdd(item, NULL), "add internet password");    }    return NULL;}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:37,


示例19: 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,


示例20: ASSERT

CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback filter, void* context) const{    ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size());    RetainPtr<CFMutableArrayRef> entries(AdoptCF, CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks));    // We may need to update the current index to account for entries that are filtered by the callback.    int currentIndex = m_current;    for (size_t i = 0; i < m_entries.size(); ++i) {        RefPtr<WebURL> webURL = WebURL::create(m_entries[i]->url());        if (filter && !filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context)) {            if (i <= static_cast<size_t>(m_current))                currentIndex--;            continue;        }                RetainPtr<CFStringRef> url(AdoptCF, m_entries[i]->url().createCFString());        RetainPtr<CFStringRef> title(AdoptCF, m_entries[i]->title().createCFString());        RetainPtr<CFStringRef> originalURL(AdoptCF, m_entries[i]->originalURL().createCFString());        RetainPtr<CFDataRef> entryData(AdoptCF, CFDataCreate(kCFAllocatorDefault, m_entries[i]->backForwardData().data(), m_entries[i]->backForwardData().size()));                const void* keys[4] = { SessionHistoryEntryURLKey(), SessionHistoryEntryTitleKey(), SessionHistoryEntryOriginalURLKey(), SessionHistoryEntryDataKey() };        const void* values[4] = { url.get(), title.get(), originalURL.get(), entryData.get() };        RetainPtr<CFDictionaryRef> entryDictionary(AdoptCF, CFDictionaryCreate(0, keys, values, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));        CFArrayAppendValue(entries.get(), entryDictionary.get());    }    ASSERT(currentIndex < CFArrayGetCount(entries.get()));    RetainPtr<CFNumberRef> currentIndexNumber(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &currentIndex));    const void* keys[2] = { SessionHistoryCurrentIndexKey(), SessionHistoryEntriesKey() };    const void* values[2] = { currentIndexNumber.get(), entries.get() };    return CFDictionaryCreate(0, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);}
开发者ID:Afreeca,项目名称:qt,代码行数:37,


示例21: keychain_get_item_ios5

CFMutableDictionaryRef keychain_get_item_ios5(sqlite3_stmt* stmt){    const char* name;    uint32_t pclass, i, rowid;    for(i=0; i < sqlite3_column_count(stmt) ; i++)    {        name = sqlite3_column_name(stmt,i);        if(!strcmp(name, "rowid"))        {            rowid = sqlite3_column_int(stmt, i);        }        if(!strcmp(name, "data"))        {            const void* blob = sqlite3_column_blob(stmt, i);            int len = sqlite3_column_bytes(stmt, i);            CFMutableDictionaryRef item = decrypt_data_ios5(blob,len,&pclass);            if (item != NULL)            {                CFNumberRef cf_rowid = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &rowid);                CFDictionarySetValue(item, CFSTR("rowid"), cf_rowid);                CFRelease(cf_rowid);                CFDictionarySetValue(item, CFSTR("protection_class"), keychain_protectionClassIdToString(pclass));                CFDataRef vdata = CFDictionaryGetValue(item, CFSTR("v_Data"));                CFTypeRef data = keychain_convert_data_to_string_or_plist(vdata);                if(data != NULL)                {                    CFDictionaryAddValue(item, CFSTR("data"), data);                    if (data != vdata)                        CFRelease(data);                }                return item;            }        }    }    return NULL;}
开发者ID:Andy168,项目名称:iphone-dataprotection.keychainviewer,代码行数:37,


示例22: add_default_proxy

static voidadd_default_proxy(CFMutableArrayRef	proxies,		  CFDictionaryRef	defaultProxy,		  Boolean		*orderAdded){	CFMutableDictionaryRef	myDefault;	uint32_t		myOrder	= DEFAULT_MATCH_ORDER;	CFNumberRef		order	= NULL;	if (defaultProxy == NULL) {		myDefault = CFDictionaryCreateMutable(NULL,						      0,						      &kCFTypeDictionaryKeyCallBacks,						      &kCFTypeDictionaryValueCallBacks);	} else {		myDefault = CFDictionaryCreateMutableCopy(NULL, 0, defaultProxy);		CFDictionaryRemoveValue(myDefault, kSCPropInterfaceName);		order = CFDictionaryGetValue(myDefault, PROXY_MATCH_ORDER_KEY);	}	// ensure that the default proxy has a search order	if (!isA_CFNumber(order) ||	    !CFNumberGetValue(order, kCFNumberIntType, &myOrder)) {		myOrder = DEFAULT_MATCH_ORDER;		order = CFNumberCreate(NULL, kCFNumberIntType, &myOrder);		CFDictionarySetValue(myDefault, PROXY_MATCH_ORDER_KEY, order);		CFRelease(order);		*orderAdded = TRUE;	}	// add the default proxy	add_proxy(proxies, myDefault);	CFRelease(myDefault);	return;}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:37,


示例23: hidpunk_throwNullPointerException

JNIEXPORT void JNICALLJava_bits_hidpunk_osx_OsxHidMatcher_setLongValue(JNIEnv* env, jclass clazz, jlong ptr, jint key, jlong val){	CFMutableDictionaryRef dict;	CFNumberRef num;	CFStringRef dictKey;	long cval = (long)val;		if(!ptr) {		hidpunk_throwNullPointerException(env, "");		return;	}		dict = *(CFMutableDictionaryRef*)&ptr;	dictKey = hidpunk_findKey((int)key);		if(dictKey == NULL)		return;		num = CFNumberCreate(kCFAllocatorDefault, kCFNumberLongType, &cval);	CFDictionarySetValue(dict, dictKey, num);	CFRelease(num);}
开发者ID:decamp,项目名称:hidpunk,代码行数:24,


示例24: CGImageEncodeToData

static bool CGImageEncodeToData(CGImageRef image, CFStringRef uti, const double* quality, CFMutableDataRef data){    if (!image || !uti || !data)        return false;    RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData(data, uti, 1, 0));    if (!destination)        return false;    RetainPtr<CFDictionaryRef> imageProperties = 0;    if (CFEqual(uti, jpegUTI()) && quality && *quality >= 0.0 && *quality <= 1.0) {        // Apply the compression quality to the JPEG image destination.        RetainPtr<CFNumberRef> compressionQuality = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, quality));        const void* key = kCGImageDestinationLossyCompressionQuality;        const void* value = compressionQuality.get();        imageProperties = adoptCF(CFDictionaryCreate(0, &key, &value, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));    }    // Setting kCGImageDestinationBackgroundColor to black for JPEG images in imageProperties would save some math    // in the calling functions, but it doesn't seem to work.    CGImageDestinationAddImage(destination.get(), image, imageProperties.get());    return CGImageDestinationFinalize(destination.get());}
开发者ID:TigerLau1985,项目名称:webkit,代码行数:24,


示例25: 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,


示例26: createIOSurface

static RetainPtr<IOSurfaceRef> createIOSurface(const IntSize& size){    unsigned pixelFormat = 'BGRA';    unsigned bytesPerElement = 4;    int width = size.width();    int height = size.height();    unsigned long bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow, size.width() * bytesPerElement);    if (!bytesPerRow)        return 0;    unsigned long allocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, size.height() * bytesPerRow);    if (!allocSize)        return 0;    const void *keys[7];    const void *values[7];    keys[0] = kIOSurfaceWidth;    values[0] = CFNumberCreate(0, kCFNumberIntType, &width);    keys[1] = kIOSurfaceHeight;    values[1] = CFNumberCreate(0, kCFNumberIntType, &height);    keys[2] = kIOSurfacePixelFormat;    values[2] = CFNumberCreate(0, kCFNumberIntType, &pixelFormat);    keys[3] = kIOSurfaceBytesPerElement;    values[3] = CFNumberCreate(0, kCFNumberIntType, &bytesPerElement);    keys[4] = kIOSurfaceBytesPerRow;    values[4] = CFNumberCreate(0, kCFNumberLongType, &bytesPerRow);    keys[5] = kIOSurfaceAllocSize;    values[5] = CFNumberCreate(0, kCFNumberLongType, &allocSize);    keys[6] = kIOSurfaceMemoryRegion;    values[6] = CFSTR("PurpleGfxMem");    RetainPtr<CFDictionaryRef> dict(AdoptCF, CFDictionaryCreate(0, keys, values, 7, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));    for (unsigned i = 0; i < 7; i++)        CFRelease(values[i]);    return RetainPtr<IOSurfaceRef>(AdoptCF, IOSurfaceCreate(dict.get()));}
开发者ID:sanyaade-mobiledev,项目名称:Webkit-Projects,代码行数:38,


示例27: stringHandling

void stringHandling(void) {      CFStringRef number;   int theValue = 80;   double theOtherValue = 123.26;   CFNumberRef expected = CFNumberCreate(0, kCFNumberIntType, &theValue);   show(CFSTR("------------------Number Magic---------------"));   show(CFSTR("1.  Integer Parsing"));   show(CFSTR("   (a) Decimal Style"));   number = CFStringCreateWithCString(NULL, "80.0", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterDecimalStyle, kCFNumberFormatterParseIntegersOnly))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (b) Currency Style"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "$80.00", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterCurrencyStyle, kCFNumberFormatterParseIntegersOnly))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (c) Percent Style (does not work for integers)"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "80%", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterPercentStyle, kCFNumberFormatterParseIntegersOnly))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (d) Scientific Notation Style (does not work for integers)"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "8.0E1", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterScientificStyle, kCFNumberFormatterParseIntegersOnly))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (e) Spell-Out Style"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "eighty", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterSpellOutStyle, kCFNumberFormatterParseIntegersOnly))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (f) No Style (decimal)"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "80.0", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterNoStyle, kCFNumberFormatterParseIntegersOnly))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (g) No Style (spell out) (is not expected to work)"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "eighty", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterNoStyle, kCFNumberFormatterParseIntegersOnly))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("2.  Decimal Parsing"));   show(CFSTR("   (a) Decimal Style"));   CFRelease(expected);   expected = CFNumberCreate(0, kCFNumberDoubleType, &theOtherValue);      CFRelease(number);   number = CFStringCreateWithCString(NULL, "123.26", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterDecimalStyle, 0))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (b) Currency Style"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "$123.26", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterCurrencyStyle, 0))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (c) Percent Style"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "123.26%", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterPercentStyle, 0))      show(CFSTR("correct."));   else      show(CFSTR("WRONG!!!"));      show(CFSTR("   (d) Scientific Notation Style"));   CFRelease(number);   number = CFStringCreateWithCString(NULL, "1.2326e2", kCFStringEncodingASCII);      if (equalValues(number, expected, kCFNumberFormatterScientificStyle, 0))      show(CFSTR("correct."));   else//.........这里部分代码省略.........
开发者ID:edconnor,项目名称:TestCairo,代码行数:101,



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


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