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

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

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

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

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

示例1: SOSCoderStart

// Start OTR negotiation if we haven't already done so.SOSCoderStatusSOSCoderStart(SOSCoderRef coder, CFErrorRef *error) {    CFMutableStringRef action = CFStringCreateMutable(kCFAllocatorDefault, 0);    CFStringRef beginState = NULL;    SOSCoderStatus result = kSOSCoderFailure;    CFMutableDataRef startPacket = NULL;    require_action_quiet(coder->sessRef, coderFailure, CFStringAppend(action, CFSTR("*** no otr session ***")));    beginState = CFCopyDescription(coder->sessRef);    require_action_quiet(!coder->waitingForDataPacket, negotiatingOut, CFStringAppend(action, CFSTR("waiting for peer to send first data packet")));    require_action_quiet(!SecOTRSGetIsReadyForMessages(coder->sessRef), coderFailure, CFStringAppend(action, CFSTR("otr session ready"));                         result = kSOSCoderDataReturned);    require_action_quiet(SecOTRSGetIsIdle(coder->sessRef), negotiatingOut, CFStringAppend(action, CFSTR("otr negotiating already")));    require_action_quiet(startPacket = CFDataCreateMutable(kCFAllocatorDefault, 0), coderFailure, SOSCreateError(kSOSErrorAllocationFailure, CFSTR("alloc failed"), NULL, error));    require_quiet(SOSOTRSAppendStartPacket(coder->sessRef, startPacket, error), coderFailure);    CFRetainAssign(coder->pendingResponse, startPacket);negotiatingOut:    result = kSOSCoderNegotiating;coderFailure:    // Uber state log    if (result == kSOSCoderFailure && error && *error)        CFStringAppendFormat(action, NULL, CFSTR(" %@"), *error);    secnotice("coder", "%@ %s %@ %@ returned %s", beginState,              SecOTRPacketTypeString(startPacket), action, coder->sessRef, SOSCoderString(result));    CFReleaseNull(startPacket);    CFReleaseSafe(beginState);    CFRelease(action);    return result;}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:33,


示例2: CFStringCreateByCombiningStrings

CFStringRefCFStringCreateByCombiningStrings (CFAllocatorRef alloc, CFArrayRef theArray,  CFStringRef separatorString){  CFIndex idx;  CFIndex count;  CFMutableStringRef string;  CFStringRef currentString;  CFStringRef ret;    count = CFArrayGetCount (theArray) - 1;  if (count == 0)    return NULL;    string = CFStringCreateMutable (NULL, 0);  idx = 0;  while (idx < count)    {      currentString = (CFStringRef)CFArrayGetValueAtIndex (theArray, idx++);      CFStringAppend (string, currentString);      CFStringAppend (string, separatorString);    }  currentString = CFArrayGetValueAtIndex (theArray, idx);  CFStringAppend (string, currentString);    ret = CFStringCreateCopy (alloc, string);  CFRelease (string);  return ret;}
开发者ID:erichocean,项目名称:myos.android.frameworks,代码行数:29,


示例3: AppendMetaValueStringToDisplayString

