當前位置: 首頁>>代碼示例>>C++>>正文


C++ CFBooleanGetTypeID函數代碼示例

本文整理匯總了C++中CFBooleanGetTypeID函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFBooleanGetTypeID函數的具體用法?C++ CFBooleanGetTypeID怎麽用?C++ CFBooleanGetTypeID使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CFBooleanGetTypeID函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: kim_os_preferences_get_boolean_for_key

kim_error kim_os_preferences_get_boolean_for_key (kim_preference_key  in_key,
                                                  kim_boolean         in_hardcoded_default,
                                                  kim_boolean        *out_boolean)
{
    kim_error err = KIM_NO_ERROR;
    CFBooleanRef value = NULL;

    if (!err && !out_boolean) { err = check_error (KIM_NULL_PARAMETER_ERR); }

    if (!err) {
        err = kim_os_preferences_copy_value (in_key, CFBooleanGetTypeID (),
                                             (CFPropertyListRef *) &value);
    }

    if (!err && !value) {
        err = kim_os_preferences_copy_value_compat (in_key, CFBooleanGetTypeID (),
                                                    (CFPropertyListRef *) &value);
    }

    if (!err) {
        if (value) {
            *out_boolean = CFBooleanGetValue (value);
        } else {
            *out_boolean = in_hardcoded_default;
        }
    }

    if (value) { CFRelease (value); }

    return check_error (err);
}
開發者ID:Brainiarc7,項目名稱:pbis,代碼行數:31,代碼來源:kim_os_preferences.c

示例2: getIOKitProperty

std::string getIOKitProperty(const CFMutableDictionaryRef& details,
                             const std::string& key) {
  std::string value;

  // Get a property from the device.
  auto cfkey = CFStringCreateWithCString(
      kCFAllocatorDefault, key.c_str(), kCFStringEncodingUTF8);
  auto property = CFDictionaryGetValue(details, cfkey);
  CFRelease(cfkey);

  // Several supported ways of parsing IOKit-encoded data.
  if (property) {
    if (CFGetTypeID(property) == CFNumberGetTypeID()) {
      value = stringFromCFNumber((CFDataRef)property);
    } else if (CFGetTypeID(property) == CFStringGetTypeID()) {
      value = stringFromCFString((CFStringRef)property);
    } else if (CFGetTypeID(property) == CFDataGetTypeID()) {
      value = stringFromCFData((CFDataRef)property);
    } else if (CFGetTypeID(property) == CFBooleanGetTypeID()) {
      value = (CFBooleanGetValue((CFBooleanRef)property)) ? "1" : "0";
    }
  }

  return value;
}
開發者ID:PoppySeedPlehzr,項目名稱:osquery,代碼行數:25,代碼來源:iokit.cpp

示例3: typeFromCFTypeRef

static CFType typeFromCFTypeRef(CFTypeRef type)
{
    ASSERT(type);

    if (type == tokenNullTypeRef())
        return Null;

    CFTypeID typeID = CFGetTypeID(type);
    if (typeID == CFArrayGetTypeID())
        return CFArray;
    if (typeID == CFBooleanGetTypeID())
        return CFBoolean;
    if (typeID == CFDataGetTypeID())
        return CFData;
    if (typeID == CFDictionaryGetTypeID())
        return CFDictionary;
    if (typeID == CFNullGetTypeID())
        return CFNull;
    if (typeID == CFNumberGetTypeID())
        return CFNumber;
    if (typeID == CFStringGetTypeID())
        return CFString;
    if (typeID == CFURLGetTypeID())
        return CFURL;
#if PLATFORM(MAC)
    if (typeID == SecCertificateGetTypeID())
        return SecCertificate;
#endif

    ASSERT_NOT_REACHED();
    return Unknown;
}
開發者ID:ACSOP,項目名稱:android_external_webkit,代碼行數:32,代碼來源:ArgumentCodersCF.cpp

示例4: KJSValueToJSObject

