CFDictionaryGetCount
辞書の含まれる要素数を返します
CFIndex CFDictionaryGetCount ( CFDictionaryRef theDict );
解説
辞書の含まれる要素数を返します。
返り値
引数
( CFDictionaryRef )theDict
クラス
CFDictionary
Function
使用可能
10.0
参照
例文
#include <CoreFoundation/CoreFoundation.h> int main (int argc, const char * argv[]) { //キーの配列 CFStringRef keys[2]; keys[0] = CFSTR("key1"); keys[1] = CFSTR("key2"); //値の配列 CFStringRef values[2]; values[0] = CFSTR("this is the first string"); values[1] = CFSTR("this is the second string"); //辞書の作成 CFDictionaryRef myDictionaryRef = CFDictionaryCreate(kCFAllocatorDefault,(void *)keys,(void *)values,2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); //辞書のdescription CFShow(myDictionaryRef); CFStringRef theString = CFStringCreateWithFormat (kCFAllocatorDefault,NULL,CFSTR("count = %d\n"), CFDictionaryGetCount(myDictionaryRef)); CFShow(theString); return 0; }