CFStringRef AppendMetaValueStringToDisplayString(CFStringRef metaDataValueString, ByteCount propValueSizeUsed){	CFMutableStringRef byteStr = CFStringCreateMutable (kCFAllocatorDefault, 0);	require(byteStr != nil, CANTCREATEMUTABLESTR);		// show count of number of bytes for this piece of data	CFStringRef sizeStr = CFStringCreateWithFormat( kCFAllocatorDefault, 													NULL, 													CFSTR("(%d bytes) : "), 													propValueSizeUsed);	require(sizeStr != nil, CANTCREATESTRWITHFORMAT);		CFStringAppend (byteStr, sizeStr);	CFRelease(sizeStr);	// now append actual data to this string	if (metaDataValueString)	{		CFStringAppend (byteStr, metaDataValueString);	}	CFStringAppend (byteStr, CFSTR(" /n"));	CFStringRef immutableDisplayStr = CFStringCreateCopy (kCFAllocatorDefault, byteStr);	require(immutableDisplayStr != nil, CANTCREATESTRIMMUTABLESTR);		CFRelease(byteStr);		return immutableDisplayStr;	CANTCREATESTRIMMUTABLESTR:CANTCREATESTRWITHFORMAT:	CFRelease(byteStr);CANTCREATEMUTABLESTR:	return nil;	}
开发者ID:fruitsamples,项目名称:QTMetaData,代码行数:35,


示例4: __CFDataCopyDescription

static CFStringRef __CFDataCopyDescription(CFTypeRef cf) {    CFDataRef data = (CFDataRef)cf;    CFMutableStringRef result;    CFIndex idx;    CFIndex len;    const uint8_t *bytes;    len = __CFDataLength(data);    bytes = CFDataGetBytePtr(data);    result = CFStringCreateMutable(CFGetAllocator(data), 0);    CFStringAppendFormat(result, NULL, CFSTR("<CFData %p [%p]>{length = %u, capacity = %u, bytes = 0x"), cf, CFGetAllocator(data), len, __CFDataCapacity(data));    if (24 < len) {        for (idx = 0; idx < 16; idx += 4) {	    CFStringAppendFormat(result, NULL, CFSTR("%02x%02x%02x%02x"), bytes[idx], bytes[idx + 1], bytes[idx + 2], bytes[idx + 3]);	}        CFStringAppend(result, CFSTR(" ... "));        for (idx = len - 8; idx < len; idx += 4) {	    CFStringAppendFormat(result, NULL, CFSTR("%02x%02x%02x%02x"), bytes[idx], bytes[idx + 1], bytes[idx + 2], bytes[idx + 3]);	}    } else {        for (idx = 0; idx < len; idx++) {	    CFStringAppendFormat(result, NULL, CFSTR("%02x"), bytes[idx]);	}    }    CFStringAppend(result, CFSTR("}"));    return result;}
开发者ID:CoherentLabs,项目名称:CoherentWebCoreDependencies,代码行数:26,


示例5: SetServerFromURL

/*  * Get the server name out of the URL. CFURLCopyHostName will escape out the  * server name for us. So just convert it to the correct code page encoding. * * Note: Currently we put the server name into a c-style string. In the future  * it would be nice to keep this as a CFString. */static int SetServerFromURL(struct smb_ctx *ctx, CFURLRef url){	CFIndex maxlen;	CFStringRef serverNameRef = CFURLCopyHostName(url);	char *ipV6Name = NULL;	ipV6Name = CStringCreateWithCFString(serverNameRef);	if (ipV6Name && isIPv6NumericName(ipV6Name)) {        /* CFURLCopyHostName removed the [] so put them back in */        CFMutableStringRef newServer = CFStringCreateMutableCopy(NULL, 1024, CFSTR("["));        if (newServer) {            CFStringAppend(newServer, serverNameRef);            CFStringAppend(newServer, CFSTR("]"));            CFRelease(serverNameRef);            serverNameRef = newServer;        }    }	/* Free up the buffer we allocated */	if (ipV6Name) {		free(ipV6Name);    }        /*	 * Every time we parse the URL we end up replacing the server name. In the 	 * future we should skip replacing the server name if we already have one and	 * the one return CFURLCopyHostName matches it.	 *	 * Not going to make that big of a change in an update, so lets limit to the	 * case were we are dealing with using a domain controller.	 */	if (serverNameRef && ctx->serverNameRef && ctx->serverName &&		(ctx->serverIsDomainController) &&			(ctx->ct_flags & SMBCF_CONNECTED) && 		(CFStringCompare(serverNameRef, ctx->serverNameRef, 0) == kCFCompareEqualTo)) {		CFRelease(serverNameRef);		return 0; /* Same name nothing to do here */	}	if (ctx->serverNameRef) {		CFRelease(ctx->serverNameRef);	}		/* The serverNameRef should always contain the URL host name or the Bonjour Name */	ctx->serverNameRef = serverNameRef;	if (ctx->serverNameRef == NULL)		return EINVAL;	DebugLogCFString(ctx->serverNameRef, "Server", __FUNCTION__, __LINE__);		maxlen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(ctx->serverNameRef), kCFStringEncodingUTF8) + 1;	if (ctx->serverName)		free(ctx->serverName);	ctx->serverName = malloc(maxlen);	if (!ctx->serverName) {		CFRelease(ctx->serverNameRef);		ctx->serverNameRef = NULL;		return ENOMEM;	}	CFStringGetCString(ctx->serverNameRef, ctx->serverName, maxlen, kCFStringEncodingUTF8);	return 0;}
开发者ID:aosm,项目名称:smb,代码行数:66,