double UserObjectImp::toNumber(ExecState *exec) const
{
    double result = 0;
    JSUserObject* jsObjPtr = KJSValueToJSObject(toObject(exec), exec);
    CFTypeRef cfValue = jsObjPtr ? jsObjPtr->CopyCFValue() : 0;
    if (cfValue)
    {
        CFTypeID cfType = CFGetTypeID(cfValue);

        if (cfValue == GetCFNull())
        {
            //
        }
        else if (cfType == CFBooleanGetTypeID())
        {
            if (cfValue == kCFBooleanTrue)
            {
                result = 1;
            }
        }
        else if (cfType == CFStringGetTypeID())
        {
            result = CFStringGetDoubleValue((CFStringRef)cfValue);
        }
        else if (cfType == CFNumberGetTypeID())
        {
            CFNumberGetValue((CFNumberRef)cfValue, kCFNumberDoubleType, &result);
        }
    }
    ReleaseCFType(cfValue);
    if (jsObjPtr) jsObjPtr->Release();
    return result;
}
開發者ID:cdaffara,項目名稱:symbiandump-mw4,代碼行數:33,代碼來源:UserObjectImp.cpp

示例5: stringFromCFAbsoluteTime

std::string DiskArbitrationEventPublisher::getProperty(
    const CFStringRef& property, const CFDictionaryRef& dict) {
  CFTypeRef value = (CFTypeRef)CFDictionaryGetValue(dict, property);
  if (value == nullptr) {
    return "";
  }

  if (CFStringCompare(property, CFSTR(kDAAppearanceTime_), kNilOptions) ==
      kCFCompareEqualTo) {
    return stringFromCFAbsoluteTime((CFDataRef)value);
  }

  if (CFGetTypeID(value) == CFNumberGetTypeID()) {
    return stringFromCFNumber((CFDataRef)value,
                              CFNumberGetType((CFNumberRef)value));
  } else if (CFGetTypeID(value) == CFStringGetTypeID()) {
    return stringFromCFString((CFStringRef)value);
  } else if (CFGetTypeID(value) == CFBooleanGetTypeID()) {
    return (CFBooleanGetValue((CFBooleanRef)value)) ? "1" : "0";
  } else if (CFGetTypeID(value) == CFUUIDGetTypeID()) {
    return stringFromCFString(
        CFUUIDCreateString(kCFAllocatorDefault, (CFUUIDRef)value));
  }
  return "";
}
開發者ID:PoppySeedPlehzr,項目名稱:osquery,代碼行數:25,代碼來源:diskarbitration.cpp

示例6: jsUndefined

JSValue *UserObjectImp::toPrimitive(ExecState *exec, JSType preferredType) const
{
    JSValue *result = jsUndefined();
    JSUserObject* jsObjPtr = KJSValueToJSObject(toObject(exec), exec);
    CFTypeRef cfValue = jsObjPtr ? jsObjPtr->CopyCFValue() : 0;
    if (cfValue) {
        CFTypeID cfType = CFGetTypeID(cfValue);  // toPrimitive
        if (cfValue == GetCFNull()) {
            result = jsNull();
        }
        else if (cfType == CFBooleanGetTypeID()) {
            if (cfValue == kCFBooleanTrue) {
                result = jsBoolean(true);
            } else {
                result = jsBoolean(false);
            }
        } else if (cfType == CFStringGetTypeID()) {
            result = jsString(CFStringToUString((CFStringRef)cfValue));
        } else if (cfType == CFNumberGetTypeID()) {
            double d = 0.0;
            CFNumberGetValue((CFNumberRef)cfValue, kCFNumberDoubleType, &d);
            result = jsNumber(d);
        } else if (cfType == CFURLGetTypeID()) {
            CFURLRef absURL = CFURLCopyAbsoluteURL((CFURLRef)cfValue);
            if (absURL) {
                result = jsString(CFStringToUString(CFURLGetString(absURL)));
                ReleaseCFType(absURL);
            }
        }
        ReleaseCFType(cfValue);
    }
    if (jsObjPtr)
        jsObjPtr->Release();
    return result;
}
開發者ID:cdaffara,項目名稱:symbiandump-mw4,代碼行數:35,代碼來源:UserObjectImp.cpp

示例7: EnableExtendedLogging

