当前位置: 首页>>代码示例>>C++>>正文


C++ CFDictionaryGetTypeID函数代码示例

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


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

示例1: GetDocTypeForExt

// Given a data structure representing document type data, or a list of such
// structures, find the one which matches a particular file extension
// The result will be a CFDictionary containining document type data
// if a match is found, or null otherwise
CFDictionaryRef GetDocTypeForExt( CFTypeRef docTypeData, CFStringRef requiredExt )
{
    if( !docTypeData )
        return NULL;

    if( CFGetTypeID( docTypeData ) == CFArrayGetTypeID() )
    {
        CFTypeRef item;
        CFArrayRef docTypes;
        docTypes = reinterpret_cast< CFArrayRef >( docTypeData );

        for( CFIndex i = 0, n = CFArrayGetCount( docTypes ); i < n; i++ )
        {
            item = CFArrayGetValueAtIndex( docTypes, i );

            if( CFGetTypeID( item ) == CFDictionaryGetTypeID() )
            {
                CFDictionaryRef docType;
                docType = reinterpret_cast< CFDictionaryRef >( item );

                if( CheckDocTypeMatchesExt( docType, requiredExt ) )
                    return docType;
            }
        }
    }

    if( CFGetTypeID( docTypeData ) == CFDictionaryGetTypeID() )
    {
        CFDictionaryRef docType = reinterpret_cast< CFDictionaryRef >( docTypeData );

        if( CheckDocTypeMatchesExt( docType, requiredExt ) )
            return docType;
    }

    return NULL;
}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:40,代码来源:mimetype.cpp

示例2: HIDTopLevelElementHandler

static void
HIDTopLevelElementHandler(const void *value, void *parameter)
{
    CFTypeRef refCF = 0;
    if (CFGetTypeID(value) != CFDictionaryGetTypeID())
        return;
    refCF = CFDictionaryGetValue(value, CFSTR(kIOHIDElementUsagePageKey));
    if (!CFNumberGetValue
        (refCF, kCFNumberLongType, &((recDevice *) parameter)->usagePage))
        SDL_SetError("CFNumberGetValue error retrieving pDevice->usagePage.");
    refCF = CFDictionaryGetValue(value, CFSTR(kIOHIDElementUsageKey));
    if (!CFNumberGetValue
        (refCF, kCFNumberLongType, &((recDevice *) parameter)->usage))
        SDL_SetError("CFNumberGetValue error retrieving pDevice->usage.");
}
开发者ID:Alexander--,项目名称:Wesnoth-1.8-for-Android,代码行数:15,代码来源:SDL_sysjoystick.c

示例3: dict

		// Given a CFData object generated by the save command, this will re-establish
		// the CAStreamBasicDescription
OSStatus	CAStreamBasicDescription::Restore (CFPropertyListRef& inData)
{
	if (CFGetTypeID (inData) != CFDictionaryGetTypeID()) return -1;
	CACFDictionary dict(static_cast<CFDictionaryRef>(inData), false);
	
	if (!dict.GetFloat64 (kSampleRate, mSampleRate)) return -1;
	if (!dict.GetUInt32 (kFormat, mFormatID)) return -1;
	if (!dict.GetUInt32 (kFormatFlags, mFormatFlags)) return -1;
	if (!dict.GetUInt32 (kPacketBytes, mBytesPerPacket)) return -1;
	if (!dict.GetUInt32 (kFramePackets, mFramesPerPacket)) return -1;
	if (!dict.GetUInt32 (kFrameBytes, mBytesPerFrame)) return -1;
	if (!dict.GetUInt32 (kFrameChannels, mChannelsPerFrame)) return -1;
	if (!dict.GetUInt32 (kChannelBits, mBitsPerChannel)) return -1;

	return noErr;
}
开发者ID:fruitsamples,项目名称:PublicUtility,代码行数:18,代码来源:CAPersistence.cpp

示例4: CFGetTypeID

