这篇教程C++ CFBooleanGetValue函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CFBooleanGetValue函数的典型用法代码示例。如果您正苦于以下问题:C++ CFBooleanGetValue函数的具体用法?C++ CFBooleanGetValue怎么用?C++ CFBooleanGetValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CFBooleanGetValue函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: handleConfigFilestatic void handleConfigFile(const char *file){ bool on_demand = true, is_kunc = false; uid_t u = getuid(); struct passwd *pwe; char usr[4096]; char serv_name[4096]; char serv_cmd[4096]; CFPropertyListRef plist = CreateMyPropertyListFromFile(file); if (u == 0) u = geteuid(); if (plist) { if (CFDictionaryContainsKey(plist, CFSTR("Username"))) { const void *v = CFDictionaryGetValue(plist, CFSTR("Username")); if (v) CFStringGetCString(v, usr, sizeof(usr), kCFStringEncodingUTF8); else goto out; if ((pwe = getpwnam(usr))) { u = pwe->pw_uid; } else { fprintf(stderr, "%s: user not found/n", argv0); goto out; } } if (CFDictionaryContainsKey(plist, CFSTR("OnDemand"))) { const void *v = CFDictionaryGetValue(plist, CFSTR("OnDemand")); if (v) on_demand = CFBooleanGetValue(v); else goto out; } if (CFDictionaryContainsKey(plist, CFSTR("ServiceName"))) { const void *v = CFDictionaryGetValue(plist, CFSTR("ServiceName")); if (v) CFStringGetCString(v, serv_name, sizeof(serv_name), kCFStringEncodingUTF8); else goto out; } if (CFDictionaryContainsKey(plist, CFSTR("Command"))) { const void *v = CFDictionaryGetValue(plist, CFSTR("Command")); if (v) CFStringGetCString(v, serv_cmd, sizeof(serv_cmd), kCFStringEncodingUTF8); else goto out; } if (CFDictionaryContainsKey(plist, CFSTR("isKUNCServer"))) { const void *v = CFDictionaryGetValue(plist, CFSTR("isKUNCServer")); if (v && CFBooleanGetValue(v)) is_kunc = true; else goto out; } regServ(u, on_demand, is_kunc, serv_name, serv_cmd); goto out_good;out: fprintf(stdout, "%s: failed to register: %s/n", argv0, file);out_good: CFRelease(plist); } else { fprintf(stderr, "%s: no plist was returned for: %s/n", argv0, file); }}
开发者ID:aosm,项目名称:Startup,代码行数:60,
示例2: _createDirectory// Asssumes caller already knows the directory doesn't exist.static Boolean _createDirectory(CFURLRef dirURL, Boolean worldReadable) { CFAllocatorRef alloc = __CFPreferencesAllocator(); CFURLRef parentURL = CFURLCreateCopyDeletingLastPathComponent(alloc, dirURL); CFBooleanRef val = (CFBooleanRef) CFURLCreatePropertyFromResource(alloc, parentURL, kCFURLFileExists, NULL); Boolean parentExists = (val && CFBooleanGetValue(val)); SInt32 mode; Boolean result; if (val) CFRelease(val); if (!parentExists) { CFStringRef path = CFURLCopyPath(parentURL); if (!CFEqual(path, CFSTR("/"))) { _createDirectory(parentURL, worldReadable); val = (CFBooleanRef) CFURLCreatePropertyFromResource(alloc, parentURL, kCFURLFileExists, NULL); parentExists = (val && CFBooleanGetValue(val)); if (val) CFRelease(val); } CFRelease(path); } if (parentURL) CFRelease(parentURL); if (!parentExists) return false;#if TARGET_OS_OSX || TARGET_OS_LINUX mode = worldReadable ? S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH : S_IRWXU;#else mode = 0666;#endif result = CFURLWriteDataAndPropertiesToResource(dirURL, (CFDataRef)dirURL, URLPropertyDictForPOSIXMode(mode), NULL); URLPropertyDictRelease(); return result;}
开发者ID:JGiola,项目名称:swift-corelibs-foundation,代码行数:32,
示例3: kim_os_preferences_get_boolean_for_keykim_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,
示例4: GetDictionaryBooleanBoolean GetDictionaryBoolean(CFDictionaryRef theDict, const void *key){ Boolean value = false; CFBooleanRef boolRef = (CFBooleanRef) CFDictionaryGetValue(theDict, key); if (boolRef != NULL) value = CFBooleanGetValue(boolRef); return value;}
开发者ID:dtrebilco,项目名称:PreMulAlpha,代码行数:7,
示例5: TSICTStringCreateWithObjectAndFormatTStringIRep* TSICTStringCreateWithObjectAndFormat(CFTypeRef object, TSITStringFormat format){ if (object == NULL) { return TSICTStringCreateNullWithFormat(format); } CFRetain(object); CFTypeID cfType = CFGetTypeID(object); TStringIRep* rep = NULL; if (cfType == kCFDataTypeID) { rep = TSICTStringCreateWithDataOfTypeAndFormat(object, kTSITStringTagString, format); } else if (cfType == kCFStringTypeID) { rep = TSICTStringCreateWithStringAndFormat(object, format); } else if (cfType == kCFNumberTypeID) { rep = TSICTStringCreateWithNumberAndFormat(object, format); } else if (cfType == kCFBooleanTypeID) { if (CFBooleanGetValue(object)) { rep = TSICTStringCreateTrueWithFormat(format); } else { rep = TSICTStringCreateFalseWithFormat(format); } } else if (cfType == kCFNullTypeID) { rep = TSICTStringCreateNullWithFormat(format); } else if (cfType == kCFArrayTypeID) { rep = TSICTStringCreateWithArrayAndFormat(object, format); } else if (cfType == kCFDictionaryTypeID) { rep = TSICTStringCreateWithDictionaryAndFormat(object, format); } else { rep = TSICTStringCreateInvalidWithFormat(format); } CFRelease(object); return rep;}
开发者ID:4justinstewart,项目名称:Polity,代码行数:35,
示例6: EnableExtendedLoggingvoid 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,
示例7: stringFromCFAbsoluteTimestd::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,
示例8: GetImportPrefsstatic void GetImportPrefs(){#if TARGET_API_MAC_CARBON CFStringRef prefs_id = CFStringCreateWithCString(NULL, SUPERPNG_PREFS_ID, kCFStringEncodingASCII); CFStringRef alpha_id = CFStringCreateWithCString(NULL, SUPERPNG_PREFS_ALPHA, kCFStringEncodingASCII); CFStringRef mult_id = CFStringCreateWithCString(NULL, SUPERPNG_PREFS_MULT, kCFStringEncodingASCII); CFPropertyListRef alphaMode_val = CFPreferencesCopyAppValue(alpha_id, prefs_id); CFPropertyListRef mult_val = CFPreferencesCopyAppValue(mult_id, prefs_id); if(alphaMode_val) { char alphaMode_char; if( CFNumberGetValue((CFNumberRef)alphaMode_val, kCFNumberCharType, &alphaMode_char) ) g_alpha = (DialogAlpha)alphaMode_char; CFRelease(alphaMode_val); } if(mult_val) { g_mult = CFBooleanGetValue((CFBooleanRef)mult_val); CFRelease(mult_val); } CFRelease(alpha_id); CFRelease(mult_id); CFRelease(prefs_id);#endif}
开发者ID:dygg,项目名称:SuperPNG,代码行数:34,
示例9: CopyCFTypeValuevoid 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,
示例10: getIOKitPropertystd::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,
示例11: GetDictionaryBooleanstatic bool GetDictionaryBoolean(CFDictionaryRef d, const void *key){ CFBooleanRef ref = (CFBooleanRef) CFDictionaryGetValue(d, key); if(ref) return CFBooleanGetValue(ref); return false;}
开发者ID:CyberSys,项目名称:darkplaces,代码行数:7,
示例12: getBool////////////////////////////////////////////////////////////////////////////Boolean //////////////////////////////////////////////////////////////////////////BooleangetBool(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,
示例13: ScanDictionaryForParametersstatic OSStatus ScanDictionaryForParameters(CFDictionaryRef parameters, void* attributePointers[]){ int i; for (i = 0; i < kNumberOfAttributes; ++i) { // see if the corresponding tag exists in the dictionary CFTypeRef value = CFDictionaryGetValue(parameters, *(gAttributes[i].name)); if (value != NULL) { switch (gAttributes[i].type) { case kStringType: // just return the value *(CFTypeRef*) attributePointers[i] = value; break; case kBooleanType: { CFBooleanRef bRef = (CFBooleanRef) value; *(bool*) attributePointers[i] = CFBooleanGetValue(bRef); } break; case kIntegerType: { CFNumberRef nRef = (CFNumberRef) value; CFNumberGetValue(nRef, kCFNumberSInt32Type, attributePointers[i]); } break; } } } return noErr;}
开发者ID:Apple-FOSS-Mirror,项目名称:libsecurity_keychain,代码行数:35,
示例14: disk_appeared_cbstatic voiddisk_appeared_cb(DADiskRef disk, void *ctx){ CFDictionaryRef description = NULL; CFBooleanRef mountable; CFStringRef content = NULL; if (!ctx || !disk) return; description = DADiskCopyDescription(disk); if (!description) return; mountable = CFDictionaryGetValue(description, kDADiskDescriptionVolumeMountableKey); if (!mountable) goto out; content = CFDictionaryGetValue(description, kDADiskDescriptionMediaContentKey); if (!content) goto out; if (CFBooleanGetValue(mountable) && CFStringCompare(content, CFSTR("53746F72-6167-11AA-AA11-00306543ECAC"), kCFCompareCaseInsensitive) != kCFCompareEqualTo && CFStringCompare(content, CFSTR("426F6F74-0000-11AA-AA11-00306543ECAC"), kCFCompareCaseInsensitive) != kCFCompareEqualTo) { /* The disk is marked mountable and isn't CoreStorage or Apple_Boot, * which means that it actually is mountable (since we lie and mark * CoreStorage disks as mountable). */ *((bool *)ctx) = true; }out: if (description) CFRelease(description);}
开发者ID:naota,项目名称:diskdev_cmds,代码行数:32,
示例15: printObjstatic 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,
示例16: is_optical_media/* * Given disk2s1, look up "disk2" is IOKit and attempt to determine if * it is an optical device. */int is_optical_media(const char *bsdname){ CFMutableDictionaryRef matchingDict; int ret = 0; io_service_t service, start; kern_return_t kernResult; io_iterator_t iter; if ((matchingDict = IOBSDNameMatching(kIOMasterPortDefault, 0, bsdname)) == NULL) return(0); start = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict); if (IO_OBJECT_NULL == start) return (0); service = start; // Create an iterator across all parents of the service object passed in. // since only disk2 would match with ConfirmsTo, and not disk2s1, so // we search the parents until we find "Whole", ie, disk2. kernResult = IORegistryEntryCreateIterator(service, kIOServicePlane, kIORegistryIterateRecursively | kIORegistryIterateParents, &iter); if (KERN_SUCCESS == kernResult) { Boolean isWholeMedia = false; IOObjectRetain(service); do { // Lookup "Whole" if we can if (IOObjectConformsTo(service, kIOMediaClass)) { CFTypeRef wholeMedia; wholeMedia = IORegistryEntryCreateCFProperty(service, CFSTR(kIOMediaWholeKey), kCFAllocatorDefault, 0); if (wholeMedia) { isWholeMedia = CFBooleanGetValue(wholeMedia); CFRelease(wholeMedia); } } // If we found "Whole", check the service type. if (isWholeMedia && ( (IOObjectConformsTo(service, kIOCDMediaClass)) || (IOObjectConformsTo(service, kIODVDMediaClass)) )) { ret = 1; // Is optical, skip } IOObjectRelease(service); } while ((service = IOIteratorNext(iter)) && !isWholeMedia); IOObjectRelease(iter); } IOObjectRelease(start); return ret;}
开发者ID:cbreak-black,项目名称:zfs,代码行数:62,
示例17: extmgr_mntoptsvoid extmgr_mntopts (const char *device, int *mopts, int *eopts, int *nomount){ CFPropertyListRef mediaRoot; CFDictionaryRef media; CFStringRef uuid; CFBooleanRef boolVal; *nomount = 0; mediaRoot = CFPreferencesCopyAppValue(EXT_PREF_KEY_MEDIA, EXT_PREF_ID); if (mediaRoot && CFDictionaryGetTypeID() == CFGetTypeID(mediaRoot)) { uuid = extsuper_uuid(device); if (uuid) { media = CFDictionaryGetValue(mediaRoot, uuid); if (media && CFDictionaryGetTypeID() == CFGetTypeID(media)) { boolVal = CFDictionaryGetValue(media, EXT_PREF_KEY_NOAUTO); if (boolVal && CFBooleanGetValue(boolVal)) { *nomount = 1; goto out; } boolVal = CFDictionaryGetValue(media, EXT_PREF_KEY_RDONLY); if (boolVal && CFBooleanGetValue(boolVal)) { *mopts |= MNT_RDONLY; } boolVal = CFDictionaryGetValue(media, EXT_PREF_KEY_NOPERMS); if (boolVal && CFBooleanGetValue(boolVal)) { *mopts |= MNT_IGNORE_OWNERSHIP; } /* Ext2/3 specific */ boolVal = CFDictionaryGetValue(media, EXT_PREF_KEY_DIRINDEX); if (boolVal && CFBooleanGetValue(boolVal)) { *eopts |= EXT2_MNT_INDEX; } }out: CFRelease(uuid); } } if (mediaRoot) CFRelease(mediaRoot);}
开发者ID:MaddTheSane,项目名称:ext2fsx,代码行数:45,
示例18: volumeIsRemovablestatic Boolean volumeIsRemovable(const char *path){ CFBooleanRef removableRef; if (getVolumeProperty(fs->f_mntonname, kCFURLVolumeIsRemovableKey, &removableRef) && removableRef != NULL) return CFBooleanGetValue(removableRef); else return false;}
开发者ID:Kazu-zamasu,项目名称:kinomajs,代码行数:9,
示例19: InternSettingsstatic 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,
示例20: hasEntitlement/* ---------------------------------------------------------------------------------------------------------------------------------------------------------- */static BooleanhasEntitlement(audit_token_t audit_token, CFStringRef entitlement, CFStringRef vpntype){ Boolean hasEntitlement = FALSE; SecTaskRef task; /* Create the security task from the audit token. */ task = SecTaskCreateWithAuditToken(NULL, audit_token); if (task != NULL) { CFErrorRef error = NULL; CFTypeRef value; /* Get the value for the entitlement. */ value = SecTaskCopyValueForEntitlement(task, entitlement, &error); if (value != NULL) { if (isA_CFBoolean(value)) { if (CFBooleanGetValue(value)) { /* if client DOES have entitlement */ hasEntitlement = TRUE; } } else if (isA_CFArray(value)){ if (vpntype == NULL){ /* we don't care about subtype */ hasEntitlement = TRUE; }else { if (CFArrayContainsValue(value, CFRangeMake(0, CFArrayGetCount(value)), vpntype)) { // if client DOES have entitlement hasEntitlement = TRUE; } } } else { SCLog(TRUE, LOG_ERR, CFSTR("SCNC Controller: entitlement not valid: %@"), entitlement); } CFRelease(value); } else if (error != NULL) { SCLog(TRUE, LOG_ERR, CFSTR("SCNC Controller: SecTaskCopyValueForEntitlement() failed, error=%@: %@"), error, entitlement); CFRelease(error); } CFRelease(task); } else { SCLog(TRUE, LOG_ERR, CFSTR("SCNC Controller: SecTaskCreateWithAuditToken() failed: %@"), entitlement); } return hasEntitlement;}
开发者ID:TARRANUM,项目名称:ppp,代码行数:58,
示例21: utilGetMaskValFromCFDictstatic uint32_tutilGetMaskValFromCFDict(CFDictionaryRef parameters, CFTypeRef key, uint32_t maskValue){ CFTypeRef value = CFDictionaryGetValue(parameters, key); if (value != NULL) { CFBooleanRef bRef = (CFBooleanRef) value; if(CFBooleanGetValue(bRef)) return maskValue; } return 0;}
开发者ID:Apple-FOSS-Mirror,项目名称:libsecurity_keychain,代码行数:10,
示例22: createEventContextvoid DiskArbitrationEventPublisher::DiskAppearedCallback(DADiskRef disk, void* context) { auto ec = createEventContext(); CFDictionaryRef disk_properties = DADiskCopyDescription(disk); CFTypeRef devicePathKey; if (!CFDictionaryGetValueIfPresent( disk_properties, kDADiskDescriptionDevicePathKey, &devicePathKey)) { CFRelease(disk_properties); return; } auto device_path = stringFromCFString((CFStringRef)devicePathKey); ec->device_path = device_path; auto entry = IORegistryEntryFromPath(kIOMasterPortDefault, device_path.c_str()); if (entry == MACH_PORT_NULL) { CFRelease(disk_properties); return; } auto protocol_properties = (CFDictionaryRef)IORegistryEntryCreateCFProperty( entry, CFSTR(kIOPropertyProtocolCharacteristicsKey_), kCFAllocatorDefault, kNilOptions); if (protocol_properties != nullptr) { CFDataRef path = (CFDataRef)CFDictionaryGetValue( protocol_properties, CFSTR(kVirtualInterfaceLocation_)); if (path != nullptr) { ec->path = stringFromCFData(path); // extract checksum once on the whole disk and not for every partition if (CFBooleanGetValue((CFBooleanRef)CFDictionaryGetValue( disk_properties, kDADiskDescriptionMediaWholeKey))) { ec->checksum = extractUdifChecksum(ec->path); } } else { // There was no interface location. ec->path = getProperty(kDADiskDescriptionDevicePathKey, disk_properties); } CFRelease(protocol_properties); } else { ec->path = ""; } if (ec->path.find("/[email C++ CFBundleCopyBundleURL函数代码示例 C++ CFBooleanGetTypeID函数代码示例
|