void EnableExtendedLogging(SDMMD_AMDeviceRef device)
{
	sdmmd_return_t result = SDMMD_AMDeviceConnect(device);
	if (SDM_MD_CallSuccessful(result)) {
		result = SDMMD_AMDeviceStartSession(device);
		if (SDM_MD_CallSuccessful(result)) {
			CFTypeRef value = SDMMD_AMDeviceCopyValue(device, CFSTR(AMSVC_MOBILE_DEBUG), CFSTR(kEnableLockdownExtendedLogging));
			if (CFGetTypeID(value) == CFBooleanGetTypeID()) {
				if (!CFBooleanGetValue(value)) {
					result = SDMMD_AMDeviceSetValue(device, CFSTR(AMSVC_MOBILE_DEBUG), CFSTR(kEnableLockdownExtendedLogging), kCFBooleanTrue);
					if (SDM_MD_CallSuccessful(result)) {
						printf("Enabling extended logging...\n");
					}
				}
				else {
					printf("Extended logging already enabled.\n");
				}
			}
			else {
				PrintCFType(value);
			}
			CFSafeRelease(value);
		}
		SDMMD_AMDeviceStopSession(device);
		SDMMD_AMDeviceDisconnect(device);
	}
}
開發者ID:K0smas,項目名稱:SDMMobileDevice,代碼行數:27,代碼來源:syslog.c

示例8: CopyCFTypeValue

void	CASettingsStorage::CopyBoolValue(CFStringRef inKey, bool& outValue, bool inDefaultValue) const
{
	//	initialize the return value
	outValue = inDefaultValue;
	
	//	get the raw value
	CFTypeRef theValue = NULL;
	CopyCFTypeValue(inKey, theValue, NULL);
	
	//	for this type, NULL is an invalid value
	if(theValue != NULL)
	{
		//	bools can be made from either CFBooleans or CFNumbers
		if(CFGetTypeID(theValue) == CFBooleanGetTypeID())
		{
			//	get the return value from the CF object
			outValue = CFBooleanGetValue(static_cast<CFBooleanRef>(theValue));
		}
		else if(CFGetTypeID(theValue) == CFNumberGetTypeID())
		{
			//	get the numeric value
			SInt32 theNumericValue = 0;
			CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &theNumericValue);
			
			//	non-zero indicates true
			outValue = theNumericValue != 0;
		}
		
		//	release the value since we aren't returning it
		CFRelease(theValue);
	}
}
開發者ID:11020156,項目名稱:SampleCode,代碼行數:32,代碼來源:CASettingsStorage.cpp

示例9: getBool

//////////////////////////////////////////////////////////////////////////
//Boolean 
//////////////////////////////////////////////////////////////////////////
Boolean
getBool(CFTypeRef preference, Boolean* boolean)
{
	Boolean ret = FALSE;

	if (!preference)
		return FALSE;

	if (CFGetTypeID(preference) == CFBooleanGetTypeID()) {
		ret = TRUE;
		*boolean = CFBooleanGetValue((CFBooleanRef) preference);
	}
	else if (CFGetTypeID(preference) == CFStringGetTypeID()) {
		if (!CFStringCompare((CFStringRef)preference, Yes, kCFCompareCaseInsensitive)) {
			ret = TRUE;
			*boolean = TRUE;
		}
		else if (!CFStringCompare((CFStringRef)preference, No, kCFCompareCaseInsensitive)) {
			ret = TRUE;
			*boolean = FALSE;
		}
		else if (!CFStringCompare((CFStringRef)preference, True, kCFCompareCaseInsensitive)) {
			ret = TRUE;
			*boolean = TRUE;
		}
		else if (!CFStringCompare((CFStringRef)preference, False, kCFCompareCaseInsensitive)) {
			ret = TRUE;
			*boolean = FALSE;
		}
	}

	return ret;
}
開發者ID:NSOiO,項目名稱:freequartz,代碼行數:36,代碼來源:CGDefaults.c

示例10: printObj