void mUSBHID::registerHIDProperties(CFTypeRef object){
	CFTypeID type = CFGetTypeID(object);
	if (type == CFArrayGetTypeID()){
		registerHID_CFArray((const __CFArray*)object);
	} else if (type == CFDictionaryGetTypeID()){
		registerHID_CFDictionary((const __CFDictionary*)object);
	} else if (type == CFBooleanGetTypeID()){
		//MyCFBoolean(object);
	} else if (type == CFNumberGetTypeID()){
		//MyCFNumberShow(object);
	} else if (type == CFStringGetTypeID()){
		//MyCFStringShow(object);
	} else{
		//mprintf("<unknown hid object>");
	}
}
开发者ID:BramVerhoef,项目名称:mworks,代码行数:16,代码来源:USBHID.cpp

示例5:

bool	CACFDictionary::GetDictionary(const CFStringRef inKey, CFDictionaryRef& outValue) const
{
	bool theAnswer = false;
	
	CFTypeRef theValue = NULL;
	if(GetCFType(inKey, theValue))
	{
		if((theValue != NULL) && (CFGetTypeID(theValue) == CFDictionaryGetTypeID()))
		{
			outValue = static_cast<CFDictionaryRef>(theValue);
			theAnswer = true;
		}
	}
	
	return theAnswer;
}
开发者ID:DanielAeolusLaude,项目名称:ardour,代码行数:16,代码来源:CACFDictionary.cpp

示例6:

bool	CACFArray::GetDictionary(UInt32 inIndex, CFDictionaryRef& outItem) const
{
	bool theAnswer = false;
	
	CFTypeRef theItem = NULL;
	if(GetCFType(inIndex, theItem))
	{
		if((theItem != NULL) && (CFGetTypeID(theItem) == CFDictionaryGetTypeID()))
		{
			outItem = static_cast<CFDictionaryRef>(theItem);
			theAnswer = true;
		}
	}
	
	return theAnswer;
}
开发者ID:Michael-Lfx,项目名称:iOS,代码行数:16,代码来源:CACFArray.cpp

示例7: _rd_prefs_load_recent_files

static void
_rd_prefs_load_recent_files(rd_recent_file_t *r, int num_files, CFStringRef app)
{
    assert(r != NULL);
    assert(app != NULL);

    CFArrayRef the_array = CFPreferencesCopyAppValue(CFSTR("recent_files"), app);
    if (the_array == NULL) {
        return;
    }
    
    CFIndex array_count = CFArrayGetCount(the_array);        
    int i;
    for (i = 0; i < num_files; i++) {
        rd_recent_file_t *f = &r[i];
        if (i >= array_count) {
            bzero(f, sizeof(*f));
        } else {
            const void *f_val    = CFArrayGetValueAtIndex(the_array, i);
            if (CFGetTypeID(f_val) == CFStringGetTypeID()) {
                // string.  set the time to now.
                if (CFStringGetCString(f_val, f->path, sizeof(f->path), kCFStringEncodingUTF8)) {
                    // success 
                    f->path[sizeof(f->path) - 1] = '\0';
                    f->last_atime = (unsigned long) time(NULL);
                }
            } else if (CFGetTypeID(f_val) == CFDictionaryGetTypeID()) {
                CFStringRef f_name  = CFDictionaryGetValue(f_val, CFSTR("name"));
                CFNumberRef f_atime = CFDictionaryGetValue(f_val, CFSTR("atime"));
                
                if (CFStringGetCString(f_name, f->path, sizeof(f->path), kCFStringEncodingUTF8)) {
                    // success
                    f->path[sizeof(f->path) - 1] = '\0';
                
                    if (CFNumberGetValue(f_atime, kCFNumberLongType, (long*) &f->last_atime)) {
                        // success
                    } else {
                        f->last_atime = (unsigned long) time(NULL);
                    }
                }
            }
        }
    }
    
    CFRelease(the_array);
}
开发者ID:kjk,项目名称:roaringdiff,代码行数:46,代码来源:rd_prefs.c

示例8: MyBurnSessionDeviceCheckCallBack

