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

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

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

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

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

示例1: AppearanceAlert

void AppearanceAlert (AlertType type, int stringID1, int stringID2){	OSStatus		err;	DialogRef		dialog;	DialogItemIndex	outItemHit;	CFStringRef		key1, key2, mes1, mes2;	char			label1[32], label2[32];	sprintf(label1, "AlertMes_%02d", stringID1);	sprintf(label2, "AlertMes_%02d", stringID2);	key1 = CFStringCreateWithCString(kCFAllocatorDefault, label1, CFStringGetSystemEncoding());	key2 = CFStringCreateWithCString(kCFAllocatorDefault, label2, CFStringGetSystemEncoding());	if (key1) mes1 = CFCopyLocalizedString(key1, "mes1");	else mes1 = NULL;	if (key2) mes2 = CFCopyLocalizedString(key2, "mes2");	else mes2 = NULL;	PlayAlertSound();	err = CreateStandardAlert(type, mes1, mes2, NULL, &dialog);	err = RunStandardAlert(dialog, NULL, &outItemHit);	if (key1) CFRelease(key1);	if (key2) CFRelease(key2);	if (mes1) CFRelease(mes1);	if (mes2) CFRelease(mes2);}
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:27,


示例2: GetStrPreference

void GetStrPreference (const char *name, char *out, const char *defaut, const int bufferSize){    if ((out==NULL) || (name==NULL)) return;    if (defaut != NULL)    {        strncpy(out,defaut,bufferSize-1);        out[bufferSize-1]=0;    }    else out[0]=0;    CFStringRef nom = CFStringCreateWithCString (NULL,name,CFStringGetSystemEncoding());    if (nom != NULL)    {        CFStringRef value = (CFStringRef)CFPreferencesCopyAppValue(nom,kCFPreferencesCurrentApplication);        if (value != NULL)        {            if (CFGetTypeID(value) == CFStringGetTypeID ())            {                if ((!CFStringGetCString (value, out, bufferSize, CFStringGetSystemEncoding())) && (defaut != NULL))                    strcpy(out,defaut);            }            CFRelease(value);        }        CFRelease(nom);    }}
开发者ID:gp2xdev,项目名称:gp2x-flobopuyo,代码行数:29,


示例3: genUsb

QueryData genUsb() {  QueryData results;    CFMutableDictionaryRef matchingDict;    io_iterator_t iter;    kern_return_t kr;    io_service_t device;    char vendor[256];    char product[256];    matchingDict = IOServiceMatching(kIOUSBDeviceClassName);    if (matchingDict == NULL)    { return results; }    kr = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iter);    if (kr != KERN_SUCCESS)    {  return results; }    while ((device = IOIteratorNext(iter)))    {        Row r        //Get the vendor of the device;        CFMutableDictionaryRef vendor_dict = NULL;        IORegistryEntryCreateCFProperties(device, &vendor_dict, kCFAllocatorDefault, kNilOptions);        CFTypeRef vendor_obj = CFDictionaryGetValue(vendor_dict, CFSTR("USB Vendor Name"));        if(vendor_obj) {           CFStringRef cf_vendor  =  CFStringCreateCopy(kCFAllocatorDefault, (CFStringRef)vendor_obj);           CFStringGetCString(cf_vendor, vendor, 256, CFStringGetSystemEncoding());           r["manufacturer"] = vendor;        }        //Get the product name of the device        CFMutableDictionaryRef product_dict = NULL;        IORegistryEntryCreateCFProperties(device, &product_dict, kCFAllocatorDefault, kNilOptions);        CFTypeRef product_obj = CFDictionaryGetValue(product_dict, CFSTR("USB Product Name"));        if(product_obj) {           CFStringRef cf_product  =  CFStringCreateCopy(kCFAllocatorDefault, (CFStringRef)product_obj);           CFStringGetCString(cf_product, product, 256, CFStringGetSystemEncoding());           r["product"] = product;        }         //Lets make sure we don't have an empty product & manufacturer        if(r["product"] != "" || r["manufacturer"] != "") {          results.push_back(r);        }        IOObjectRelease(device);    }  IOObjectRelease(iter);  return results;}
开发者ID:UmiDevSec,项目名称:osquery,代码行数:53,


示例4: SetStrPreference

void SetStrPreference (const char *name, const char *value){    CFStringRef nom = CFStringCreateWithCString (NULL,name,CFStringGetSystemEncoding());    if (nom != NULL)    {        CFStringRef val = CFStringCreateWithCString (NULL,value,CFStringGetSystemEncoding());        if (val != NULL)        {            CFPreferencesSetAppValue (nom,val,kCFPreferencesCurrentApplication);            (void)CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);            CFRelease(val);        }        CFRelease(nom);    }}
开发者ID:gp2xdev,项目名称:gp2x-flobopuyo,代码行数:15,