static void printObj(CFPropertyListRef obj, struct printContext* c) {
	CFTypeID typeID = CFGetTypeID(obj);
	if (typeID == _CFKeyedArchiverUIDGetTypeID()) {
		unsigned uid = _CFKeyedArchiverUIDGetValue(obj);
		CFPropertyListRef refObj = CFArrayGetValueAtIndex(c->objs, uid);
		if (CFEqual(refObj, CFSTR("$null")))
			printf("nil");
		else if (c->refCount[uid] > 1 && isComplexObj(refObj))
			printf("{CF$UID = %u;}", uid);
		else
			printObj(refObj, c);
	} else if (typeID == CFArrayGetTypeID()) {
		printf("(\n");
		++ c->tabs;
		CFArrayApplyFunction(obj, CFRangeMake(0, CFArrayGetCount(obj)), (CFArrayApplierFunction)&printObjAsArrayEntry, c);
		-- c->tabs;
		for (unsigned i = 0; i < c->tabs; ++ i)
			printf("\t");
		printf(")");
	} else if (typeID == CFDictionaryGetTypeID()) {
		CFStringRef className = CFDictionaryGetValue(obj, CFSTR("$classname"));
		if (className != NULL)
			printObjAsClassName(className);
		else {
			printf("{\n");
			++ c->tabs;
			CFIndex dictCount = CFDictionaryGetCount(obj);
			
			struct dictionarySorterContext sc;
			sc.keys = malloc(sizeof(CFStringRef)*dictCount);
			sc.values = malloc(sizeof(CFPropertyListRef)*dictCount);
			unsigned* mapping = malloc(sizeof(unsigned)*dictCount);
			for (unsigned i = 0; i < dictCount; ++ i)
				mapping[i] = i;
			CFDictionaryGetKeysAndValues(obj, (const void**)sc.keys, sc.values);
			qsort_r(mapping, dictCount, sizeof(unsigned), &sc, (int(*)(void*,const void*,const void*))&dictionaryComparer);
			for (unsigned i = 0; i < dictCount; ++ i)
				printObjAsDictionaryEntry(sc.keys[mapping[i]], sc.values[mapping[i]], c);
			free(mapping);
			free(sc.keys);
			free(sc.values);
			-- c->tabs;
			for (unsigned i = 0; i < c->tabs; ++ i)
				printf("\t");
			printf("}");
		}
	} else if (typeID == CFDataGetTypeID())
		printObjAsData(obj);
	else if (typeID == CFNumberGetTypeID())
		printObjAsNumber(obj);
	else if (typeID == CFStringGetTypeID())
		printObjAsString(obj);
	else if (typeID == CFBooleanGetTypeID())
		printf(CFBooleanGetValue(obj) ? "true" : "false");
	else if (typeID == CFDateGetTypeID()) 
		printf("/*date*/ %0.09g", CFDateGetAbsoluteTime(obj));

}
開發者ID:bu2,項目名稱:networkpx,代碼行數:58,代碼來源:visualize-archived-object.c

示例11: InternSettings