static Boolean
MyBurnSessionDeviceCheckCallBack(DRBurnSessionRef burnSession, DRDeviceRef device)
{
    #pragma unused(burnSession)
    
    CFDictionaryRef deviceDict;
    CFDictionaryRef writeCapDict;
    CFBooleanRef canWriteDVDRAM;
    CFStringRef vendorName;
    CFStringRef productName;
    char vendor[256];
    char product[256];
    Boolean showDeviceInList;
    
    /* DRDeviceCopyInfo will return information that identifies the device and describes its
    capabilities. The information includes the vendor's name, the product identifier, whether 
    the device can burn CDs or DVDs, and so on. */
    deviceDict = DRDeviceCopyInfo(device);
    assert(deviceDict != NULL);
        
    vendorName = CFDictionaryGetValue(deviceDict, kDRDeviceVendorNameKey);
    assert((vendorName != NULL) && (CFGetTypeID(vendorName) == CFStringGetTypeID()));
    
    productName = CFDictionaryGetValue(deviceDict, kDRDeviceProductNameKey);
    assert((productName != NULL) && (CFGetTypeID(productName) == CFStringGetTypeID()));
        
    if (CFStringGetCString(vendorName, vendor, sizeof(vendor), kCFStringEncodingASCII)) {
        if (CFStringGetCString(productName, product, sizeof(product), kCFStringEncodingASCII)) {
        
            fprintf(stderr, "%s ", vendor);
            fprintf(stderr, "%s Checked.\n", product);
        }
    }
    
    writeCapDict = CFDictionaryGetValue(deviceDict, kDRDeviceWriteCapabilitiesKey);
    assert((writeCapDict != NULL) && (CFGetTypeID(writeCapDict) == CFDictionaryGetTypeID()));
    
    canWriteDVDRAM = CFDictionaryGetValue(writeCapDict, kDRDeviceCanWriteDVDRAMKey);
    assert((canWriteDVDRAM != NULL) && (CFGetTypeID(canWriteDVDRAM) == CFBooleanGetTypeID()));

    // Don't show DVD-RAM drives in the list.
    showDeviceInList = !CFBooleanGetValue(canWriteDVDRAM);
    CFRelease(deviceDict);
    
    return showDeviceInList;
}
开发者ID:arnelh,项目名称:Examples,代码行数:46,代码来源:DRDataBurnCarbonUI.c

示例9: switch

//
// Process % scan forms.
// This delivers the object value, scanf-style, somehow.
//
bool CFScan::scanformat(CFTypeRef obj)
{
	switch (*++format) {
	case F_OBJECT:
		store<CFTypeRef>(obj);
		return true;
	case F_ARRAY:	// %a*
		return typescan(obj, CFArrayGetTypeID()) == done;
	case F_BOOLEAN:
		if (Typescan rc = typescan(obj, CFBooleanGetTypeID()))
			return rc == done;
		switch (*format) {
		case 'f':	// %Bf - two arguments (value, &variable)
			{
				unsigned flag = va_arg(args, unsigned);
				unsigned *value = va_arg(args, unsigned *);
				if (obj == kCFBooleanTrue && !suppress)
					*value |= flag;
				return true;
			}
		default:	// %b - CFBoolean as int boolean
			store<int>(obj == kCFBooleanTrue);
			return true;
		}
	case F_DICTIONARY:
		return typescan(obj, CFDictionaryGetTypeID()) == done;
	case 'd':	// %d - int
		return scannumber<int>(obj);
	case F_NUMBER:
		return typescan(obj, CFNumberGetTypeID()) == done;
	case F_STRING:
	case 's':
		if (Typescan rc = typescan(obj, CFStringGetTypeID()))
			return rc == done;
		// %s
		store<std::string>(cfString(CFStringRef(obj)));
		return true;
	case 'u':
		return scannumber<unsigned int>(obj);
	case F_DATA:
		return typescan(obj, CFDataGetTypeID()) == done;
	default:
		assert(false);
		return false;
	}
}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:50,代码来源:cfmunge.cpp

示例10: print_keys