示例5: printCFString

static void printCFString(CFStringRef string){    CFIndex	len;    char *	buffer;    len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(string),	    CFStringGetSystemEncoding()) + sizeof('/0');    buffer = malloc(len);    if (buffer && CFStringGetCString(string, buffer, len,                                  CFStringGetSystemEncoding()) )	printf(buffer);    if (buffer)	free(buffer);}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:15,


示例6: CFStringGetSystemEncoding

/* lifted from portmidi */static char *get_ep_name(MIDIEndpointRef ep){	MIDIEntityRef entity;	MIDIDeviceRef device;	CFStringRef endpointName = NULL, deviceName = NULL, fullName = NULL;	CFStringEncoding defaultEncoding;	char* newName;	/* get the default string encoding */	defaultEncoding = CFStringGetSystemEncoding();	/* get the entity and device info */	MIDIEndpointGetEntity(ep, &entity);	MIDIEntityGetDevice(entity, &device);	/* create the nicely formated name */	MIDIObjectGetStringProperty(ep, kMIDIPropertyName, &endpointName);	MIDIObjectGetStringProperty(device, kMIDIPropertyName, &deviceName);	if (deviceName != NULL) {		fullName = CFStringCreateWithFormat(NULL, NULL, CFSTR("%@: %@"),						deviceName, endpointName);	} else {		fullName = endpointName;	}	/* copy the string into our buffer */	newName = (char*)mem_alloc(CFStringGetLength(fullName) + 1);	CFStringGetCString(fullName, newName, CFStringGetLength(fullName) + 1,			defaultEncoding);	/* clean up */	if (fullName && !deviceName) CFRelease(fullName);	return newName;}
开发者ID:asbjornu,项目名称:schismtracker,代码行数:36,


示例7: main

intmain(void){    kern_return_t          kr;    io_iterator_t          io_hw_sensors;    io_service_t           io_hw_sensor;    CFMutableDictionaryRef sensor_properties;    CFStringEncoding       systemEncoding = CFStringGetSystemEncoding();       kr = IOServiceGetMatchingServices(kIOMasterPortDefault,             IOServiceNameMatching("IOHWSensor"), &io_hw_sensors);       while ((io_hw_sensor = IOIteratorNext(io_hw_sensors))) {        kr = IORegistryEntryCreateCFProperties(io_hw_sensor, &sensor_properties,                 kCFAllocatorDefault, kNilOptions);        if (kr == KERN_SUCCESS)            printTemperatureSensor(sensor_properties, systemEncoding);           CFRelease(sensor_properties);        IOObjectRelease(io_hw_sensor);    }       IOObjectRelease(io_hw_sensors);       exit(kr);}
开发者ID:Leask,项目名称:Mac-OS-X-Internals,代码行数:26,


示例8: CFStringGetMaximumSizeOfFileSystemRepresentation

CFIndexCFStringGetMaximumSizeOfFileSystemRepresentation (CFStringRef string){  CFIndex length = CFStringGetLength (string);  return    CFStringGetMaximumSizeForEncoding (length, CFStringGetSystemEncoding ());}
开发者ID:1053948334,项目名称:myos.frameworks,代码行数:7,


示例9: bluetoothDiscoverySDPCompleteCallback

