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


C++ CFStringCreateWithFormat函数代码示例

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


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

示例1: copy_device_support_path

CFStringRef copy_device_support_path(AMDeviceRef device) {
    CFStringRef version = AMDeviceCopyValue(device, 0, CFSTR("ProductVersion"));
    CFStringRef build = AMDeviceCopyValue(device, 0, CFSTR("BuildVersion"));
    const char* home = getenv("HOME");
    CFStringRef path;
    bool found = false;

    path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/%@ (%@)"), home, version, build);
    found = path_exists(path);

    if (!found)
    {
        path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s/Library/Developer/Xcode/iOS DeviceSupport/%@"), home, version);
        found = path_exists(path);
    }
    if (!found)
    {
        path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@"), version);
        found = path_exists(path);
    }
    if (!found)
    {
        path = CFStringCreateWithFormat(NULL, NULL, CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/%@ (%@)"), version, build);
        found = path_exists(path);
    }
    if (!found)
    {
        path = CFSTR("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/Latest");
        found = path_exists(path);
    }
    CFRelease(version);
    CFRelease(build);

    if (!found)
    {
        CFRelease(path);
        printf("[ !! ] Unable to locate DeviceSupport directory.\n");
        exit(1);
    }

    return path;
}
开发者ID:seamountain,项目名称:fruitstrap,代码行数:42,代码来源:fruitstrap.c

示例2: 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,代码来源:clover-genconfig.c

示例3: TraceKeyClassItem

static void
TraceKeyClassItem(void *token, CFStringRef keyclass, CFStringRef name, int64_t num)
{
    CFStringRef key = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@.%@"), keyclass, name);
    if (key) {
	num = SecBucket2Significant(num);
	AddKeyValuePairToKeychainLoggingTransaction(token, key, num);
	CFReleaseNull(key);
    }

}
开发者ID:darlinghq,项目名称:darling-security,代码行数:11,代码来源:iCloudTrace.c

示例4: CFStringCreateWithFormat

CFStringRef MonkeysAudioDecoder::CreateSourceFormatDescription() const
{
	if(!IsOpen())
		return nullptr;

	return CFStringCreateWithFormat(kCFAllocatorDefault, 
									nullptr, 
									CFSTR("Monkey's Audio, %u channels, %u Hz"), 
									mSourceFormat.mChannelsPerFrame, 
									static_cast<unsigned int>(mSourceFormat.mSampleRate));
}
开发者ID:MisterRogersHaus,项目名称:SFBAudioEngine,代码行数:11,代码来源:MonkeysAudioDecoder.cpp

示例5: __CFLocaleCopyDescription

static CFStringRef __CFLocaleCopyDescription(CFTypeRef cf) {
    CFLocaleRef locale = (CFLocaleRef)cf;
    const char *type = NULL;
    switch (__CFLocaleGetType(locale)) {
    case __kCFLocaleOrdinary: type = "ordinary"; break;
    case __kCFLocaleSystem: type = "system"; break;
    case __kCFLocaleUser: type = "user"; break;
    case __kCFLocaleCustom: type = "custom"; break;
    }
    return CFStringCreateWithFormat(CFGetAllocator(locale), NULL, CFSTR("<CFLocale %p [%p]>{type = %s, identifier = '%@'}"), cf, CFGetAllocator(locale), type, locale->_identifier);
}
开发者ID:AbhinavBansal,项目名称:opencflite,代码行数:11,代码来源:CFLocale.c

示例6: cli_print_info_dict

static void cli_print_info_dict (const void *key,
                                 const void *value,
                                 void *context)
{
  CFStringRef entry = CFStringCreateWithFormat(NULL, NULL,
    CFSTR("%@:\n  %@"), key, value);
  if (entry) {
    CFShow(entry);
    CFRelease(entry);
  }
}
开发者ID:Zabrane,项目名称:fsevent_watch,代码行数:11,代码来源:cli.c

示例7: CFStringCreateWithFormat

CFStringRef OggSpeexDecoder::CreateSourceFormatDescription() const
{
	if(!IsOpen())
		return NULL;

	return CFStringCreateWithFormat(kCFAllocatorDefault, 
									NULL, 
									CFSTR("Ogg Speex, %u channels, %u Hz"), 
									mSourceFormat.mChannelsPerFrame, 
									static_cast<unsigned int>(mSourceFormat.mSampleRate));
}
开发者ID:hjzc,项目名称:SFBAudioEngine,代码行数:11,代码来源:OggSpeexDecoder.cpp

示例8: __DAFileSystemCopyDescription

static CFStringRef __DAFileSystemCopyDescription( CFTypeRef object )
{
    DAFileSystemRef filesystem = ( DAFileSystemRef ) object;

    return CFStringCreateWithFormat( kCFAllocatorDefault,
                                     NULL,
                                     CFSTR( "<DAFileSystem %p [%p]>{id = %@}" ),
                                     object,
                                     CFGetAllocator( object ),
                                     filesystem->_id );
}
开发者ID:alexzhang2015,项目名称:osx-10.9,代码行数:11,代码来源:DAFileSystem.c

示例9: DoSaveAsPDF

// this code originates from the NavServices sample code in the CarbonLib SDK
OSStatus DoSaveAsPDF(WindowRef w, void *ourDataP)
{
    OSStatus 			err = noErr;
    static NavEventUPP	gNavEventProc = NULL;		// event proc for our Nav Dialogs 
    NavDialogCreationOptions	dialogOptions;
    if(!gNavEventProc){
        gNavEventProc = NewNavEventUPP(NavEventProc);
        if(!gNavEventProc)
            err = memFullErr;
    }

    if(!err && (( err = NavGetDefaultDialogCreationOptions( &dialogOptions )) == noErr ))
    {
	OurSaveDialogData *dialogDataP = NULL;
	CFStringRef	tempString;
	CopyWindowTitleAsCFString(w, &tempString);

        dialogOptions.saveFileName = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, 
                                                kFileTypePDFCFStr, tempString);
	
	CFRelease(tempString);
	
	// make the dialog modal to our parent doc, AKA sheets
        dialogOptions.parentWindow = w;
	dialogOptions.modality = kWindowModalityWindowModal;
	
	dialogDataP = (OurSaveDialogData *)malloc(sizeof(OurSaveDialogData));
	if(dialogDataP){
	    dialogDataP->dialogRef = NULL;
	    dialogDataP->parentWindow = w;
	    dialogDataP->documentDataP = ourDataP;
	    err = NavCreatePutFileDialog(&dialogOptions, kFileTypePDF, kFileCreator,
						    gNavEventProc, dialogDataP,
						    &dialogDataP->dialogRef);
	    if (!err && dialogDataP->dialogRef != NULL)
	    {
		err = NavDialogRun( dialogDataP->dialogRef );
		if (err != noErr)
		{
		    NavDialogDispose( dialogDataP->dialogRef );
		    dialogDataP->dialogRef = NULL;
		    free(dialogDataP);
		}
	    }
	}else
	    err = memFullErr;
       	
     	if ( dialogOptions.saveFileName != NULL )
	    CFRelease( dialogOptions.saveFileName );

    }
    return err;
}
开发者ID:arnelh,项目名称:Examples,代码行数:54,代码来源:NavServicesHandling.c

