本文整理匯總了C++中CFShow函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFShow函數的具體用法?C++ CFShow怎麽用?C++ CFShow使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFShow函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: 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);
show (CFSTR ("Property list (as written to file):\n%@"), propertyList);
CFIndex bytesWritten = CFPropertyListWriteToStream (propertyList, stream, kCFPropertyListXMLFormat_v1_0, NULL);
CFWriteStreamClose (stream);
}
else {
CFShow (errorString);
CFRelease (errorString);
}
CFRelease (propertyList);
}
示例2: GPDuplexClient_Send
extern CFDataRef GPDuplexClient_Send(GPDuplexClientRef client, SInt32 type, CFDataRef data, Boolean expectsReturn) {
CFMessagePortRef serverPort;
if (client != NULL)
serverPort = client->serverPort;
else {
serverPort = CFMessagePortCreateRemote(NULL, CFSTR("hk.kennytm.GriP.server"));
if (serverPort == NULL) {
CFShow(CFSTR("GPDuplexClient_Send(): Cannot create server port. Is GriP running?"));
return NULL;
}
}
if (expectsReturn) {
CFDataRef retData = NULL;
SInt32 errorCode = CFMessagePortSendRequest(serverPort, type, data, 4, 1, kCFRunLoopDefaultMode, &retData);
if (client == NULL)
CFRelease(serverPort);
if (errorCode != kCFMessagePortSuccess) {
CFLog(4, CFSTR("GPDuplexClient_Send(): Cannot send data %@ of type %d to server. Returning NULL. Error code = %d"), data, type, errorCode);
if (retData != NULL) {
CFRelease(retData);
retData = NULL;
}
}
return retData;
} else {
SInt32 errorCode = CFMessagePortSendRequest(serverPort, type, data, 4, 0, NULL, NULL);
if (client == NULL)
CFRelease(serverPort);
if (errorCode != kCFMessagePortSuccess) {
CFLog(4, CFSTR("GPDuplexClient_Send(): Cannot send data %@ of type %d to server. Error code = %d"), data, type, errorCode);
}
return NULL;
}
}
示例3: wireless_scan_ssid
static CFArrayRef
wireless_scan_ssid(wireless_t wref, CFStringRef ssid)
{
CFArrayRef bssid_list = NULL;
Apple80211Err error;
CFDictionaryRef scan_args;
CFArrayRef scan_result = NULL;
EAPLOG(LOG_ERR, "######## DEBUG ####### - FAIL - wireless_scan_ssid");
scan_args = make_scan_args(ssid, 1);
error = Apple80211Scan((Apple80211Ref)wref, &scan_result, scan_args);
CFRelease(scan_args);
if (error != kA11NoErr) {
EAPLOG(LOG_ERR, "Apple80211Scan failed, %d\n", error);
goto failed;
}
bssid_list = copy_bssid_list_from_scan(scan_result, ssid);
if (bssid_list == NULL) {
EAPLOG(LOG_ERR, "No scan results\n");
}
else {
CFShow(bssid_list);
}
fflush(stdout);
fflush(stderr);
failed:
my_CFRelease(&scan_result);
return (bssid_list);
}
示例4: TestDuplicateAndDeleteSet
static void TestDuplicateAndDeleteSet(void)
// A test of the set duplication and deleting routines.
{
OSStatus err;
CFStringRef currentSetID;
CFStringRef newSetID;
currentSetID = NULL;
newSetID = NULL;
err = MoreSCCopyCurrentSet(¤tSetID);
if (err == noErr) {
err = MoreSCDuplicateSet(currentSetID, CFSTR("Frog"), &newSetID);
}
if (err == noErr) {
if (!gRunQuiet) {
fprintf(stderr, "New set ID is ");
CFShow(newSetID);
}
err = MoreSCDeleteSet(newSetID);
}
CFQRelease(currentSetID);
CFQRelease(newSetID);
PrintTestResult(err, NULL);
}
示例5: JSRunEvaluate
/*
JSRunEvaluate
*/
JSObjectRef JSRunEvaluate(JSRunRef ref)
{
JSObjectRef result = 0;
JSRun* ptr = (JSRun*)ref;
if (ptr)
{
Completion completion = ptr->Evaluate();
if (completion.isValueCompletion())
{
result = (JSObjectRef)KJSValueToJSObject(completion.value(), ptr->GetInterpreter()->globalExec());
}
if (completion.complType() == Throw)
{
JSFlags flags = ptr->Flags();
if (flags & kJSFlagDebug)
{
CFTypeRef error = JSObjectCopyCFValue(result);
if (error)
{
CFShow(error);
CFRelease(error);
}
}
}
}
return result;
}
示例6: GTMSMJobCopyDictionary
CFDictionaryRef GTMSMJobCopyDictionary(CFStringRef jobLabel) {
CFDictionaryRef dict = NULL;
CFErrorRef error = NULL;
launch_data_t resp = GTMPerformOnLabel(LAUNCH_KEY_GETJOB,
jobLabel,
&error);
if (resp) {
launch_data_type_t ldata_Type = launch_data_get_type(resp);
if (ldata_Type == LAUNCH_DATA_DICTIONARY) {
dict = GTMCFTypeCreateFromLaunchData(resp, true, &error);
} else {
error = GTMCFLaunchCreateUnlocalizedError(EINVAL,
CFSTR("Unknown launchd type %d"),
ldata_Type);
}
launch_data_free(resp);
}
if (error) {
#ifdef DEBUG
CFShow(error);
#endif // DEBUG
CFRelease(error);
}
return dict;
}
示例7: _ShowCF
static void _ShowCF (FILE* file, CFStringRef str)
{
if (CFGetTypeID(str) != CFStringGetTypeID()) {
CFShow(str);
return;
}
UInt32 len = CFStringGetLength(str);
char* chars = (char*)CA_malloc (len * 2); // give us plenty of room for unichar chars
if (CFStringGetCString (str, chars, len * 2, kCFStringEncodingUTF8))
fprintf (file, "%s", chars);
else
CFShow (str);
free (chars);
}
示例8: main
int
main (int argc, const char *argv[])
{
CFShow(CFSTR("Hello, World!\n"));
return EXIT_SUCCESS;
}
示例9: dumpSetProperties
static void
dumpSetProperties(CFMutableDictionaryRef set)
{
CFPrintf(CFSTR("\n%@\n"), CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetUUIDKey)));
CFPrintf(CFSTR("\t\"%@\" type = %@ /dev/%@\n"),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetNameKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDLevelNameKey)),
CFDictionaryGetValue(set, CFSTR("BSD Name")));
CFPrintf(CFSTR("\tstatus = %@, sequence = %@\n"),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDStatusKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDSequenceNumberKey)));
CFPrintf(CFSTR("\tchunk count = %@, chunk size = %@\n"),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDChunkCountKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDChunkSizeKey)));
CFStringRef level = CFDictionaryGetValue(set, CFSTR(kAppleRAIDLevelNameKey));
if (CFStringCompare(level, CFSTR("mirror"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
CFPrintf(CFSTR("\tcontent hint = %@, auto = %@, quick = %@, timeout = %@\n"),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetContentHintKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetAutoRebuildKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetQuickRebuildKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetTimeoutKey)));
} else if (CFStringCompare(level, CFSTR("LVG"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
CFPrintf(CFSTR("\tcontent hint = %@, lv count = %@, free space %@\n"),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetContentHintKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDLVGVolumeCountKey)),
CFDictionaryGetValue(set, CFSTR(kAppleRAIDLVGFreeSpaceKey)));
} else {
CFPrintf(CFSTR("\tcontent hint = %@\n"), CFDictionaryGetValue(set, CFSTR(kAppleRAIDSetContentHintKey)));
}
if (verbose) CFShow(set);
}
示例10: write_plist
/* @overload write_plist(hash, path)
*
* Writes the serialized contents of a property list to the specified path.
*
* @note This does not yet support all possible types that can exist in a valid property list.
*
* @note This currently only assumes to be given an Xcode project document.
* This means that it only accepts dictionaries, arrays, and strings in
* the document.
*
* @param [Hash] hash The property list to serialize.
* @param [String] path The path to the property list file.
* @return [true, false] Wether or not saving was successful.
*/
static VALUE
write_plist(VALUE self, VALUE hash, VALUE path) {
VALUE h = rb_check_convert_type(hash, T_HASH, "Hash", "to_hash");
if (NIL_P(h)) {
rb_raise(rb_eTypeError, "%s can't be coerced to Hash", rb_obj_classname(hash));
}
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(NULL,
0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
rb_hash_foreach(h, dictionary_set, (st_data_t)dict);
CFURLRef fileURL = str_to_url(path);
CFWriteStreamRef stream = CFWriteStreamCreateWithFile(NULL, fileURL);
CFRelease(fileURL);
CFIndex success = 0;
if (CFWriteStreamOpen(stream)) {
CFStringRef errorString;
success = CFPropertyListWriteToStream(dict, stream, kCFPropertyListXMLFormat_v1_0, &errorString);
if (!success) {
CFShow(errorString);
}
} else {
printf("Unable to open stream!\n");
}
CFRelease(dict);
return success ? Qtrue : Qfalse;
}
示例11: DebugModemScriptSearch
static void DebugModemScriptSearch(void)
// Used for debugging the modem script code.
{
OSStatus err;
CFArrayRef cclArray;
CFIndex indexOfDefaultCCL;
cclArray = NULL;
err = MoreSCCreateCCLArray(&cclArray, &indexOfDefaultCCL);
if (err == noErr) {
CFIndex i;
CFIndex c;
c = CFArrayGetCount(cclArray);
fprintf(stderr, "CCL Count = %ld\n", c);
for (i = 0; i < c; i++) {
fprintf(stderr, "%3ld %c ", i, i == indexOfDefaultCCL ? '*' : ' ');
CFShow(CFArrayGetValueAtIndex(cclArray, i));
}
}
CFQRelease(cclArray);
if (err == noErr) {
fprintf(stderr, "Success!\n");
} else {
fprintf(stderr, "*** Failed with error %ld!\n", err);
}
}
示例12: main
int main(int argc, const char * argv[])
{
// insert code here...
CFShow(CFSTR("Hello, World!\n"));
return 0;
}
示例13: xml_load
// ---------------------------------
// Load the element strings from the given resource (XML) file into a CFPropertyListRef
static CFPropertyListRef xml_load(const CFStringRef pResourceName,const CFStringRef pResourceExtension)
{
CFPropertyListRef tCFPropertyListRef = NULL;
CFURLRef resFileCFURLRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), pResourceName, pResourceExtension, NULL);
if (NULL != resFileCFURLRef)
{
CFDataRef resCFDataRef;
if (CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, resFileCFURLRef, &resCFDataRef, nil, nil, nil))
{
if (NULL != resCFDataRef)
{
CFStringRef errorString;
tCFPropertyListRef = CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resCFDataRef, kCFPropertyListImmutable, &errorString);
if (NULL == tCFPropertyListRef)
CFShow(errorString);
CFRelease(resCFDataRef);
}
}
CFRelease(resFileCFURLRef);
}
return tCFPropertyListRef;
}
示例14: GTMSMCopyAllJobDictionaries
CFDictionaryRef GTMSMCopyAllJobDictionaries(void) {
CFDictionaryRef dict = NULL;
launch_data_t msg = launch_data_new_string(LAUNCH_KEY_GETJOBS);
launch_data_t resp = launch_msg(msg);
launch_data_free(msg);
CFErrorRef error = NULL;
if (resp) {
launch_data_type_t ldata_Type = launch_data_get_type(resp);
if (ldata_Type == LAUNCH_DATA_DICTIONARY) {
dict = GTMCFTypeCreateFromLaunchData(resp, true, &error);
} else {
error = GTMCFLaunchCreateUnlocalizedError(EINVAL,
CFSTR("Unknown launchd type %d"),
ldata_Type);
}
launch_data_free(resp);
} else {
error
= GTMCFLaunchCreateUnlocalizedError(errno, CFSTR(""));
}
if (error) {
#ifdef DEBUG
CFShow(error);
#endif // DEBUG
CFRelease(error);
}
return dict;
}
示例15: CFDictionaryGetValue
/* Get the value for the given key. We don't allow NULL ad a value, so
* returning NULL means failure (not present).
*/
CFPropertyListRef Preferences::get_value(CFStringRef key) const
{
CFPropertyListRef prefval = NULL;
if (!this->is_loaded()) {
return NULL;
}
if (this->m_plist) {
prefval = CFDictionaryGetValue((CFDictionaryRef)this->m_plist, key);
} else if (this->m_scpref) {
prefval = SCPreferencesGetValue(this->m_scpref, key);
}
/* Dump the raw keys for debugging. Useful for figuring out whether our
* type conversion has gone awry.
*/
if (Options::Debug) {
DEBUGMSG("%s value for key %s:\n",
this->m_pspec.c_str(), cfstring_convert(key).c_str());
CFShow(prefval);
}
return prefval;
}