void bluetoothDiscoverySDPCompleteCallback(void *userRefCon, IOBluetoothDeviceRef foundDevRef, IOReturn status){	ConnectivityBluetooth *conn = (ConnectivityBluetooth *) userRefCon;	IOBluetoothSDPUUIDRef uuid;	unsigned char uuid_bytes[] = HAGGLE_BLUETOOTH_SDP_UUID;		uuid = IOBluetoothSDPUUIDCreateWithBytes(uuid_bytes, sizeof(uuid_bytes));	if (uuid == NULL) {		CM_DBG("Failed to create UUID (%ld)/n", sizeof(uuid_bytes));	}		CFStringRef nameRef = IOBluetoothDeviceGetName(foundDevRef);	const char *name = nameRef ? CFStringGetCStringPtr(nameRef, CFStringGetSystemEncoding()) : "PeerBluetoothInterface";	//IOBluetoothObjectRetain(foundDevRef);	//memcpy(macaddr, btAddr, BT_ALEN);		const BluetoothDeviceAddress *btAddr = IOBluetoothDeviceGetAddress(foundDevRef);	BluetoothAddress addr((unsigned char *)btAddr);		BluetoothInterface iface((unsigned char *)btAddr, name, &addr, IFFLAG_UP);		if (IOBluetoothDeviceGetServiceRecordForUUID(foundDevRef, uuid) != NULL) {		CM_DBG("%s: Found Haggle device %s/n", conn->getName(), addr.getStr());				conn->report_interface(&iface, conn->rootInterface, new ConnectivityInterfacePolicyTTL(2));	} else {		CM_DBG("%s: Found non-Haggle device [%s]/n", conn->getName(), addr.getStr());	}	IOBluetoothDeviceCloseConnection(foundDevRef);	IOBluetoothObjectRelease(foundDevRef);	IOBluetoothObjectRelease(uuid);}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:35,


示例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);    CFRelease(pathRef);    if (!imageURL) {        return nullptr;    }    // Convert the URL reference into a string reference    CFStringRef imagePath = CFURLCopyFileSystemPath(imageURL, kCFURLPOSIXPathStyle);    CFRelease(imageURL);    // Get the system encoding method    CFStringEncoding encodingMethod = CFStringGetSystemEncoding();    // Convert the string reference into a C string    const char *finalPath = CFStringGetCStringPtr(imagePath, encodingMethod);    FILE* fileHandle = fopen(finalPath, perm);    CFRelease(imagePath);    return fileHandle;}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:25,


示例11: qt_mac_to_pascal_string