示例10: CFCopyDescription

// definition: produces a normally non-NULL debugging description of the object
CFStringRef CFCopyDescription(CFTypeRef cf) {
#if defined(DEBUG)
    if (NULL == cf) HALT;
#endif
    __CFGenericAssertIsCF(cf);
    if (NULL != __CFRuntimeClassTable[__CFGenericTypeID_inline(cf)]->copyDebugDesc) {
        CFStringRef result;
        result = __CFRuntimeClassTable[__CFGenericTypeID_inline(cf)]->copyDebugDesc(cf);
        if (NULL != result) return result;
    }
    return CFStringCreateWithFormat(kCFAllocatorSystemDefault, NULL, CFSTR("<%s %p [%p]>"), __CFRuntimeClassTable[__CFGenericTypeID_inline(cf)]->className, cf, CFGetAllocator(cf));
}
开发者ID:NathanLi,项目名称:freequartz,代码行数:13,代码来源:CFRuntime.c

示例11: odkerb_get_fabricated_im_handle

int
odkerb_get_fabricated_im_handle(ODRecordRef userRecord, CFStringRef allegedShortName, CFStringRef realm, char im_handle[], size_t im_handle_size)
{
    int retval = -1;
    CFArrayRef cfShortNames = NULL;
    CFStringRef cfIMHandle = NULL;
    CFErrorRef cfError = NULL;
    CFStringRef shortName = allegedShortName;

    ODKERB_PARAM_ASSERT(allegedShortName != NULL);
    ODKERB_PARAM_ASSERT(realm != NULL);
    ODKERB_PARAM_ASSERT(im_handle != 0);
    ODKERB_PARAM_ASSERT(im_handle_size > 0);

    *im_handle = '\0';

    if (userRecord != NULL) {
        /* attempt to get the primary short name from the user record */

        cfShortNames = ODRecordCopyValues(userRecord, kODAttributeTypeRecordName, &cfError);
        if (cfShortNames == NULL || cfError != NULL) {
            ODKERB_LOG_CFERROR(LOG_DEBUG, "Unable to find the short names", cfError);
            /* ignore this error, use the passed in allegedShortName parameter */
        }
        else if (CFArrayGetCount(cfShortNames) == 0) {
            ODKERB_LOG_CFSTRING(LOG_DEBUG, "Unable to find the short names", allegedShortName);
            /* ignore this error, use the passed in allegedShortName parameter */
        }
        else {
            CFStringRef cfShortName = CFArrayGetValueAtIndex(cfShortNames, 0);
            assert(cfShortName != 0);

            shortName = cfShortName;
        }
    }

    cfIMHandle = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@@%@"), shortName, realm);
    if (cfIMHandle == NULL) {
        ODKERB_LOG_ERRNO(LOG_ERR, ENOMEM);
        goto failure;
    }

    if (CFStringGetCString(cfIMHandle, im_handle, im_handle_size-1, kCFStringEncodingUTF8) == FALSE)
        goto failure;

    retval = 0;
failure:
    CF_SAFE_RELEASE(cfError);
    CF_SAFE_RELEASE(cfIMHandle);
    CF_SAFE_RELEASE(cfShortNames);

    return retval;
}
开发者ID:aosm,项目名称:ChatServer,代码行数:53,代码来源:odkerb.c