示例6: drawTextWithFeature

void drawTextWithFeature(CGContextRef context, CTFontDescriptorRef fontDescriptor, CFStringRef feature, int value, CGPoint location){    CGFloat fontSize = 25;    CGContextSetTextMatrix(context, CGAffineTransformScale(CGAffineTransformIdentity, 1, 1));    CGContextSetTextPosition(context, location.x, location.y);    CFNumberRef featureValue = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &value);    CFTypeRef featureDictionaryKeys[] = { kCTFontOpenTypeFeatureTag, kCTFontOpenTypeFeatureValue };    CFTypeRef featureDictionaryValues[] = { feature, featureValue };    CFDictionaryRef featureDictionary = CFDictionaryCreate(kCFAllocatorDefault, featureDictionaryKeys, featureDictionaryValues, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFRelease(featureValue);    CFTypeRef featureSettingsValues[] = { featureDictionary };    CFArrayRef fontFeatureSettings = CFArrayCreate(kCFAllocatorDefault, featureSettingsValues, 1, &kCFTypeArrayCallBacks);    CFRelease(featureDictionary);    CFTypeRef fontDescriptorKeys[] = { kCTFontFeatureSettingsAttribute };    CFTypeRef fontDescriptorValues[] = { fontFeatureSettings };    CFDictionaryRef fontDescriptorAttributes = CFDictionaryCreate(kCFAllocatorDefault, fontDescriptorKeys, fontDescriptorValues, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFRelease(fontFeatureSettings);    CTFontDescriptorRef modifiedFontDescriptor = CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, fontDescriptorAttributes);    CFRelease(fontDescriptorAttributes);    CTFontRef font = CTFontCreateWithFontDescriptor(modifiedFontDescriptor, fontSize, nullptr);    CFRelease(modifiedFontDescriptor);    CFMutableStringRef string = CFStringCreateMutable(kCFAllocatorDefault, 0);    CFStringAppend(string, feature);    CFStringAppend(string, value ? CFSTR("  (on)") : CFSTR(" (off)"));    CFStringAppend(string, CFSTR(": ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));    CGColorRef red = CGColorCreateGenericRGB(1, 0, 0, 1);    CFTypeRef lineKeys[] = { kCTForegroundColorAttributeName };    CFTypeRef lineValues[] = { red };    CFDictionaryRef lineAttributes = CFDictionaryCreate(kCFAllocatorDefault, lineKeys, lineValues, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CGColorRelease(red);    CFAttributedStringRef attributedString = CFAttributedStringCreate(kCFAllocatorDefault, string, lineAttributes);    CFRelease(lineAttributes);    CFRelease(string);    CFMutableAttributedStringRef mutableAttributedString = CFAttributedStringCreateMutableCopy(kCFAllocatorDefault, 0, attributedString);    CFRelease(attributedString);    CTFontRef monospaceFont = CTFontCreateWithName(CFSTR("Courier"), fontSize, nullptr);    CFAttributedStringSetAttribute(mutableAttributedString, CFRangeMake(0, 12), kCTFontAttributeName, monospaceFont);    CFRelease(monospaceFont);    CFAttributedStringSetAttribute(mutableAttributedString, CFRangeMake(12, 52), kCTFontAttributeName, font);    CFRelease(font);    CTLineRef line = CTLineCreateWithAttributedString(mutableAttributedString);    CFRelease(mutableAttributedString);    CTLineDraw(line, context);    CFRelease(line);}
开发者ID:rodrigo-speller,项目名称:webkit,代码行数:58,


示例7: get_device_infos

void get_device_infos(CFMutableDictionaryRef out) {    CC_SHA1_CTX sha1ctx;    uint8_t udid[20];    char udid1[100];    CFStringRef serial;    CFStringRef imei;    CFStringRef macwifi;    CFStringRef macbt;        CFStringRef hw = copy_hardware_model();     if (hw != NULL)    {        CFDictionaryAddValue(out, CFSTR("hwModel"), hw);        CFRelease(hw);    }        serial = copy_device_serial_number();    imei = copy_device_imei();    macwifi = copy_wifi_mac_address();    macbt = copy_bluetooth_mac_address();        CFMutableStringRef udidInput = CFStringCreateMutable(kCFAllocatorDefault, 0);    if (serial != NULL)    {        CFStringAppend(udidInput, serial);        CFDictionaryAddValue(out, CFSTR("serialNumber"), serial);        CFRelease(serial);    }    if (imei != NULL)    {        CFStringAppend(udidInput, imei);        CFDictionaryAddValue(out, CFSTR("imei"), imei);        CFRelease(imei);    }    if (macwifi != NULL)    {        CFStringAppend(udidInput, macwifi);        CFDictionaryAddValue(out, CFSTR("wifiMac"), macwifi);        CFRelease(macwifi);    }    if (macbt != NULL)    {        CFStringAppend(udidInput, macbt);        CFDictionaryAddValue(out, CFSTR("btMac"), macbt);        CFRelease(macbt);    }        CFStringGetCString(udidInput, udid1, 99, kCFStringEncodingASCII);        CC_SHA1_Init(&sha1ctx);    CC_SHA1_Update(&sha1ctx, udid1, CFStringGetLength(udidInput));    CC_SHA1_Final(udid, &sha1ctx);        CFRelease(udidInput);    addHexaString(out, CFSTR("udid"), udid, 20);}
开发者ID:HaHa80,项目名称:iOS-DataProtection,代码行数:57,


示例8: __DAMountMapCreate2

static CFDictionaryRef __DAMountMapCreate2( CFAllocatorRef allocator, struct vsdb * vs ){    CFStringRef            idAsString;    CFMutableDictionaryRef map = NULL;    idAsString = CFStringCreateWithCString( kCFAllocatorDefault, vs->vs_spec, kCFStringEncodingUTF8 );    if ( idAsString )    {        CFTypeRef id;        id = _DAFileSystemCreateUUIDFromString( kCFAllocatorDefault, idAsString );        if ( id )        {            map = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );            if ( map )            {                CFMutableStringRef options;                options = CFStringCreateMutable( kCFAllocatorDefault, 0 );                if ( options )                {                    if ( ( vs->vs_ops & VSDB_PERM ) )                    {                        CFStringAppend( options, CFSTR( "owners" ) );                        CFStringAppend( options, CFSTR( "," ) );                    }                    else                    {                        CFStringAppend( options, CFSTR( "noowners" ) );                        CFStringAppend( options, CFSTR( "," ) );                    }                    if ( CFStringGetLength( options ) )                    {                        CFStringTrim( options, CFSTR( "," ) );                        CFDictionarySetValue( map, kDAMountMapMountOptionsKey, options );                    }                    CFRelease( options );                }                CFDictionarySetValue( map, kDAMountMapProbeIDKey, id );            }            CFRelease( id );        }        CFRelease( idAsString );    }    return map;}
开发者ID:carriercomm,项目名称:osx-2,代码行数:57,


示例9: EndpointName

// ____________________________________________________________________________// Obtain the name of an endpoint without regard for whether it has connections.// The result should be released by the caller.static CFStringRef EndpointName(MIDIEndpointRef endpoint, bool isExternal) {    CFMutableStringRef result = CFStringCreateMutable(NULL, 0);    CFStringRef str;        // begin with the endpoint's name    str = NULL;    MIDIObjectGetStringProperty(endpoint, kMIDIPropertyName, &str);    if (str != NULL) {        CFStringAppend(result, str);        CFRelease(str);    }        MIDIEntityRef entity = NULL;    MIDIEndpointGetEntity(endpoint, &entity);    if (entity == NULL)        // probably virtual        return result;        if (CFStringGetLength(result) == 0) {        // endpoint name has zero length -- try the entity        str = NULL;        MIDIObjectGetStringProperty(entity, kMIDIPropertyName, &str);        if (str != NULL) {            CFStringAppend(result, str);            CFRelease(str);        }    }    // now consider the device's name    MIDIDeviceRef device = NULL;    MIDIEntityGetDevice(entity, &device);    if (device == NULL)        return result;        str = NULL;    MIDIObjectGetStringProperty(device, kMIDIPropertyName, &str);    if (str != NULL) {        // if an external device has only one entity, throw away the endpoint name and just use the device name        if (isExternal && MIDIDeviceGetNumberOfEntities(device) < 2) {            CFRelease(result);            return str;        }        else {            // does the entity name already start with the device name? (some drivers do this though they shouldn't)            // if so, do not prepend            if (CFStringCompareWithOptions(str /* device name */, result /* endpoint name */, CFRangeMake(0, CFStringGetLength(str)), 0) != kCFCompareEqualTo) {                // prepend the device name to the entity name                if (CFStringGetLength(result) > 0)                    CFStringInsert(result, 0, CFSTR(" "));                CFStringInsert(result, 0, str);            }            CFRelease(str);        }    }    return result;}
开发者ID:adamnemecek,项目名称:notion,代码行数:58,


示例10: CFBundleGetBundleWithIdentifier

CFStringRef Resources::getResourcesPathFromBundleId() { //@@TODO    char buffer[PATH_MAX];    CFBundleRef bundle = CFBundleGetBundleWithIdentifier(CFSTR("SuperColldierAU") );    if (bundle == NULL) return NULL;    CFURLRef bundleURL = CFBundleCopyBundleURL(bundle);    CFURLGetFileSystemRepresentation(bundleURL, TRUE, (UInt8*)buffer,PATH_MAX);    CFStringRef bundlePath = CFStringCreateWithCString(NULL,buffer, kCFStringEncodingUTF8);    CFURLRef bundleResourcesURL = CFBundleCopyResourcesDirectoryURL(bundle);    CFStringRef resourcesRelativePath = CFURLGetString(bundleResourcesURL);    CFMutableStringRef resourcesPath = CFStringCreateMutable(NULL,0);    CFStringAppend(resourcesPath,bundlePath);    CFStringAppend(resourcesPath,resourcesRelativePath);    return resourcesPath;}
开发者ID:2mc,项目名称:supercollider,代码行数:14,


示例11: ConnectedEndpointName

// Obtain the name of an endpoint, following connections.// The result should be released by the caller.static CFStringRef ConnectedEndpointName(MIDIEndpointRef endpoint) {    CFMutableStringRef result = CFStringCreateMutable(NULL, 0);    CFStringRef str;    OSStatus err;        // Does the endpoint have connections?    CFDataRef connections = NULL;    int nConnected = 0;    bool anyStrings = false;    err = MIDIObjectGetDataProperty(endpoint, kMIDIPropertyConnectionUniqueID, &connections);    if (connections != NULL) {        // It has connections, follow them        // Concatenate the names of all connected devices        nConnected = CFDataGetLength(connections) / sizeof(MIDIUniqueID);        if (nConnected) {            const SInt32 *pid = reinterpret_cast <const SInt32 *>(CFDataGetBytePtr(connections));            for (int i = 0; i < nConnected; ++i, ++pid) {                MIDIUniqueID id = EndianS32_BtoN(*pid);                MIDIObjectRef connObject;                MIDIObjectType connObjectType;                err = MIDIObjectFindByUniqueID(id, &connObject, &connObjectType);                if (err == noErr) {                    if (connObjectType == kMIDIObjectType_ExternalSource                        || connObjectType == kMIDIObjectType_ExternalDestination) {                        // Connected to an external device's endpoint (10.3 and later).                        str = EndpointName(static_cast <MIDIEndpointRef>(connObject), true);                    }                    else {                        // Connected to an external device (10.2) (or something else, catch-all)                        str = NULL;                        MIDIObjectGetStringProperty(connObject, kMIDIPropertyName, &str);                    }                    if (str != NULL) {                        if (anyStrings)                            CFStringAppend(result, CFSTR(", "));                        else anyStrings = true;                        CFStringAppend(result, str);                        CFRelease(str);                    }                }            }        }        CFRelease(connections);    }    if (anyStrings)        return result;        // Here, either the endpoint had no connections, or we failed to obtain names for any of them.    return EndpointName(endpoint, false);}
开发者ID:adamnemecek,项目名称:notion,代码行数:52,


示例12: FindJnlpURLInFile

static CFURLRef FindJnlpURLInFile(char* fileName) {    XMLNode* doc = NULL;    CFURLRef returnValue = NULL;    char* jnlbuffer = NULL;    /* Parse XML document. */    if (!ReadFileToBuffer(fileName, &jnlbuffer)) {        return NULL;    }    doc = ParseXMLDocument(jnlbuffer);    if (doc != NULL) {        XMLNode* node = NULL;        char *codebase = NULL;        char *href = NULL;        CFStringRef baseURLString = NULL;        CFStringRef hrefString = NULL;        CFMutableStringRef fullURL = NULL;        node = FindXMLChild(doc, "jnlp");        require(node != NULL, bail);        codebase = FindXMLAttribute(node->_attributes, "codebase");        require(codebase != NULL, bail);        href = FindXMLAttribute(node->_attributes, "href");        require(href != NULL, bail);        baseURLString = CFStringCreateWithCString(NULL, codebase, kCFStringEncodingUTF8);        require(baseURLString != NULL, bail);        fullURL = CFStringCreateMutableCopy(NULL, 0, baseURLString);        hrefString = CFStringCreateWithCString(NULL, href, kCFStringEncodingUTF8);        require(hrefString != NULL, bail);        // a relative JNLP path needs a URL that starts at the specificed codebase        if (!CFStringHasSuffix(fullURL, CFSTR("/")))            CFStringAppend(fullURL, CFSTR("/"));        CFStringAppend(fullURL, hrefString);        returnValue = CFURLCreateWithString(NULL, fullURL, NULL);bail:        if (baseURLString != NULL) CFRelease(baseURLString);        if (hrefString != NULL) CFRelease(hrefString);        if (fullURL != NULL) CFRelease(fullURL);        FreeXMLDocument(doc);    }    free(jnlbuffer);    return returnValue;}
开发者ID:Spronovost,项目名称:documentation,代码行数:49,


示例13: __CFArrayCopyDescription

static CFStringRef __CFArrayCopyDescription(CFTypeRef cf) {    CFArrayRef array = (CFArrayRef)cf;    CFMutableStringRef result;    const CFArrayCallBacks *cb;    CFAllocatorRef allocator;    CFIndex idx, cnt;    cnt = __CFArrayGetCount(array);    allocator = CFGetAllocator(array);    result = CFStringCreateMutable(allocator, 0);    switch (__CFArrayGetType(array)) {    case __kCFArrayImmutable:	CFStringAppendFormat(result, NULL, CFSTR("<CFArray %p [%p]>{type = immutable, count = %lu, values = (%s"), cf, allocator, (unsigned long)cnt, cnt ? "/n" : "");	break;    case __kCFArrayDeque:	CFStringAppendFormat(result, NULL, CFSTR("<CFArray %p [%p]>{type = mutable-small, count = %lu, values = (%s"), cf, allocator, (unsigned long)cnt, cnt ? "/n" : "");	break;    }    cb = __CFArrayGetCallBacks(array);    for (idx = 0; idx < cnt; idx++) {	CFStringRef desc = NULL;	const void *val = __CFArrayGetBucketAtIndex(array, idx)->_item;	if (NULL != cb->copyDescription) {	    desc = (CFStringRef)INVOKE_CALLBACK1(cb->copyDescription, val);	}	if (NULL != desc) {	    CFStringAppendFormat(result, NULL, CFSTR("/t%lu : %@/n"), (unsigned long)idx, desc);	    CFRelease(desc);	} else {	    CFStringAppendFormat(result, NULL, CFSTR("/t%lu : <%p>/n"), (unsigned long)idx, val);	}    }    CFStringAppend(result, CFSTR(")}"));    return result;}
开发者ID:goodcyg,项目名称:swift-corelibs-foundation,代码行数:34,


示例14: CreateURLFromReferral

/* * Given a Dfs Referral string create a CFURL. Remember referral have a file * syntax *  * Example: "/smb-win2003.apple.com/DfsRoot/DfsLink1" */CFURLRef CreateURLFromReferral(CFStringRef inStr){	CFURLRef ct_url = NULL;	CFMutableStringRef urlString = CFStringCreateMutableCopy(NULL, 0, CFSTR("smb:/"));	CFStringRef escapeStr = inStr;	    /*      * CreateStringByAddingPercentEscapesUTF8() will either create a new string     * or return the original with ref count incremented. Either way we have to     * call CFRelease on the returned string      */	CreateStringByAddingPercentEscapesUTF8(&escapeStr, NULL, NULL, FALSE);	if (urlString) {		CFStringAppend(urlString, escapeStr);		ct_url = CFURLCreateWithString(kCFAllocatorDefault, urlString, NULL);		CFRelease(urlString);	/* We create it now release it */	}    	if (!ct_url) {		LogCFString(inStr, "creating url failed", __FUNCTION__, __LINE__);	}        if (escapeStr) {        CFRelease(escapeStr);    }   	return ct_url;}
开发者ID:aosm,项目名称:smb,代码行数:35,


示例15: __CFBinaryHeapCopyDescription

static CFStringRef __CFBinaryHeapCopyDescription(CFTypeRef cf) {    CFBinaryHeapRef heap = (CFBinaryHeapRef)cf;    CFMutableStringRef result;    CFIndex idx;    CFIndex cnt;    const void **list, *buffer[256];    cnt = __CFBinaryHeapCount(heap);    result = CFStringCreateMutable(CFGetAllocator(heap), 0);    CFStringAppendFormat(result, NULL, CFSTR("<CFBinaryHeap %p [%p]>{count = %lu, capacity = %lu, objects = (/n"), cf, CFGetAllocator(heap), (unsigned long)cnt, (unsigned long)__CFBinaryHeapCapacity(heap));    list = (cnt <= 128) ? (const void **)buffer : (const void **)CFAllocatorAllocate(kCFAllocatorSystemDefault, cnt * sizeof(void *), 0); // GC OK    if (__CFOASafe && list != buffer) __CFSetLastAllocationEventName(list, "CFBinaryHeap (temp)");    CFBinaryHeapGetValues(heap, list);    for (idx = 0; idx < cnt; idx++) {	CFStringRef desc = NULL;	const void *item = list[idx];	if (NULL != heap->_callbacks.copyDescription) {	    desc = heap->_callbacks.copyDescription(item);	}	if (NULL != desc) {	    CFStringAppendFormat(result, NULL, CFSTR("/t%lu : %@/n"), (unsigned long)idx, desc);	    CFRelease(desc);	} else {	    CFStringAppendFormat(result, NULL, CFSTR("/t%lu : <%p>/n"), (unsigned long)idx, item);	}    }    CFStringAppend(result, CFSTR(")}"));    if (list != buffer) CFAllocatorDeallocate(CFGetAllocator(heap), list); // GC OK    return result;}
开发者ID:Design-Complex,项目名称:CFLite,代码行数:29,


示例16: BIMCreatePortName

static CFStringRef BIMCreatePortName( const ProcessSerialNumber *inProcessSerialNumber ){    CFMutableStringRef	portName;    CFStringRef		processSerialNumberStringRef;    Str255		processSerialNumberString;    Str255		processSerialNumberLowString;    //  Convert the high and low parts of the process serial number into a string.    NumToString( inProcessSerialNumber->highLongOfPSN, processSerialNumberString );    NumToString( inProcessSerialNumber->lowLongOfPSN, processSerialNumberLowString );    BlockMoveData( processSerialNumberLowString + 1,                   processSerialNumberString + processSerialNumberString [0] + 1,                   processSerialNumberLowString [0] );    processSerialNumberString [0] += processSerialNumberLowString [0];    //  Create a CFString and append the process serial number string onto the end.    portName = CFStringCreateMutableCopy( NULL, 255, CFSTR( kBasicServerPortName ) );    processSerialNumberStringRef = CFStringCreateWithPascalString( NULL,                                                                   processSerialNumberString,                                                                   CFStringGetSystemEncoding() );    CFStringAppend( portName, processSerialNumberStringRef );    CFRelease( processSerialNumberStringRef );    return portName;}
开发者ID:fruitsamples,项目名称:BasicInputMethod,代码行数:26,


示例17: TargetNameCreatedWithHostName

/*  * Create the target name using the host name. Note we will use the  * GSS_C_NT_HOSTBASE name type of [email
C++ CFStringAppendFormat函数代码示例
C++ CFShow函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。