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

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

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

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

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

示例1: iSCSIKernelGetSessionIdForTargetIQN

/*! Looks up the session identifier associated with a particular target name. *  @param targetIQN the IQN name of the target (e.q., iqn.2015-01.com.example) *  @return sessionId the session identifier. */SID iSCSIKernelGetSessionIdForTargetIQN(CFStringRef targetIQN){    if(!targetIQN)        return kiSCSIInvalidSessionId;        const UInt32 expOutputCnt = 1;    UInt64 output[expOutputCnt];    UInt32 outputCnt = expOutputCnt;    kern_return_t result = IOConnectCallMethod(        connection,        kiSCSIGetSessionIdForTargetIQN,0,0,        (const void*)CFStringGetCStringPtr(targetIQN,kCFStringEncodingASCII),        CFStringGetLength(targetIQN)+1,        output,&outputCnt,0,0);        if(result == kIOReturnSuccess && outputCnt == expOutputCnt)        return (SID)output[0];        return kiSCSIInvalidSessionId;}
开发者ID:anvena,项目名称:iSCSIInitiator,代码行数:24,


示例2: stransport_error

int stransport_error(OSStatus ret){	CFStringRef message;	if (ret == noErr || ret == errSSLClosedGraceful) {		giterr_clear();		return 0;	}#if !TARGET_OS_IPHONE	message = SecCopyErrorMessageString(ret, NULL);	GITERR_CHECK_ALLOC(message);	giterr_set(GITERR_NET, "SecureTransport error: %s", CFStringGetCStringPtr(message, kCFStringEncodingUTF8));	CFRelease(message);#else    giterr_set(GITERR_NET, "SecureTransport error: OSStatus %d", (unsigned int)ret);#endif	return -1;}
开发者ID:Angolier,项目名称:sonic-pi,代码行数:21,


示例3: AEDescCreateUTF8Text

OSErr AEDescCreateUTF8Text(CFStringRef string, AEDesc* outDescPtr){	OSErr err = noErr;	CFStringEncoding kEncoding = kCFStringEncodingUTF8;	DescType resultType = typeUTF8Text;	const char *constBuff = CFStringGetCStringPtr(string, kEncoding);	if (constBuff == NULL) {		char *buffer;		CFIndex charLen = CFStringGetLength(string);		CFIndex maxLen = CFStringGetMaximumSizeForEncoding(charLen, kEncoding)+1; // +1 is for null termination.		buffer = malloc(sizeof(char)*maxLen);		CFStringGetCString(string, buffer, maxLen, kEncoding);		err = AECreateDesc(resultType, buffer, strlen(buffer), outDescPtr);		free(buffer);	}	else {		err=AECreateDesc(resultType, constBuff, strlen(constBuff), outDescPtr);	}		return err;}
开发者ID:tkurita,项目名称:AEUtils,代码行数:21,


示例4: 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:CiaccoDavide,项目名称:logKext,代码行数:21,


示例5: Q_UNUSED

//! Get the serial number for a HID deviceQString pjrc_rawhid::getserial(int num) {    Q_UNUSED(num);    QMutexLocker locker(m_readMutex);    Q_UNUSED(locker);    if (!device_open || unplugged)        return "";    CFTypeRef serialnum = IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDSerialNumberKey));    if(serialnum && CFGetTypeID(serialnum) == CFStringGetTypeID())    {        //Note: I'm not sure it will always succeed if encoded as MacRoman but that        //is a superset of UTF8 so I think this is fine        CFStringRef str = (CFStringRef)serialnum;        const char * buf = CFStringGetCStringPtr(str, kCFStringEncodingMacRoman);        return QString(buf);    }    return QString("Error");}
开发者ID:Crash1,项目名称:TauLabs,代码行数:22,


示例6: while

vector<string> DeckLinkController::getDeviceNameList()  {	vector<string> nameList;	int deviceIndex = 0;		while (deviceIndex < deviceList.size()) {		CFStringRef cfStrName;				// Get the name of this device		if (deviceList[deviceIndex]->GetDisplayName(&cfStrName) == S_OK) {			nameList.push_back(string(CFStringGetCStringPtr(cfStrName, kCFStringEncodingMacRoman)));			CFRelease(cfStrName);		}		else {			nameList.push_back("DeckLink");		}				deviceIndex++;	}		return nameList;}
开发者ID:shks,项目名称:DoubleFishEyeGrabber,代码行数:21,


示例7: SecPolicyCreateSSL

/* new in 10.6 */SecPolicyRefSecPolicyCreateSSL(Boolean server, CFStringRef hostname){    // return a SecPolicyRef object for the SSL policy, given hostname and client options    SecPolicyRef policy = nil;    SecPolicySearchRef policySearch = nil;    OSStatus status = SecPolicySearchCreate(CSSM_CERT_X_509v3, &CSSMOID_APPLE_TP_SSL, NULL, &policySearch);    if (!status) {        status = SecPolicySearchCopyNext(policySearch, &policy);    }    if (!status && policy) {        // set options for client-side or server-side policy evaluation		char *strbuf = NULL;		const char *hostnamestr = NULL;		if (hostname) {			CFIndex strbuflen = 0;			hostnamestr = CFStringGetCStringPtr(hostname, kCFStringEncodingUTF8);			if (hostnamestr == NULL) {				strbuflen = CFStringGetLength(hostname)*6;				strbuf = (char *)malloc(strbuflen+1);				if (CFStringGetCString(hostname, strbuf, strbuflen, kCFStringEncodingUTF8)) {					hostnamestr = strbuf;				}			}		}        uint32 hostnamelen = (hostnamestr) ? strlen(hostnamestr) : 0;        uint32 flags = (!server) ? CSSM_APPLE_TP_SSL_CLIENT : 0;        CSSM_APPLE_TP_SSL_OPTIONS opts = {CSSM_APPLE_TP_SSL_OPTS_VERSION, hostnamelen, hostnamestr, flags};        CSSM_DATA data = {sizeof(opts), (uint8*)&opts};        SecPolicySetValue(policy, &data);				if (strbuf) {			free(strbuf);		}    }	if (policySearch) {		CFRelease(policySearch);	}    return policy;}
开发者ID:phinze,项目名称:libsecurity_keychain,代码行数:41,


示例8: mount_developer_image

void mount_developer_image(AMDeviceRef device) {    CFStringRef ds_path = copy_device_support_path(device);    CFStringRef image_path = copy_developer_disk_image_path(device);    CFStringRef sig_path = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@.signature"), image_path);    CFRelease(ds_path);    if (verbose) {        printf("Device support path: ");        fflush(stdout);        CFShow(ds_path);        printf("Developer disk image: ");        fflush(stdout);        CFShow(image_path);    }    FILE* sig = fopen(CFStringGetCStringPtr(sig_path, kCFStringEncodingMacRoman), "rb");    void *sig_buf = malloc(128);    assert(fread(sig_buf, 1, 128, sig) == 128);    fclose(sig);    CFDataRef sig_data = CFDataCreateWithBytesNoCopy(NULL, sig_buf, 128, NULL);    CFRelease(sig_path);    CFTypeRef keys[] = { CFSTR("ImageSignature"), CFSTR("ImageType") };    CFTypeRef values[] = { sig_data, CFSTR("Developer") };    CFDictionaryRef options = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);    CFRelease(sig_data);    int result = AMDeviceMountImage(device, image_path, options, &mount_callback, 0);    if (result == 0) {        printf("[ 95%%] Developer disk image mounted successfully/n");    } else if (result == 0xe8000076 /* already mounted */) {        printf("[ 95%%] Developer disk image already mounted/n");    } else {        printf("[ !! ] Unable to mount developer disk image. (%x)/n", result);        exit(1);    }    CFRelease(image_path);    CFRelease(options);}
开发者ID:ccastleb,项目名称:fruitstrap,代码行数:40,


示例9: SCDynamicStoreCreate

/* return AD realm if it exists */const char *get_ad_realm ( struct auth_request *auth_request ){	const char *out_realm = NULL;	SCDynamicStoreRef store = SCDynamicStoreCreate(kCFAllocatorDefault, CFSTR("dovecot.digest.auth"), NULL, NULL);	if ( store ) {		CFDictionaryRef dict = SCDynamicStoreCopyValue(store, CFSTR("com.apple.opendirectoryd.ActiveDirectory"));		if (dict) {			CFStringRef domain = CFDictionaryGetValue(dict, CFSTR("DomainNameFlat"));			if (domain) {				const char *ad_realm = CFStringGetCStringPtr(domain, kCFStringEncodingUTF8);				if (ad_realm) {					auth_request_log_info(auth_request, "digest-md5", "ad realm: %s", ad_realm);					out_realm = t_strdup(ad_realm);				}			}			CFRelease(dict);		}		CFRelease(store);	}	return( out_realm );}
开发者ID:unofficial-opensource-apple,项目名称:dovecot,代码行数:23,


示例10: ios_open_from_bundle

static FILE* ios_open_from_bundle(const char path[], const char* perm) {    // Get a reference to the main bundle    CFBundleRef mainBundle = CFBundleGetMainBundle();    // Get a reference to the file's URL    CFStringRef pathRef = CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8);    CFURLRef imageURL = CFBundleCopyResourceURL(mainBundle, pathRef, NULL, NULL);    if (!imageURL) {        return nullptr;    }    // Convert the URL reference into a string reference    CFStringRef imagePath = CFURLCopyFileSystemPath(imageURL, kCFURLPOSIXPathStyle);    // Get the system encoding method    CFStringEncoding encodingMethod = CFStringGetSystemEncoding();    // Convert the string reference into a C string    const char *finalPath = CFStringGetCStringPtr(imagePath, encodingMethod);    return fopen(finalPath, perm);}
开发者ID:03050903,项目名称:skia,代码行数:22,


示例11: CFURLCreateFromFSRef

/** * Get the location for global or user-local support files. * @return NULL if it could not be determined */char *Bgetsupportdir(int global){    char *dir = NULL;    #ifdef __APPLE__	FSRef ref;	CFStringRef str;	CFURLRef base;	const char *s;		if (FSFindFolder(global ? kLocalDomain : kUserDomain,					 kApplicationSupportFolderType,					 kDontCreateFolder, &ref) < 0) return NULL;	base = CFURLCreateFromFSRef(NULL, &ref);	if (!base) {        return NULL;    }    	str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);	CFRelease(base);	if (!str) {        return NULL;    }    	s = CFStringGetCStringPtr(str, CFStringGetSystemEncoding());	if (s) {        dir = strdup(s);    }	CFRelease(str);#else    if (!global) {        dir = Bgethomedir();    }#endif    	return dir;}
开发者ID:Hendricks266,项目名称:jfbuild,代码行数:43,


示例12: switch

const void *subsurface_get_conf(char *name, pref_type_t type){	CFStringRef dict_entry;	/* if no settings exist, we return the value for FALSE */	if (!propertyList)		return NULL;	switch (type) {	case PREF_BOOL:		dict_entry = CFDictionaryGetValue(propertyList, CFSTR_VAR(name));		if (dict_entry && ! CFStringCompare(CFSTR("1"), dict_entry, 0))			return (void *) 1;		else			return NULL;	case PREF_STRING:		return CFStringGetCStringPtr(CFDictionaryGetValue(propertyList,						CFSTR_VAR(name)), kCFStringEncodingMacRoman);	}	/* we shouldn't get here, but having this line makes the compiler happy */	return NULL;}
开发者ID:vavincavent,项目名称:subsurface,代码行数:22,


示例13: PrintSpeedForDisc

static IOReturnPrintSpeedForDisc ( io_object_t opticalMedia ){		IOReturn				error 		= kIOReturnError;	CFMutableDictionaryRef	properties 	= NULL;	CFStringRef				bsdNode		= NULL;	const char *			bsdName		= NULL;		error = IORegistryEntryCreateCFProperties ( opticalMedia,												&properties,												kCFAllocatorDefault,												kNilOptions );	require ( ( error == kIOReturnSuccess ), ErrorExit );		bsdNode = ( CFStringRef ) CFDictionaryGetValue ( properties, CFSTR ( kIOBSDNameKey ) );	require ( ( bsdNode != NULL ), ReleaseProperties );		bsdName = CFStringGetCStringPtr ( bsdNode, CFStringGetSystemEncoding ( ) );	require ( ( bsdName != NULL ), ReleaseProperties );		error = PrintSpeedForBSDNode ( bsdName );	require ( ( error == kIOReturnSuccess ), ReleaseProperties );		ReleaseProperties:			require_quiet ( ( properties != NULL ), ErrorExit );	CFRelease ( properties );	properties = NULL;		ErrorExit:			return error;	}
开发者ID:unofficial-opensource-apple,项目名称:IOSCSIArchitectureModelFamily,代码行数:39,


示例14: cfstring2cstring

static char *cfstring2cstring(CFStringRef string){    CFIndex len;    char *str;    str = (char *) CFStringGetCStringPtr(string, kCFStringEncodingUTF8);    if (str)        return strdup(str);    len = CFStringGetLength(string);    len = 1 + CFStringGetMaximumSizeForEncoding(len, kCFStringEncodingUTF8);    str = malloc(len);    if (str == NULL)        return NULL;    if (!CFStringGetCString (string, str, len, kCFStringEncodingUTF8)) {        free (str);        return NULL;    }    return str;}
开发者ID:SimonWilkinson,项目名称:heimdal,代码行数:22,


示例15: ST_ID3v1_setYearStr

ST_FUNC ST_Error ST_ID3v1_setYearStr(ST_ID3v1 *tag, CFStringRef s) {    char *prev = tag->year;    const char *str;    char tmp[5];    /* Make sure they aren't doing anything screwy */    if(!tag || tag->base.type != ST_TagType_ID3v1)        return ST_Error_InvalidArgument;    else if(CFStringGetLength(s) != 4)        return ST_Error_InvalidArgument;    if(!s) {        free(tag->year);        tag->year = NULL;        return ST_Error_None;    }    /* Grab the ISO-8859-1 representation of the string */    if(!(str = CFStringGetCStringPtr(s, kCFStringEncodingISOLatin1))) {        if(!CFStringGetCString(s, tmp, 5, kCFStringEncodingISOLatin1))            return ST_Error_InvalidEncoding;        str = tmp;    }    /* One last sanity check... */    if(strlen(str) != 4 || (!is_8859digit(str[0]) || !is_8859digit(str[1]) ||                            !is_8859digit(str[2]) || !is_8859digit(str[3])))        return ST_Error_InvalidArgument;    /* Copy it in */    if((tag->year = strdup(str))) {        free(prev);        return ST_Error_None;    }    tag->year = prev;    return ST_Error_errno;}
开发者ID:ljsebald,项目名称:SonatinaTag,代码行数:39,


示例16: digestString

static CFDataRefdigestString(CFStringRef str){	CFDataRef retval = NULL; 	CFErrorRef error = NULL;        CFDataRef inputString = CFStringCreateExternalRepresentation(kCFAllocatorDefault, str, kCFStringEncodingUTF8, 0xff);        SecTransformRef	digestTrans = SecDigestTransformCreate(kSecDigestSHA2, 256, &error);    if(error == NULL) {        SecTransformSetAttribute(digestTrans, kSecTransformInputAttributeName, inputString, &error);        if(error == NULL) {        	retval = SecTransformExecute(digestTrans, &error);            if(retval == NULL) {                secDebug(ASL_LEVEL_ERR, "Couldn't create digest %s/n", CFStringGetCStringPtr(CFErrorCopyFailureReason(error), kCFStringEncodingUTF8));            }        }        CFRelease(digestTrans);    }    CFRelease(inputString);    return retval;}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:22,


示例17: setCFString

static ST_Error setCFString(ST_ID3v1 *tag, char **ptr, CFStringRef s) {    char *prev = *ptr;    const char *str;    char tmp[31];    /* Make sure they aren't doing anything screwy */    if(!tag || tag->base.type != ST_TagType_ID3v1)        return ST_Error_InvalidArgument;    else if(CFStringGetLength(s) > 30)        return ST_Error_InvalidArgument;    if(!s) {        free(prev);        *ptr = NULL;        return ST_Error_None;    }    /* Grab the ISO-8859-1 representation of the string */    if(!(str = CFStringGetCStringPtr(s, kCFStringEncodingISOLatin1))) {        if(!CFStringGetCString(s, tmp, 31, kCFStringEncodingISOLatin1))            return ST_Error_InvalidEncoding;        str = tmp;    }    /* One last sanity check... */    if(strlen(str) > 30)        return ST_Error_InvalidArgument;    /* Copy it in */    if((*ptr = strdup(str))) {        free(prev);        return ST_Error_None;    }    *ptr = prev;    return ST_Error_errno;}
开发者ID:ljsebald,项目名称:SonatinaTag,代码行数:38,


示例18: VuoText_makeFromMacString

/** * Creates a VuoText value from a @c CFStringRef. */VuoText VuoText_makeFromMacString(CFStringRef cfString){	// http://stackoverflow.com/questions/1609565/whats-the-cfstring-equiv-of-nsstrings-utf8string	const char *useUTF8StringPtr = NULL;	char *freeUTF8StringPtr = NULL;	if ((useUTF8StringPtr = CFStringGetCStringPtr(cfString, kCFStringEncodingUTF8)) == NULL)	{		CFIndex stringLength = CFStringGetLength(cfString);		CFIndex maxBytes = 4 * stringLength + 1;		freeUTF8StringPtr = malloc(maxBytes);		CFStringGetCString(cfString, freeUTF8StringPtr, maxBytes, kCFStringEncodingUTF8);		useUTF8StringPtr = freeUTF8StringPtr;	}	VuoText text = VuoText_make(useUTF8StringPtr);	if (freeUTF8StringPtr != NULL)		free(freeUTF8StringPtr);	return text;}
开发者ID:bradparks,项目名称:vuo,代码行数:26,


示例19: MYCFStringGetUTF8String

const char * MYCFStringGetUTF8String(CFStringRef aString,                                      char **buffer) {  if (aString == NULL) {    return NULL;  }    const char *cstr = CFStringGetCStringPtr(aString,                                            kCFStringEncodingUTF8);  if (cstr == NULL) {    CFIndex length = CFStringGetLength(aString);    CFIndex maxSize =    CFStringGetMaximumSizeForEncoding(length,                                      kCFStringEncodingUTF8) + 1; // +1 for NULL    if (maxSize > malloc_size(buffer)) {      *buffer = realloc(*buffer, maxSize);    }    if (CFStringGetCString(aString, *buffer, maxSize,                           kCFStringEncodingUTF8)) {      cstr = *buffer;    }  }  return cstr;}
开发者ID:344812082,项目名称:ios6ptl,代码行数:23,


示例20: LOG

PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(SharedBuffer* data){    LOG(Archives, "LegacyWebArchive - Creating from raw data");        RefPtr<LegacyWebArchive> archive = create();            ASSERT(data);    if (!data)        return 0;            RetainPtr<CFDataRef> cfData(AdoptCF, data->createCFData());    if (!cfData)        return 0;            CFStringRef errorString = 0;        RetainPtr<CFDictionaryRef> plist(AdoptCF, static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(0, cfData.get(), kCFPropertyListImmutable, &errorString)));    if (!plist) {#ifndef NDEBUG        const char* cError = errorString ? CFStringGetCStringPtr(errorString, kCFStringEncodingUTF8) : "unknown error";        LOG(Archives, "LegacyWebArchive - Error parsing PropertyList from archive data - %s", cError);#endif        if (errorString)            CFRelease(errorString);        return 0;    }        if (CFGetTypeID(plist.get()) != CFDictionaryGetTypeID()) {        LOG(Archives, "LegacyWebArchive - Archive property list is not the expected CFDictionary, aborting invalid WebArchive");        return 0;    }        if (!archive->extract(plist.get()))        return 0;    return archive.release();}
开发者ID:sanyaade-mobiledev,项目名称:Webkit-Projects,代码行数:37,


示例21: strdup

char *Bgethomedir(void){#ifdef _WIN32	TCHAR appdata[MAX_PATH];	if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))		return strdup(appdata);	return NULL;#elif defined __APPLE__    #if LOWANG_IOS    const char* Sys_GetResourceDir(void);	return strdup(Sys_GetResourceDir());#else    	FSRef ref;	CFStringRef str;	CFURLRef base;	char *s;	if (FSFindFolder(kUserDomain, kVolumeRootFolderType, kDontCreateFolder, &ref) < 0) return NULL;	base = CFURLCreateFromFSRef(NULL, &ref);	if (!base) return NULL;	str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);	CFRelease(base);	if (!str) return NULL;	s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());	if (s) s = strdup(s);	CFRelease(str);	return s;#endif#else	char *e = getenv("HOME");	if (!e) return NULL;	return strdup(e);#endif}
开发者ID:TermiT,项目名称:Shadow-Warrior-iOS,代码行数:37,


示例22: listServices

static void listServices(){    IOHIDEventSystemClientRef eventSystem = IOHIDEventSystemClientCreateWithType(kCFAllocatorDefault, kIOHIDEventSystemClientTypeAdmin, NULL);    CFArrayRef  services = NULL;    CFIndex     index;        require(eventSystem, exit);        services = _IOHIDEventSystemClientCopyServiceDescriptions(eventSystem);    require(services, exit);        for ( index=0; index<CFArrayGetCount(services); index++ ) {        CFStringRef serviceDebugDesc = (CFStringRef)CFArrayGetValueAtIndex(services, index);        printf("%s/n", CFStringGetCStringPtr(serviceDebugDesc, CFStringGetSystemEncoding()));    }        exit:    if ( services )        CFRelease(services);        if (eventSystem)        CFRelease(eventSystem);}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:24,


示例23: servicesAddedCallback

static void servicesAddedCallback(void * target, void * refcon, void * sender, CFArrayRef services){    CFIndex index, count;        for(index=0, count = CFArrayGetCount(services); index<count; index++) {        IOHIDServiceRef service = (IOHIDServiceRef)CFArrayGetValueAtIndex(services, index);        CFStringRef string;                IOHIDNotificationRef notification = IOHIDServiceCreateRemovalNotification(service, serviceRemovalCallback, NULL, NULL);        if ( notification ) {            CFDictionaryAddValue(__serviceNotifications, service, notification);            CFRelease(notification);        }                printf("SERVICE %s:/n", (char *)kServiceAdded);                string = CFCopyDescription(service);        if ( string ) {            printf("%s/n", CFStringGetCStringPtr(string, kCFStringEncodingMacRoman));            CFRelease(string);        }    }    }
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:24,


示例24: cfstring_to_pystring

static PyObject*cfstring_to_pystring(CFStringRef ref){    const char* s;    s = CFStringGetCStringPtr(ref, kCFStringEncodingUTF8);    if (s) {        return PyUnicode_DecodeUTF8(                        s, strlen(s), NULL);    } else {        CFIndex len = CFStringGetLength(ref);        Boolean ok;        PyObject* result;        char* buf;        buf = PyMem_Malloc(len*4);        if (buf == NULL) {            PyErr_NoMemory();            return NULL;        }        ok = CFStringGetCString(ref,                        buf, len * 4,                        kCFStringEncodingUTF8);        if (!ok) {            PyMem_Free(buf);            return NULL;        } else {            result = PyUnicode_DecodeUTF8(                            buf, strlen(buf), NULL);            PyMem_Free(buf);        }        return result;    }}
开发者ID:1st1,项目名称:cpython,代码行数:36,


示例25: Bgethomedir

char *Bgetsupportdir(int global){#ifndef __APPLE__	return Bgethomedir();#else	FSRef ref;	CFStringRef str;	CFURLRef base;	char *s;		if (FSFindFolder(global ? kLocalDomain : kUserDomain,					 kApplicationSupportFolderType,					 kDontCreateFolder, &ref) < 0) return NULL;	base = CFURLCreateFromFSRef(NULL, &ref);	if (!base) return NULL;	str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);	CFRelease(base);	if (!str) return NULL;	s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());	if (s) s = strdup(s);	CFRelease(str);	return s;#endif}
开发者ID:Plagman,项目名称:jfbuild,代码行数:24,


示例26: StartServer

pid_t StartServer(){	pid_t pid = fork();	if(pid == 0)	{		CFBundleRef bundle = CFBundleGetMainBundle();		CFURLRef url = CFBundleCopyExecutableURL(bundle);		CFStringRef urlString = CFURLCopyPath(url);		const char *file = CFStringGetCStringPtr(urlString, kCFStringEncodingUTF8);		const char *args[] = { file, "--start", NULL };		execv(file, (char *const *)args);		// Should not be reached, but let's exit gracefully anyway		CFRelease(url);		CFRelease(urlString);		exit(EXIT_FAILURE);	}	return pid;}
开发者ID:JustSid,项目名称:extip,代码行数:24,


示例27: CFBundleCopyBundleURL

  QSettings mySettings;  // For non static builds on mac and win (static builds are not supported)  // we need to be sure we can find the qt image  // plugins. In mac be sure to look in the  // application bundle...#ifdef Q_OS_WIN  QCoreApplication::addLibraryPath( QApplication::applicationDirPath()                                    + QDir::separator() + "qtplugins" );#endif#ifdef Q_OS_MACX  //qDebug("Adding qt image plugins to plugin search path...");  CFURLRef myBundleRef = CFBundleCopyBundleURL( CFBundleGetMainBundle() );  CFStringRef myMacPath = CFURLCopyFileSystemPath( myBundleRef, kCFURLPOSIXPathStyle );  const char *mypPathPtr = CFStringGetCStringPtr( myMacPath, CFStringGetSystemEncoding() );  CFRelease( myBundleRef );  CFRelease( myMacPath );  QString myPath( mypPathPtr );  // if we are not in a bundle assume that the app is built  // as a non bundle app and that image plugins will be  // in system Qt frameworks. If the app is a bundle  // lets try to set the qt plugin search path...  QFileInfo myInfo( myPath );  if ( myInfo.isBundle() )  {    // First clear the plugin search paths so we can be sure    // only plugins from the bundle are being used    QStringList myPathList;    QCoreApplication::setLibraryPaths( myPathList );    // Now set the paths inside the bundle
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:30,



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


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