static void InternSettings(CFDictionaryRef srcDict, MySettings* settings)
{
    CFTypeRef dictValue;
    
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHaveSelection)) &&
        (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
            settings->mHaveSelection = CFBooleanGetValue((CFBooleanRef)dictValue);

    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHaveFrames)) &&
        (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
            settings->mHaveFrames = CFBooleanGetValue((CFBooleanRef)dictValue);

    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHaveFrameSelected)) &&
        (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
            settings->mHaveFrameSelected = CFBooleanGetValue((CFBooleanRef)dictValue);
    
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintFrameType)) &&
        (CFGetTypeID(dictValue) == CFStringGetTypeID())) {
        if (CFEqual(dictValue, kPDEValueFramesAsIs))
            settings->mPrintFrameAsIs = true;
        else if (CFEqual(dictValue, kPDEValueSelectedFrame))
            settings->mPrintSelectedFrame = true;
        else if (CFEqual(dictValue, kPDEValueEachFrameSep))
            settings->mPrintFramesSeparately = true;
    }

    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintSelection)) &&
        (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
            settings->mPrintSelection = CFBooleanGetValue((CFBooleanRef)dictValue); 
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyShrinkToFit)) &&
        (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
            settings->mShrinkToFit = CFBooleanGetValue((CFBooleanRef)dictValue);
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintBGColors)) &&
        (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
            settings->mPrintBGColors = CFBooleanGetValue((CFBooleanRef)dictValue);
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyPrintBGImages)) &&
        (CFGetTypeID(dictValue) == CFBooleanGetTypeID()))
            settings->mPrintBGImages = CFBooleanGetValue((CFBooleanRef)dictValue);
    
    
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHeaderLeft)) &&
        (CFGetTypeID(dictValue) == CFStringGetTypeID()))
            settings->mHeaderLeft = MyCFAssign(dictValue, settings->mHeaderLeft);
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHeaderCenter)) &&
        (CFGetTypeID(dictValue) == CFStringGetTypeID()))
            settings->mHeaderCenter = MyCFAssign(dictValue, settings->mHeaderCenter);
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyHeaderRight)) &&
        (CFGetTypeID(dictValue) == CFStringGetTypeID()))
            settings->mHeaderRight = MyCFAssign(dictValue, settings->mHeaderRight);
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyFooterLeft)) &&
        (CFGetTypeID(dictValue) == CFStringGetTypeID()))
            settings->mFooterLeft = MyCFAssign(dictValue, settings->mFooterLeft);
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyFooterCenter)) &&
        (CFGetTypeID(dictValue) == CFStringGetTypeID()))
            settings->mFooterCenter = MyCFAssign(dictValue, settings->mFooterCenter);
    if ((dictValue = CFDictionaryGetValue(srcDict, kPDEKeyFooterRight)) &&
        (CFGetTypeID(dictValue) == CFStringGetTypeID()))
            settings->mFooterRight = MyCFAssign(dictValue, settings->mFooterRight);
}
開發者ID:EdgarChen,項目名稱:mozilla-cvs-history,代碼行數:59,代碼來源:PDECustom.c

示例12: __attribute__

__attribute__((constructor)) void Init_TSICTString(void)
{
    kCFDataTypeID        = CFDataGetTypeID();
    kCFStringTypeID      = CFStringGetTypeID();
    kCFNumberTypeID      = CFNumberGetTypeID();
    kCFBooleanTypeID     = CFBooleanGetTypeID();
    kCFNullTypeID        = CFNullGetTypeID();
    kCFArrayTypeID       = CFArrayGetTypeID();
    kCFDictionaryTypeID  = CFDictionaryGetTypeID();
}
開發者ID:4justinstewart,項目名稱:Polity,代碼行數:10,代碼來源:TSICTString.c

示例13: init_log

static void
init_log(void)
{
    static dispatch_once_t once = 0;
    dispatch_once(&once, ^{
	    CFBooleanRef b;
	    b = CFPreferencesCopyAppValue(CFSTR("EnableDebugging"),
					  CFSTR("com.apple.MITKerberosShim"));
	    if (b && CFGetTypeID(b) == CFBooleanGetTypeID())
		do_log = CFBooleanGetValue(b);
    });
開發者ID:heimdal,項目名稱:MKShim,代碼行數:11,代碼來源:misc.c

示例14: GetValue

CFBooleanRef SFB::Audio::Metadata::GetCompilation() const
{
	CFTypeRef value = GetValue(kCompilationKey);
	
	if(nullptr == value)
		return nullptr;

	if(CFBooleanGetTypeID() != CFGetTypeID(value))
		return nullptr;
	else
		return (CFBooleanRef)value;
}
開發者ID:JanX2,項目名稱:SFBAudioEngine,代碼行數:12,代碼來源:AudioMetadata.cpp

示例15: getBoolForKey

static bool getBoolForKey(CFDictionaryRef dict, CFStringRef key, bool default_value) {
	CFTypeRef value = CFDictionaryGetValue(dict, key);
	if (value) {
		if (CFGetTypeID(value) == CFBooleanGetTypeID()) {
			return CFBooleanGetValue(value);
		} else {
			secwarning("Value %@ for key %@ is not bool", value, key);
		}
	}
    
	return default_value;
}
開發者ID:alfintatorkace,項目名稱:osx-10.9-opensource,代碼行數:12,代碼來源:SecKey.c


注:本文中的CFBooleanGetTypeID函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。