示例12: __CFNumberCopyFormattingDescription

static CFStringRef __CFNumberCopyFormattingDescription(CFTypeRef cf, CFDictionaryRef formatOptions) {
    CFNumberRef number = (CFNumberRef)cf;
    CFNumberType type = __CFNumberGetType(number);
    if (__CFNumberTypeTable[type].floatBit) {
        return _CFNumberCopyFormattingDescriptionAsFloat64(number);
    }
    CFSInt128Struct i;
    __CFNumberGetValue(number, kCFNumberSInt128Type, &i);
    char buffer[128];
    __CFSInt128Format(buffer, &i, false);
    return CFStringCreateWithFormat(kCFAllocatorSystemDefault, NULL, CFSTR("%s"), buffer);
}
开发者ID:DmitrySkiba,项目名称:itoa-cleancf,代码行数:12,代码来源:CFNumber.c

示例13: GetSignedIntegerBEDataAsString

CFStringRef GetSignedIntegerBEDataAsString(QTPropertyValuePtr keyValuePtr, ByteCount propValueSizeUsed)
{
	require (propValueSizeUsed != 0, NULLVALUEPTR);
	
	SInt32 *keyValAsInt = (SInt32 *)keyValuePtr;
	return (CFStringCreateWithFormat( NULL, NULL,
										CFSTR("%#.*x"),
										propValueSizeUsed, 
										*keyValAsInt));
NULLVALUEPTR:
	return nil;
}
开发者ID:fruitsamples,项目名称:QTMetaData,代码行数:12,代码来源:StringUtils.c

示例14: CFStringCreateWithFormat

// ---------------------------------
void USys::openURL(const char *url) {
    CFStringRef urlString = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s"), url);

    if (urlString) {
        CFURLRef pathRef = CFURLCreateWithString(NULL, urlString, NULL);
        if (pathRef) {
            //OSStatus err = LSOpenCFURLRef( pathRef, NULL );
            CFRelease(pathRef);
        }
        CFRelease(urlString);
    }
}
开发者ID:PyYoshi,项目名称:PeerCastIM-Mod,代码行数:13,代码来源:usys.cpp

示例15: stamp_file

void stamp_file(CFStringRef inStamp)
{
	time_t the_time;
	char timeBuf[32]={0};
	time(&the_time);
	ctime_r(&the_time, timeBuf);
	char* newlin=strchr(timeBuf, '\n');
	if (newlin)
		*newlin=0;
	CFStringRef stamp = CFStringCreateWithFormat(kCFAllocatorDefault,NULL,CFSTR("\n![%@ : %s]\n"),inStamp,timeBuf);
	write_buffer(stamp);
}
开发者ID:ChaseJohnson,项目名称:LogKext,代码行数:12,代码来源:logKextDaemon.cpp


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