void qt_mac_to_pascal_string(const QString &s, Str255 str, TextEncoding encoding, int len){    if(len == -1)        len = s.length();#if 0    UnicodeMapping mapping;    mapping.unicodeEncoding = CreateTextEncoding(kTextEncodingUnicodeDefault,                                                 kTextEncodingDefaultVariant,                                                 kUnicode16BitFormat);    mapping.otherEncoding = (encoding ? encoding : );    mapping.mappingVersion = kUnicodeUseLatestMapping;    UnicodeToTextInfo info;    OSStatus err = CreateUnicodeToTextInfo(&mapping, &info);    if(err != noErr) {        qDebug("Qt: internal: Unable to create pascal string '%s'::%d [%ld]",               s.left(len).latin1(), (int)encoding, err);        return;    }    const int unilen = len * 2;    const UniChar *unibuf = (UniChar *)s.unicode();    ConvertFromUnicodeToPString(info, unilen, unibuf, str);    DisposeUnicodeToTextInfo(&info);#else    Q_UNUSED(encoding);    CFStringGetPascalString(QCFString(s), str, 256, CFStringGetSystemEncoding());#endif}
开发者ID:maxxant,项目名称:qt,代码行数:28,


示例12: main

int main (int argc, const char * argv[]) {    	if (argv[1] != NULL)	{		CFDataRef data;		CFStringRef searchterm = CFStringCreateWithCString(NULL, argv[1],														   kCFStringEncodingMacRoman);		CFRange searchRange = CFRangeMake(0, CFStringGetLength(searchterm));		CFStringRef dictResult = DCSCopyTextDefinition(NULL, searchterm, searchRange);		CFRelease(searchterm);		if (dictResult != NULL) {			data = CFStringCreateExternalRepresentation(NULL, dictResult, CFStringGetSystemEncoding(), '?');			CFRelease(dictResult);		}		if (data != NULL) {			printf ("%.*s/n/n", (int)CFDataGetLength(data), CFDataGetBytePtr(data));			CFRelease(data);		}		else {			printf("Could not find word in Dictionary.app./n");		}		return 0;	}	else {		printf("Usage: dictlookup /"word/"/n");		return 1;	}}
开发者ID:davidhaselb,项目名称:dictlookup,代码行数:32,


示例13: listClients

static void listClients(){    IOHIDEventSystemClientRef eventSystem = IOHIDEventSystemClientCreateWithType(kCFAllocatorDefault, kIOHIDEventSystemClientTypeAdmin, NULL);    CFIndex     types;        require(eventSystem, exit);        for ( types=kIOHIDEventSystemClientTypeAdmin; types<=kIOHIDEventSystemClientTypeRateControlled; types++ ) {        CFArrayRef  clients = _IOHIDEventSystemClientCopyClientDescriptions(eventSystem, (IOHIDEventSystemClientType)types);        CFIndex     index;                if ( !clients )            continue;                for ( index=0; index<CFArrayGetCount(clients); index++ ) {            CFStringRef clientDebugDesc = (CFStringRef)CFArrayGetValueAtIndex(clients, index);            printf("%s/n", CFStringGetCStringPtr(clientDebugDesc, CFStringGetSystemEncoding()));        }                CFRelease(clients);    }    exit:    if (eventSystem)        CFRelease(eventSystem);}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:26,


示例14: 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__	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;#else	char *e = getenv("HOME");	if (!e) return NULL;	return strdup(e);#endif}
开发者ID:Plagman,项目名称:jfbuild,代码行数:30,


示例15: DeinitMultiCart

void DeinitMultiCart (void){	CFStringRef	keyRef;	char		key[32];	for (int i = 0; i < 2; i++)	{		sprintf(key, "MultiCartPath_%02d", i);		keyRef = CFStringCreateWithCString(kCFAllocatorDefault, key, CFStringGetSystemEncoding());		if (keyRef)		{			if (multiCartPath[i])			{				CFPreferencesSetAppValue(keyRef, multiCartPath[i], kCFPreferencesCurrentApplication);				CFRelease(multiCartPath[i]);			}			else				CFPreferencesSetAppValue(keyRef, NULL, kCFPreferencesCurrentApplication);			CFRelease(keyRef);		}	}	CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);}
开发者ID:7sevenx7,项目名称:snes9x,代码行数:25,


示例16: getDeviceInfo