void print_keys(const void *key, const void *value, void *context)
{
        CFStringRef k = (CFStringRef)key;
        std::string key_str = CFStringGetCStringPtr(k, kCFStringEncodingMacRoman);
        std::string value_str;

        CFTypeID id = CFGetTypeID(value);
        if(id == CFStringGetTypeID())
        {
                CFStringRef v = (CFStringRef)value;
                if(CFStringGetCStringPtr(v, kCFStringEncodingMacRoman))
                {
                        value_str = CFStringGetCStringPtr(v, kCFStringEncodingMacRoman);
                        if(key_str == "kCGWindowName")
                                window_lst[window_lst.size()-1].name = value_str;
                        else if(key_str == "kCGWindowOwnerName")
                                window_lst[window_lst.size()-1].owner = value_str;
                }
        }
        else if(id == CFNumberGetTypeID())
        {
                CFNumberRef v = (CFNumberRef)value;
                int myint;
                CFNumberGetValue(v, kCFNumberSInt64Type, &myint);
                value_str = std::to_string(myint);
                if(key_str == "kCGWindowLayer")
                        window_lst[window_lst.size()-1].layer = myint;
                else if(key_str == "kCGWindowOwnerPID")
                        window_lst[window_lst.size()-1].pid = myint;
                else if(key_str == "X")
                        window_lst[window_lst.size()-1].x = myint;
                else if(key_str == "Y")
                        window_lst[window_lst.size()-1].y = myint;
                else if(key_str == "Width")
                        window_lst[window_lst.size()-1].width = myint;
                else if(key_str == "Height")
                        window_lst[window_lst.size()-1].height = myint;
        }
        else if(id == CFDictionaryGetTypeID())
        {
                CFDictionaryRef elem = (CFDictionaryRef)value;
                CFDictionaryApplyFunction(elem, print_keys, NULL);
                CFRelease(elem);
        } 
}
开发者ID:bpowell,项目名称:mouse,代码行数:45,代码来源:mouse.cpp

示例11: CopyKeyFromFile

static CFTypeRef
CopyKeyFromFile(CFStringRef domain, CFStringRef key)
{
    CFReadStreamRef s;
    CFDictionaryRef d;
    CFStringRef file;
    CFErrorRef e;
    CFURLRef url;
    CFTypeRef val;
    
    file = CFStringCreateWithFormat(NULL, 0, CFSTR("/Library/Preferences/%@.plist"), domain);
    if (file == NULL)
	return NULL;
    
    url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, domain, kCFURLPOSIXPathStyle, false);
    CFRelease(file);
    if (url == NULL)
	return NULL;
    
    s = CFReadStreamCreateWithFile(kCFAllocatorDefault, url);
    CFRelease(url);
    if (s == NULL)
	return NULL;
    
    if (!CFReadStreamOpen(s)) {
	CFRelease(s);
	return NULL;
    }
    
    d = (CFDictionaryRef)CFPropertyListCreateWithStream (kCFAllocatorDefault, s, 0, kCFPropertyListImmutable, NULL, &e);
    CFRelease(s);
    if (d == NULL)
	return NULL;
    
    if (CFGetTypeID(d) != CFDictionaryGetTypeID()) {
	CFRelease(d);
	return NULL;
    }
    
    val = CFDictionaryGetValue(d, key);
    if (val)
	CFRetain(val);
    CFRelease(d);
    return val;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:45,代码来源:misc.c

示例12: pkinit_get_pref_dict

/*
 * Obtain the CFDictionary representing this user's PKINIT client cert prefs, if it
 * exists. Returns noErr or errSecItemNotFound as appropriate.
 */