static void getDeviceInfo(io_object_t hidDevice, CFMutableDictionaryRef hidProperties, struct deviceRecord *deviceRec){	CFMutableDictionaryRef	usbProperties = 0;	io_registry_entry_t		parent1, parent2;	CFTypeRef					refCF = 0;	if ((!IORegistryEntryGetParentEntry(hidDevice, kIOServicePlane, &parent1)) &&		(!IORegistryEntryGetParentEntry(parent1, kIOServicePlane, &parent2)) &&		(!IORegistryEntryCreateCFProperties(parent2, &usbProperties, kCFAllocatorDefault, kNilOptions)))	{		if (usbProperties)		{			refCF = CFDictionaryGetValue(hidProperties, CFSTR(kIOHIDSerialNumberKey));			if (refCF)			{				if (CFStringGetCString((const __CFString *) refCF,					(char *) deviceRec->serial, 256, CFStringGetSystemEncoding()))				{					strcpy(PK2UnitIDString, (const char *) deviceRec->serial);					PK2UnitIDString[14] = 0; // ensure termination				}				else if (verbose)					printf("Cannot get UnitID from descriptor./n");			}		}		else if (verbose)			printf("Cannot get usb properties./n");		CFRelease(usbProperties);		IOObjectRelease(parent2);		IOObjectRelease(parent1);	}}
开发者ID:Nimajamin,项目名称:pk2cmd,代码行数:34,


示例17: Bgethomedir

char *Bgetsupportdir(int global){#ifndef __APPLE__	return Bgethomedir();#else#if LOWANG_IOS    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#endif}
开发者ID:TermiT,项目名称:Shadow-Warrior-iOS,代码行数:28,


示例18: binaryPath

QString WebService::installPrefix() const {#ifndef Q_OS_WIN32DOWS  QDir binaryPath(QCoreApplication::applicationDirPath());  if (binaryPath.cdUp()) {    return QDir::toNativeSeparators(binaryPath.canonicalPath());  }#endif#ifdef Q_OS_LINUX  QString basePath(qgetenv("PLEXYDESK_DIR"));  if (basePath.isEmpty() || basePath.isNull()) {    return PLEXYPREFIX;  }  return basePath;#endif#ifdef Q_OS_MAC  CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());  CFStringRef macPath =      CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);  const char *pathPtr =      CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());  CFRelease(appUrlRef);  CFRelease(macPath);  return QLatin1String(pathPtr) + QString("/Contents/");#endif  return QString();}
开发者ID:shaheeqa,项目名称:plexydesk,代码行数:30,


示例19: findResourceFiles

QStringList findResourceFiles(const QString& dirName, const QString& filter, QStringList additionalPreferredPaths) {	QStringList searchFiles;	QString dn = dirName;	if (dn.endsWith('/')||dn.endsWith(QDir::separator())) dn=dn.left(dn.length()-1); //remove / at the end	if (!dn.startsWith('/')&&!dn.startsWith(QDir::separator())) dn="/"+dn; //add / at beginning	searchFiles<<":"+dn; //resource fall back	searchFiles.append(additionalPreferredPaths);	searchFiles<<QCoreApplication::applicationDirPath() + dn; //windows new	// searchFiles<<QCoreApplication::applicationDirPath() + "/data/"+fileName; //windows new#if !defined(PREFIX)#define PREFIX ""#endif#if defined( Q_WS_X11 )	searchFiles<<PREFIX"/share/texstudio"+dn; //X_11	searchFiles<<PREFIX"/share/texmakerx"+dn; //X_11#endif#ifdef Q_WS_MAC	CFURLRef appUrlRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());	CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef,												  kCFURLPOSIXPathStyle);	const char *pathPtr = CFStringGetCStringPtr(macPath,												CFStringGetSystemEncoding());	searchFiles<<QString(pathPtr)+"/Contents/Resources"+dn; //Mac	CFRelease(appUrlRef);	CFRelease(macPath);#endif	QStringList result;	foreach(const QString& fn, searchFiles) {		QDir fic(fn);		if (fic.exists() && fic.isReadable())			result<< fic.entryList(QStringList(filter),QDir::Files,QDir::Name);	}
开发者ID:svn2github,项目名称:texstudio-trunk,代码行数:35,


示例20: path_to_file

char const* path_to_file(CFStringRef file, CFStringRef extension){    // Get a reference to the main bundle    CFBundleRef mainBundle = CFBundleGetMainBundle();        if (mainBundle == NULL) {        return NULL;    }        // Get a reference to the file's URL    CFURLRef imageURL = CFBundleCopyResourceURL(mainBundle,                                                file,                                                extension,                                                NULL);        if (imageURL == NULL) {        return NULL;    }        // 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 *path = CFStringGetCStringPtr(imagePath, encodingMethod);    return path;}
开发者ID:samds,项目名称:OGLUIKit,代码行数:30,


示例21: FindSNESFolder

static OSStatus FindSNESFolder (FSRef *folderRef, char *folderPath, const char *folderName){	OSStatus	err;	CFURLRef	burl, purl;	CFStringRef	fstr;	FSRef		pref;	UniChar		buffer[PATH_MAX + 1];	Boolean		r;	fstr = CFStringCreateWithCString(kCFAllocatorDefault, folderName, CFStringGetSystemEncoding());	CFStringGetCharacters(fstr, CFRangeMake(0, CFStringGetLength(fstr)), buffer);	burl = CFBundleCopyBundleURL(CFBundleGetMainBundle());	purl = CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, burl);	r    = CFURLGetFSRef(purl, &pref);	err = FSMakeFSRefUnicode(&pref, CFStringGetLength(fstr), buffer, kTextEncodingUnicodeDefault, folderRef);	if (err == dirNFErr || err == fnfErr)	{		err = FSCreateDirectoryUnicode(&pref, CFStringGetLength(fstr), buffer, kFSCatInfoNone, NULL, folderRef, NULL, NULL);		if (err == noErr)			AddFolderIcon(folderRef, folderName);	}	if (err == noErr)		err = FSRefMakePath(folderRef, (unsigned char *) folderPath, PATH_MAX);	CFRelease(purl);	CFRelease(burl);	CFRelease(fstr);	return (err);}
开发者ID:7sevenx7,项目名称:snes9x,代码行数:33,


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


示例23: writePropertyListToFile

void writePropertyListToFile (CFDataRef data) {    CFStringRef errorString;    CFPropertyListRef propertyList = CFPropertyListCreateFromXMLData (NULL, data, kCFPropertyListMutableContainersAndLeaves, &errorString);    if (errorString == NULL) {        CFStringRef urlString = CFStringCreateWithCString (NULL, kFilename, CFStringGetSystemEncoding ());        CFURLRef fileURL = CFURLCreateWithFileSystemPath (NULL, urlString, kCFURLPOSIXPathStyle, FALSE);        CFWriteStreamRef stream = CFWriteStreamCreateWithFile (NULL, fileURL);        Boolean isOpen = CFWriteStreamOpen (stream);        CFShow (CFSTR ("Property list (as written to file):"));        CFShow (propertyList);          CFIndex bytesWritten = CFPropertyListWriteToStream (propertyList, stream, kCFPropertyListXMLFormat_v1_0, NULL);        CFWriteStreamClose (stream);    }    else {        CFShow (errorString);        CFRelease (errorString);    }    CFRelease (propertyList);}
开发者ID:AbhinavBansal,项目名称:opencflite,代码行数:28,


示例24: main

int main(int argc, char *argv[]){#ifdef WIN32    qInstallMsgHandler(myMessageOutput);#endif#if defined(Q_OS_MACX)    // On Mac, switch working directory to resources folder    CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());    CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, kCFURLPOSIXPathStyle);    QString path( CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding()) );    path += "/Contents/Resources";    QDir::setCurrent( path );    CFRelease(pluginRef);    CFRelease(macPath);#elif defined(PO_DATA_REPO)    QDir::setCurrent(PO_DATA_REPO);#endif    srand(time(NULL));    try    {        //HotKeyClass HotKeyEvent;	QApplication a(argc, argv);        //a.installEventFilter(&HotKeyEvent);	/* Names to use later for QSettings */        QCoreApplication::setApplicationName("Pokeymon-Online");	QCoreApplication::setOrganizationName("Dreambelievers");        QSettings settings;        if (settings.value("language").isNull()) {            settings.setValue("language", QLocale::system().name().section('_', 0, 0));        }        QString locale = settings.value("language").toString();        QTranslator translator;        translator.load(QString("trans/translation_") + locale);        a.installTranslator(&translator);        /* icon ;) */#if not defined(Q_OS_MACX)	a.setWindowIcon(QIcon("db/icon.png"));#endif        MainEngine w;        return a.exec();    }  /*catch (const std::exception &e) {        qDebug() << "Caught runtime " << e.what();    } catch (const QString &s) {        qDebug() << "Caught string " << s;    } */catch (const char* s) {        qDebug() << "Caught const char*  " << s;    } /*catch (...) {        qDebug() << "Caught Exception.";    }*/    return 0;}
开发者ID:ShinyCrobat,项目名称:pokemon-online,代码行数:59,


示例25: char2str

static void char2str(char *dst, int size, const UniChar *uni, int unicnt) {	CFStringRef	cfsr;	cfsr = CFStringCreateWithCharacters(NULL, uni, unicnt);	CFStringGetCString(cfsr, dst, size, CFStringGetSystemEncoding());	CFRelease(cfsr);}
开发者ID:FREEWING-JP,项目名称:np2pi,代码行数:8,


示例26: CFStringCreateWithPascalString

CHXCFString::CHXCFString(ConstStr255Param pPString){	mCFStringRef = CFStringCreateWithPascalString(kCFAllocatorDefault, pPString, CFStringGetSystemEncoding());	check_nonnull(mCFStringRef);		UpdateDebugOnlyString();}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:8,


示例27: CFStringCreateWithCString

CHXCFString::CHXCFString(const char *pCString){	mCFStringRef = CFStringCreateWithCString(kCFAllocatorDefault, pCString, CFStringGetSystemEncoding());	check_nonnull(mCFStringRef);		UpdateDebugOnlyString();}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:8,


示例28: DoWriteDataToFile

OSStatus DoWriteDataToFile(COMMAND_PROC_ARGUMENTS) {#pragma unused (auth)#pragma unused (userData)	OSStatus retval = noErr;		// Pre-conditions        // userData may be NULL	assert(request != NULL);	assert(response != NULL);    // asl may be NULL    // aslMsg may be NULL		// Get data to write and assert that it's a CFDataRef	CFDataRef data = CFDictionaryGetValue(request, CFSTR(kData)) ;	assert(data != NULL) ;	assert(CFGetTypeID(data) == CFDataGetTypeID()) ;		// Get path and assert that it's a CFStringRef	CFStringRef filePath = CFDictionaryGetValue(request, CFSTR(kPath)) ;	assert(filePath != NULL) ;	assert(CFGetTypeID(filePath) == CFStringGetTypeID()) ;		CFURLRef url = CFURLCreateWithFileSystemPath (												  kCFAllocatorDefault,												  filePath,												  kCFURLPOSIXPathStyle,												  false												  ) ;		SInt32 errorCode ;	Boolean ok = CFURLWriteDataAndPropertiesToResource (														url,														data,														NULL,														&errorCode														) ;	if (!ok) {		retval = errorCode ;	}		asl_log(asl,			aslMsg,			ASL_LEVEL_DEBUG,			"DoWriteDataToFile result ok=%d for %s",			ok,			CFStringGetCStringPtr(								  filePath,								  CFStringGetSystemEncoding()								  )			) ;		// Clean up	CFQRelease(url) ;		return retval ;}	
开发者ID:WallaceYYLi,项目名称:CocoaPrivilegedHelper,代码行数:57,


示例29: AddServiceToPopupMenu

voidAddServiceToPopupMenu(char * serviceType, UInt16 serviceLen, UInt16 * serviceMenuItem){    ControlID 		controlID = { kNSLSample, kServicesTypePopup };    ControlRef		control;    CFStringRef		tempService = NULL;    CFStringRef    	menuText = NULL;    char		tempServiceString[kMaxTypeNameLength];    CFComparisonResult	result = -1;    MenuRef		menu;    OSStatus		err = noErr;    short		itemCount, i;        if (serviceType)    {        err = GetControlByID(gMainWindow, &controlID, &control);        if (err == noErr)        {            strncpy(tempServiceString, serviceType, serviceLen);            tempServiceString[serviceLen] = '/0';                        for (i = 0; i < serviceLen; i++) tempServiceString[i] = toupper(tempServiceString[i]);                        tempService = CFStringCreateWithCString(NULL, tempServiceString, CFStringGetSystemEncoding());            if (tempService)            {                menu = GetControlPopupMenuHandle(control);                itemCount = CountMenuItems(menu);                                for (i = 1; i <= itemCount; i ++)                {                    CopyMenuItemTextAsCFString(menu, i , &menuText);                    if (menuText)                    {                                                result = CFStringCompare(menuText, tempService, kCFCompareCaseInsensitive);                        if (result == kCFCompareEqualTo)                        {                            if (serviceMenuItem) *serviceMenuItem = i;                            break;                        }                    }                }                                if (result != kCFCompareEqualTo)                {                    err = AppendMenuItemTextWithCFString(menu, tempService, 0, 0, serviceMenuItem);                    if (err == noErr)                    {                        SetControlMaximum(control, itemCount + 1);                        if (serviceMenuItem) *serviceMenuItem = itemCount + 1;                    }                    CFRelease(tempService);                }            }        }    }}
开发者ID:fruitsamples,项目名称:NSLMiniBrowser,代码行数:57,



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


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