static OSStatus pkinit_get_pref_dict(
    CFDictionaryRef *dict)
{
    CFDictionaryRef theDict;
    theDict = (CFDictionaryRef)CFPreferencesCopyValue(CFSTR(kPkinitClientCertKey),
                                                      CFSTR(kPkinitClientCertApp), kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
    if(theDict == NULL) {
        pkiDebug("pkinit_get_pref_dict: no kPkinitClientCertKey\n");
        return errSecItemNotFound;
    }
    if(CFGetTypeID(theDict) != CFDictionaryGetTypeID()) {
        pkiDebug("pkinit_get_pref_dict: bad kPkinitClientCertKey pref\n");
        CFRelease(theDict);
        return errSecItemNotFound;
    }
    *dict = theDict;
    return noErr;
}
开发者ID:Brainiarc7,项目名称:pbis,代码行数:22,代码来源:pkinit_apple_cert_store.c

示例13: testPostGet

static bool testPostGet(CFStringRef key, CFTypeRef cfobj, dispatch_queue_t processQueue, dispatch_group_t dgroup)
{
    CFErrorRef error = NULL;
    bool result = false;
    CFTypeRef cfv = NULL;
    
    testPutObjectInCloud(key, cfobj, &error, dgroup, processQueue);
    CFTypeRef cfvalue = testGetObjectFromCloud(key, processQueue, dgroup);
    printTimeNow("finished getObjectFromCloud");
    if (!cfvalue)
        return false;
    if (CFGetTypeID(cfvalue)==CFDictionaryGetTypeID())
        cfv = CFDictionaryGetValue(cfvalue, key);
    else
        cfv = cfvalue;
    result = CFEqual(cfobj, cfv);
    return result;
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:18,代码来源:sc-90-ckdclient.c

示例14: genOSXPrefValues

void genOSXPrefValues(const CFTypeRef& value,
                      const Row& base,
                      QueryData& results,
                      size_t depth) {
  if (value == nullptr) {
    return;
  }

  // Since we recurse when parsing Arrays/Dicts, monitor stack limits.
  if (++depth > kPreferenceDepthLimit) {
    TLOG << "The macOS preference: " << base.at("domain")
         << " exceeded subkey depth limit: " << kPreferenceDepthLimit;
    return;
  }

  // Emit a string representation for each preference type.
  Row r = base;
  if (CFGetTypeID(value) == CFNumberGetTypeID()) {
    r["value"] = stringFromCFNumber(static_cast<CFDataRef>(value));
  } else if (CFGetTypeID(value) == CFStringGetTypeID()) {
    r["value"] = stringFromCFString(static_cast<CFStringRef>(value));
  } else if (CFGetTypeID(value) == CFDateGetTypeID()) {
    auto unix_time = CFDateGetAbsoluteTime(static_cast<CFDateRef>(value)) +
                     kCFAbsoluteTimeIntervalSince1970;
    r["value"] = boost::lexical_cast<std::string>(std::llround(unix_time));
  } else if (CFGetTypeID(value) == CFBooleanGetTypeID()) {
    r["value"] = (CFBooleanGetValue(static_cast<CFBooleanRef>(value)) == TRUE)
                     ? "true"
                     : "false";
  } else if (CFGetTypeID(value) == CFDataGetTypeID()) {
    // Do not include data preferences.
  } else if (CFGetTypeID(value) == CFArrayGetTypeID()) {
    genOSXListPref(static_cast<CFArrayRef>(value), base, results, depth);
    return;
  } else if (CFGetTypeID(value) == CFDictionaryGetTypeID()) {
    // Generate a row for each hash key.
    TRowResults trow(base, results, depth);
    CFDictionaryApplyFunction(
        static_cast<CFDictionaryRef>(value), &genOSXHashPref, &trow);
    return;
  }

  results.push_back(std::move(r));
}
开发者ID:theopolis,项目名称:osquery,代码行数:44,代码来源:preferences.cpp

示例15: CFQPropertyListDeepApplyFunction

extern pascal void CFQPropertyListDeepApplyFunction(CFPropertyListRef propList, 
													CFQPropertyListDeepApplierFunction func,
													void *context)
	// See comment in header.
{
	assert(propList != NULL);
	assert(func     != NULL);
	
	// Call "func" for this node.
	
	func(propList, context);
	
	// If this node is a dictionary or an array, call func for 
	// each element.
	
	if ( CFGetTypeID(propList) == CFDictionaryGetTypeID() ) {
		CFIndex count;
		CFIndex index;
		
		count = CFDictionaryGetCount( (CFDictionaryRef) propList);
		if (count > 0) {
			const void **keys;

			keys = (const void **) malloc( count * sizeof(const void *));
			if (keys != NULL) {
				CFDictionaryGetKeysAndValues( (CFDictionaryRef) propList, keys, NULL);
				
				for (index = 0; index < count; index++) {
					CFQPropertyListDeepApplyFunction(CFDictionaryGetValue( (CFDictionaryRef) propList, keys[index]), func, context);
				}
				free(keys);
			}
		}
	} else if ( CFGetTypeID(propList) == CFArrayGetTypeID() ) {
		CFIndex count;
		long    index;
		
		count = CFArrayGetCount( (CFArrayRef) propList);
		for (index = 0; index < count; index++) {
			CFQPropertyListDeepApplyFunction(CFArrayGetValueAtIndex( (CFArrayRef) propList, index), func, context);
		}
	}
}
开发者ID:paullalonde,项目名称:B,代码行数:43,代码来源:MoreCFQ.c


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