「NSDictionary Class Reference」の編集履歴(バックアップ)一覧はこちら
「NSDictionary Class Reference」(2010/02/24 (水) 22:01:41) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
//0.下はいじらない
Tags:&tags()
//1.以下に続けてADCでの分類を書き込みリンクする。「NSHogeのクラスリファレンス」、まで書く
&link_toppage(トップ) > [[リファレンス]] > データ管理:データ型とコレクション > NSDictionary クラスリファレンス
//2.リファレンス日本語名を見出し1で書く。wiki内のリンクで用いられるタイトルになる。翻訳元にもリンクする。
*NSDictionary クラスリファレンス [[翻訳元>http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html]]
//3.翻訳元の最終更新日を書く
このページの最終更新:&date()
ADCの最終更新:2009-08-28
//4.以下、用語は頻繁に出てくる単語の翻訳ガイドラインを参照しながら翻訳する。
//5.ある程度書き終わったらタグ(未完または完成、カテゴリ名×3)をつけて下線を引く(広告との境)。これで終了。それではGood Luck!
//本文開始↓
|BGCOLOR(#eef):継承するクラス|BGCOLOR(#eef):[[NSObject>NSObject Class Reference]]|
|TOP:準拠しているプロトコル|[[NSCoding>NSCoding Protocol Reference]]&br()[[NSCopying>NSCopying Protocol Reference]]&br()[[NSMutableCopying>NSMutableCopying Protocol Reference]]&br()[[NSFastEnumeration>NSFastEnumeration Protocol Refernece]]&br()[[NSObject (NSObject)>NSObject Protocol Reference]]|
|BGCOLOR(#eef):フレームワーク|BGCOLOR(#eef):/System/Library/Frameworks/[[Foundation.framework>Foundation Franework]]|
|使用可能な環境|Mac OS X v10.0以降|
|TOP:BGCOLOR(#eef):宣言ファイル|BGCOLOR(#eef):NSDictionary.h&br()NSFileManager.h&br()NSKeyValueCoding.h|
|TOP:コンパニオンガイド|[[Collections Programming Topics for Cocoa]]&br()[[Property List Programming Guide]]|
|TOP:BGCOLOR(#eef):サンプルコード|BGCOLOR(#eef):[[From A View to A Movie]]&br()[[From A View to A Picture]]&br()[[People]]&br()[[QTCoreVideo301]]&br()[[Quartz Composer WWDC 2005 TextEdit]]|
**概観(Overview)
----
NSDictionaryクラスはオブジェクトをキーと値の対で管理する変更不能なプログラマティックインターフェースを宣言しています。このクラス、また必要によりサブクラスのNSMutableDictionaruクラスを使うことによって、任意のキーに関連づけられたデータを効率的に取得することができます。(ここでは便宜的に、&bold(){辞書}という単語を実際のクラスに関係なくこれらのサブクラスのうちの一つのクラスのインスタンスをさす言葉として使います。)
辞書中のキーと値のペアはエントリと呼ばれます。それぞれのエントリはキーを表す一つ目のオブジェクトと、そのキーに対応する値である二つ目のオブジェクトから成り立ちます。辞書では、キーは一意的なものです。つまり、一つの辞書中に、等しい(&link_anchor(){isEqual:}メソッドによって決定される)二つのキーは存在しません。通常、どんな(NSCopyingプロトコルに準拠している——以下を参照)オブジェクトでもキーになり得ます。しかし、キー値コーディングを使用する時はキーは文字列でなければならない([[Key-Value Coding Fundaentals]]を参照してください)ことに注意してください。nilはキーや値になりえません。辞書中で空の値を表現したい時は、[[NSNull>NSNull Class Reference]]オブジェクトを使用してください。
NSDictionaryのインスタンスは変更不能な辞書です。そのインスタンスのエントリは生成時に決定し、それ以後は変更できません。[[NSMutableDictionary]]のインスタンスは変更可能な辞書です。このインスタンスではいつでもエントリを追加したり削除したりでき、メモリも必要に応じて自動的に確保されます。辞書クラスはNSCopyingとNSMutableCopyingプロトコルに準拠し、辞書間での型変換を容易にしています。
NSDictionaryとNSMutableDictionaryはクラスクラスタの一部です。つまり、このインターフェースから生成したオブジェクトは正確にはこれら二つのクラスのインスタンスではありません。もっと適切に言えば、これらのインスタンスはこれらの非公開なサブクラスのインスタンスです。辞書のクラスは非公開ですが、そのインターフェースは公開されています。なぜなら、インターフェースは抽象スーパークラスであるNSDictionaryとNSMutableDictionaryで宣言されているからです。
内部的には、辞書はストレージの構成と与えられたキーに対応する値に素早くアクセスする為にハッシュテーブルを使っています。しかし、このクラス群で定義されているメソッドはハッシュテーブルやハッシュ関数、ハッシュされたキーの複雑な働きを隠蔽しています。以下で定義されているメソッドではキーを直接用い、ハッシュされた形では用いません。
辞書にエントリを追加するメソッドは、(全ての辞書の)初期化の過程や(変更可能な辞書の)変更の過程であるかにかかわらず引数のキーをコピーし(キーはNSCopyingプロトコルに準拠しなければなりません)、その複製を辞書に加えます。それぞれに対応する値には辞書の使用中に解放されないことを保証する為に&link_anchor(){retain}メッセージが送られます。
***列挙(Enumeration)
辞書のコンテンツは&link_anchor(){keyEnumerator}や&link_anchor(){objectEnumerator}によって返されるNSEnumeratorを使ってそれぞれキー、値を列挙することができます。Mac OS X v10.5以降上では、NSDictionaryは[[NSFastEnumeration]]プロトコルをサポートしていますので、for...in構文を使って辞書中のキーを列挙することができます。以下の例で説明します。
|BGCOLOR(#eef):NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];&br()NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil];&br()NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];&br() &br()for (id key in dictionary) {&br() NSLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]);&br()}|
Mac OS X v10.6以降では、NSDictionaryはブロックオブジェクトを使用した列挙をサポートしています。
***プリミィティブメソッド(Primitive Methods)
NSDictionaryの3つのプリミィティブメソッドである、&link_anchor(){count}、&link_anchor(){objectForKey:}、&link_anchor(){keyEnumerator}はこのインターフェース中の他のメソッドの基礎を提供しています。&link_anchor(){count}メソッドは辞書中のエントリの数を返します。&link_anchor(){objectForKey:}は与えられたキーに関連づけられた値を返します。&link_anchor(){keyEnumerator}は辞書中のキーを順番に参照する為のオブジェクトを返します。ここで宣言されているその他のメソッドはこれらのメソッドを一回、またはそれ以上呼び出して動作しています。プリミティブメソッド以外のメソッドは、一度に複数のエントリにアクセスする便利な手段を提供します。
***記述と永続性(Desctiptions and Persistance)
プロパティリスト形式で文字列やファイルに書き出すには、それぞれdescription...や&link_anchor(){writeToFile:atomically:}メソッドが使用できます。これらをカスタムデータオブジェクトのストレージの永続化に使用するのは一般的には推奨されません。代替手段としては[[Archives and Serializations Programming Guide for Cocoa]]を参照してください。
***Toll-Freeブリッジ(Toll-Free Bridging)
NSDictionaryは対応するCore Foundationの[[CFDictionary Reference]]と「toll-freeブリッジ」です。つまり、関数やメソッド中のCore Foundation型はブリッジしているFoundationオブジェクトと相互に交換可能だということです。したがって、メソッド中のNSDictionary *パラメータにCFDictionaryRefを渡すことも、CFDictionaryRefパラメータにNSDicationaryインスタンスを渡すこともできます(コンパイル時の警告を押さえるにはその型にキャストします)。このブリッジはNSDictionaryの具体サブクラスにも適用されます。toll-freeブリッジについての詳細はInterchangeable Data Typesを参照してください。
**採用しているプロトコル(Adopted Protocols)
----
[[NSCoding>NSCoding Protocol Reference]]
&space(8)&link_anchor(page=NSCoding Protocol Reference,encodeWithCoder:){– encodeWithCoder:
&space(8)&link_anchor(page=NSCoding Protocol Reference,initWithCoder:){– initWithCoder:
[[NSCopying>NSCopying Protocol Reference]]
&space(8)&link_anchor(page=NSCopying Protocol Reference,copyWithZone:){– copyWithZone:
[[NSMutableCopying>NSMutableCopying Protocol Reference]]
&space(8)&link_anchor(page=NSMutableCopying Protocol Reference,mutableCopyWithZone:){– mutableCopyWithZone:
[[NSFastEnumeration>NSFastEnumeration Protocol Reference]]
&space(8)&link_anchor(page=NSFastEnumeration Protocol Reference,countByEnumeratingWithState:objects:count:){– countByEnumeratingWithState:objects:count:
**このクラスでできること(Tasks)
----
***辞書の生成(Creating a Dictionary)
&space(8)&link_anchor(){+ dictionary}
&space(8)&link_anchor(){+ dictionaryWithContentsOfFile:}
&space(8)&link_anchor(){+ dictionaryWithContentsOfURL:}
&space(8)&link_anchor(){+ dictionaryWithDictionary:}
&space(8)&link_anchor(){+ dictionaryWithObject:forKey:}
&space(8)&link_anchor(){+ dictionaryWithObjects:forKeys:}
&space(8)&link_anchor(){+ dictionaryWithObjects:forKeys:count:}
&space(8)&link_anchor(){+ dictionaryWithObjectsAndKeys:}
***NSDictionaryインスタンスの初期化(Initializing an NSDictionary Instance)
&space(8)&link_anchor(){– initWithContentsOfFile:}
&space(8)&link_anchor(){– initWithContentsOfURL:}
&space(8)&link_anchor(){– initWithDictionary:}
&space(8)&link_anchor(){– initWithDictionary:copyItems:}
&space(8)&link_anchor(){– initWithObjects:forKeys:}
&space(8)&link_anchor(){– initWithObjects:forKeys:count:}
&space(8)&link_anchor(){– initWithObjectsAndKeys:}
***エントリの数え上げ(Counting Entries)
&space(8)&link_anchor(){– count}
***辞書の比較(Comparing Dictionaries)
&space(8)&link_anchor(){– isEqualToDictionary:}
***キーや値へのアクセス(Accessing Keys and Values)
&space(8)&link_anchor(){– allKeys}
&space(8)&link_anchor(){– allKeysForObject:}
&space(8)&link_anchor(){– allValues}
&space(8)&link_anchor(){– getObjects:andKeys:}
&space(8)&link_anchor(){– objectForKey:}
&space(8)&link_anchor(){– objectsForKeys:notFoundMarker:}
&space(8)&link_anchor(){– valueForKey:}
***辞書の列挙(Enumerating Dictionaries)
&space(8)&link_anchor(){– keyEnumerator}
&space(8)&link_anchor(){– objectEnumerator}
&space(8)&link_anchor(){– enumerateKeysAndObjectsUsingBlock:}
&space(8)&link_anchor(){– enumerateKeysAndObjectsWithOptions:usingBlock:}
***辞書の整理(Sorting Dictionaries)
&space(8)&link_anchor(){– keysSortedByValueUsingSelector:}
&space(8)&link_anchor(){– keysSortedByValueUsingComparator:}
&space(8)&link_anchor(){– keysSortedByValueWithOptions:usingComparator:}
***辞書の濾過(Filtering Dictionaries)
&space(8)&link_anchor(){– keysOfEntriesPassingTest:}
&space(8)&link_anchor(){– keysOfEntriesWithOptions:passingTest:}
***辞書のストア(Storing Dictionaries)
&space(8)&link_anchor(){– writeToFile:atomically:}
&space(8)&link_anchor(){– writeToURL:atomically:}
***ファイル属性へのアクセス(Accessing File Attributes)
&space(8)&link_anchor(){– fileCreationDate}
&space(8)&link_anchor(){– fileExtensionHidden}
&space(8)&link_anchor(){– fileGroupOwnerAccountID}
&space(8)&link_anchor(){– fileGroupOwnerAccountName}
&space(8)&link_anchor(){– fileHFSCreatorCode}
&space(8)&link_anchor(){– fileHFSTypeCode}
&space(8)&link_anchor(){– fileIsAppendOnly}
&space(8)&link_anchor(){– fileIsImmutable}
&space(8)&link_anchor(){– fileModificationDate}
&space(8)&link_anchor(){– fileOwnerAccountID}
&space(8)&link_anchor(){– fileOwnerAccountName}
&space(8)&link_anchor(){– filePosixPermissions}
&space(8)&link_anchor(){– fileSize}
&space(8)&link_anchor(){– fileSystemFileNumber}
&space(8)&link_anchor(){– fileSystemNumber}
&space(8)&link_anchor(){– fileType}
***記述の生成(Creating a Description)
&space(8)&link_anchor(){– description}
&space(8)&link_anchor(){– descriptionInStringsFileFormat}
&space(8)&link_anchor(){– descriptionWithLocale:}
&space(8)&link_anchor(){– descriptionWithLocale:indent:}
**クラスメソッド
----
***&anchor(option=nolink,dictionary){dictionary}
***&anchor(option=nolink,dictionaryWithContentsOfFile:){dictionaryWithContentsOfFile:}
***&anchor(option=nolink,dictionaryWithContentsOfURL:){dictionaryWithContentsOfURL:}
***&anchor(option=nolink,dictionaryWithDictionary:){dictionaryWithDictionary:}
***&anchor(option=nolink,dictionaryWithObject:forKey:){dictionaryWithObject:forKey:}
***&anchor(option=nolink,dictionaryWithObjects:forKeys:){dictionaryWithObjects:forKeys:}
***&anchor(option=nolink,dictionaryWithObjects:forKeys:count:){dictionaryWithObjects:forKeys:count:}
***&anchor(option=nolink,dictionaryWithObjectsAndKeys:){dictionaryWithObjectsAndKeys:}
**インスタンスメソッド
----
***&anchor(option=nolink,allKeys){allKeys}
***&anchor(option=nolink,allKeysForObject:){allKeysForObject:}
***&anchor(option=nolink,allValues){allValues}
***&anchor(option=nolink,count){count}
***&anchor(option=nolink,description){description}
***&anchor(option=nolink,descriptionInStringsFileFormat){descriptionInStringsFileFormat}
***&anchor(option=nolink,descriptionWithLocale:){descriptionWithLocale:}
***&anchor(option=nolink,descriptionWithLocale:indent:){descriptionWithLocale:indent:}
***&anchor(option=nolink,enumerateKeysAndObjectsUsingBlock:){enumerateKeysAndObjectsUsingBlock:}
***&anchor(option=nolink,enumerateKeysAndObjectsWithOptions:usingBlock:){enumerateKeysAndObjectsWithOptions:usingBlock:}
***&anchor(option=nolink,fileCreationDate){fileCreationDate}
***&anchor(option=nolink,fileExtensionHidden){fileExtensionHidden}
***&anchor(option=nolink,fileGroupOwnerAccountID){fileGroupOwnerAccountID}
***&anchor(option=nolink,fileGroupOwnerAccountName){fileGroupOwnerAccountName}
***&anchor(option=nolink,fileHFSCreatorCode){fileHFSCreatorCode}
***&anchor(option=nolink,fileHFSTypeCode){fileHFSTypeCode}
***&anchor(option=nolink,fileIsAppendOnly){fileIsAppendOnly}
***&anchor(option=nolink,fileIsImmutable){fileIsImmutable}
***&anchor(option=nolink,fileModificationDate){fileModificationDate}
***&anchor(option=nolink,fileOwnerAccountID){fileOwnerAccountID}
***&anchor(option=nolink,fileOwnerAccountName){fileOwnerAccountName}
***&anchor(option=nolink,filePosixPermissions){filePosixPermissions}
***&anchor(option=nolink,fileSize){fileSize}
***&anchor(option=nolink,fileSystemFileNumber){fileSystemFileNumber}
***&anchor(option=nolink,fileSystemNumber){fileSystemNumber}
***&anchor(option=nolink,fileType){fileType}
***&anchor(option=nolink,getObjects:andKeys:){getObjects:andKeys:}
***&anchor(option=nolink,initWithContentsOfFile:){initWithContentsOfFile:}
***&anchor(option=nolink,initWithContentsOfURL:){initWithContentsOfURL:}
***&anchor(option=nolink,initWithDictionary:){initWithDictionary:}
***&anchor(option=nolink,initWithDictionary:copyItems:){initWithDictionary:copyItems:}
***&anchor(option=nolink,initWithObjects:forKeys:){initWithObjects:forKeys:}
***&anchor(option=nolink,initWithObjects:forKeys:count:){initWithObjects:forKeys:count:}
***&anchor(option=nolink,initWithObjectsAndKeys:){initWithObjectsAndKeys:}
***&anchor(option=nolink,isEqualToDictionary:){isEqualToDictionary:}
***&anchor(option=nolink,keyEnumerator){keyEnumerator}
***&anchor(option=nolink,keysOfEntriesPassingTest:)keysOfEntriesPassingTest:}
***&anchor(option=nolink,keysOfEntriesWithOptions:passingTest:){keysOfEntriesWithOptions:passingTest:}
***&anchor(option=nolink,keysSortedByValueUsingComparator:){keysSortedByValueUsingComparator:}
***&anchor(option=nolink,keysSortedByValueUsingSelector:){keysSortedByValueUsingSelector:}
***&anchor(option=nolink,keysSortedByValueWithOptions:usingComparator:){keysSortedByValueWithOptions:usingComparator:}
***&anchor(option=nolink,objectEnumerator){objectEnumerator}
***&anchor(option=nolink,objectForKey:){objectForKey:}
***&anchor(option=nolink,objectsForKeys:notFoundMarker:){objectsForKeys:notFoundMarker:}
***&anchor(option=nolink,valueForKey:){valueForKey:}
***&anchor(option=nolink,writeToFile:atomically:){writeToFile:atomically:}
***&anchor(option=nolink,writeToURL:atomically:){writeToURL:atomically:}
----
//0.下はいじらない
Tags:&tags()
//1.以下に続けてADCでの分類を書き込みリンクする。「NSHogeのクラスリファレンス」、まで書く
&link_toppage(トップ) > [[リファレンス]] > データ管理:データ型とコレクション > NSDictionary クラスリファレンス
//2.リファレンス日本語名を見出し1で書く。wiki内のリンクで用いられるタイトルになる。翻訳元にもリンクする。
*NSDictionary クラスリファレンス [[翻訳元>http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html]]
//3.翻訳元の最終更新日を書く
このページの最終更新:&date()
ADCの最終更新:2009-08-28
//4.以下、用語は頻繁に出てくる単語の翻訳ガイドラインを参照しながら翻訳する。
//5.ある程度書き終わったらタグ(未完または完成、カテゴリ名×3)をつけて下線を引く(広告との境)。これで終了。それではGood Luck!
//本文開始↓
|BGCOLOR(#eef):継承するクラス|BGCOLOR(#eef):[[NSObject>NSObject Class Reference]]|
|TOP:準拠しているプロトコル|[[NSCoding>NSCoding Protocol Reference]]&br()[[NSCopying>NSCopying Protocol Reference]]&br()[[NSMutableCopying>NSMutableCopying Protocol Reference]]&br()[[NSFastEnumeration>NSFastEnumeration Protocol Refernece]]&br()[[NSObject (NSObject)>NSObject Protocol Reference]]|
|BGCOLOR(#eef):フレームワーク|BGCOLOR(#eef):/System/Library/Frameworks/[[Foundation.framework>Foundation Franework]]|
|使用可能な環境|Mac OS X v10.0以降|
|TOP:BGCOLOR(#eef):宣言ファイル|BGCOLOR(#eef):NSDictionary.h&br()NSFileManager.h&br()NSKeyValueCoding.h|
|TOP:コンパニオンガイド|[[Collections Programming Topics for Cocoa]]&br()[[Property List Programming Guide]]|
|TOP:BGCOLOR(#eef):サンプルコード|BGCOLOR(#eef):[[From A View to A Movie]]&br()[[From A View to A Picture]]&br()[[People]]&br()[[QTCoreVideo301]]&br()[[Quartz Composer WWDC 2005 TextEdit]]|
**概観(Overview)
----
NSDictionaryクラスはオブジェクトをキーと値の対で管理する変更不能なプログラマティックインターフェースを宣言しています。このクラス、また必要によりサブクラスのNSMutableDictionaruクラスを使うことによって、任意のキーに関連づけられたデータを効率的に取得することができます。(ここでは便宜的に、&bold(){辞書}という単語を実際のクラスに関係なくこれらのサブクラスのうちの一つのクラスのインスタンスをさす言葉として使います。)
辞書中のキーと値のペアはエントリと呼ばれます。それぞれのエントリはキーを表す一つ目のオブジェクトと、そのキーに対応する値である二つ目のオブジェクトから成り立ちます。辞書では、キーは一意的なものです。つまり、一つの辞書中に、等しい(&link_anchor(){isEqual:}メソッドによって決定される)二つのキーは存在しません。通常、どんな(NSCopyingプロトコルに準拠している——以下を参照)オブジェクトでもキーになり得ます。しかし、キー値コーディングを使用する時はキーは文字列でなければならない([[Key-Value Coding Fundaentals]]を参照してください)ことに注意してください。nilはキーや値になりえません。辞書中で空の値を表現したい時は、[[NSNull>NSNull Class Reference]]オブジェクトを使用してください。
NSDictionaryのインスタンスは変更不能な辞書です。そのインスタンスのエントリは生成時に決定し、それ以後は変更できません。[[NSMutableDictionary]]のインスタンスは変更可能な辞書です。このインスタンスではいつでもエントリを追加したり削除したりでき、メモリも必要に応じて自動的に確保されます。辞書クラスはNSCopyingとNSMutableCopyingプロトコルに準拠し、辞書間での型変換を容易にしています。
NSDictionaryとNSMutableDictionaryはクラスクラスタの一部です。つまり、このインターフェースから生成したオブジェクトは正確にはこれら二つのクラスのインスタンスではありません。もっと適切に言えば、これらのインスタンスはこれらの非公開なサブクラスのインスタンスです。辞書のクラスは非公開ですが、そのインターフェースは公開されています。なぜなら、インターフェースは抽象スーパークラスであるNSDictionaryとNSMutableDictionaryで宣言されているからです。
内部的には、辞書はストレージの構成と与えられたキーに対応する値に素早くアクセスする為にハッシュテーブルを使っています。しかし、このクラス群で定義されているメソッドはハッシュテーブルやハッシュ関数、ハッシュされたキーの複雑な働きを隠蔽しています。以下で定義されているメソッドではキーを直接用い、ハッシュされた形では用いません。
辞書にエントリを追加するメソッドは、(全ての辞書の)初期化の過程や(変更可能な辞書の)変更の過程であるかにかかわらず引数のキーをコピーし(キーはNSCopyingプロトコルに準拠しなければなりません)、その複製を辞書に加えます。それぞれに対応する値には辞書の使用中に解放されないことを保証する為に&link_anchor(){retain}メッセージが送られます。
***列挙(Enumeration)
辞書のコンテンツは&link_anchor(){keyEnumerator}や&link_anchor(){objectEnumerator}によって返されるNSEnumeratorを使ってそれぞれキー、値を列挙することができます。Mac OS X v10.5以降上では、NSDictionaryは[[NSFastEnumeration]]プロトコルをサポートしていますので、for...in構文を使って辞書中のキーを列挙することができます。以下の例で説明します。
|BGCOLOR(#eef):NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];&br()NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil];&br()NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];&br() &br()for (id key in dictionary) {&br() NSLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]);&br()}|
Mac OS X v10.6以降では、NSDictionaryはブロックオブジェクトを使用した列挙をサポートしています。
***プリミィティブメソッド(Primitive Methods)
NSDictionaryの3つのプリミィティブメソッドである、&link_anchor(){count}、&link_anchor(){objectForKey:}、&link_anchor(){keyEnumerator}はこのインターフェース中の他のメソッドの基礎を提供しています。&link_anchor(){count}メソッドは辞書中のエントリの数を返します。&link_anchor(){objectForKey:}は与えられたキーに関連づけられた値を返します。&link_anchor(){keyEnumerator}は辞書中のキーを順番に参照する為のオブジェクトを返します。ここで宣言されているその他のメソッドはこれらのメソッドを一回、またはそれ以上呼び出して動作しています。プリミティブメソッド以外のメソッドは、一度に複数のエントリにアクセスする便利な手段を提供します。
***記述と永続性(Desctiptions and Persistance)
プロパティリスト形式で文字列やファイルに書き出すには、それぞれdescription...や&link_anchor(){writeToFile:atomically:}メソッドが使用できます。これらをカスタムデータオブジェクトのストレージの永続化に使用するのは一般的には推奨されません。代替手段としては[[Archives and Serializations Programming Guide for Cocoa]]を参照してください。
***Toll-Freeブリッジ(Toll-Free Bridging)
NSDictionaryは対応するCore Foundationの[[CFDictionary Reference]]と「toll-freeブリッジ」です。つまり、関数やメソッド中のCore Foundation型はブリッジしているFoundationオブジェクトと相互に交換可能だということです。したがって、メソッド中のNSDictionary *パラメータにCFDictionaryRefを渡すことも、CFDictionaryRefパラメータにNSDicationaryインスタンスを渡すこともできます(コンパイル時の警告を押さえるにはその型にキャストします)。このブリッジはNSDictionaryの具体サブクラスにも適用されます。toll-freeブリッジについての詳細はInterchangeable Data Typesを参照してください。
**採用しているプロトコル(Adopted Protocols)
----
[[NSCoding>NSCoding Protocol Reference]]
&space(8)&link_anchor(page=NSCoding Protocol Reference,encodeWithCoder:){– encodeWithCoder:}
&space(8)&link_anchor(page=NSCoding Protocol Reference,initWithCoder:){– initWithCoder:}
[[NSCopying>NSCopying Protocol Reference]]
&space(8)&link_anchor(page=NSCopying Protocol Reference,copyWithZone:){– copyWithZone:}
[[NSMutableCopying>NSMutableCopying Protocol Reference]]
&space(8)&link_anchor(page=NSMutableCopying Protocol Reference,mutableCopyWithZone:){– mutableCopyWithZone:}
[[NSFastEnumeration>NSFastEnumeration Protocol Reference]]
&space(8)&link_anchor(page=NSFastEnumeration Protocol Reference,countByEnumeratingWithState:objects:count:){– countByEnumeratingWithState:objects:count:}
**このクラスでできること(Tasks)
----
***辞書の生成(Creating a Dictionary)
&space(8)&link_anchor(dictionary){+ dictionary}
&space(8)&link_anchor(dictionaryWithContentsOfFile:){+ dictionaryWithContentsOfFile:}
&space(8)&link_anchor(dictionaryWithContentsOfURL:){+ dictionaryWithContentsOfURL:}
&space(8)&link_anchor(dictionaryWithDictionary:){+ dictionaryWithDictionary:}
&space(8)&link_anchor(dictionaryWithObject:forKey:){+ dictionaryWithObject:forKey:}
&space(8)&link_anchor(dictionaryWithObjects:forKeys:){+ dictionaryWithObjects:forKeys:}
&space(8)&link_anchor(dictionaryWithObjects:forKeys:count:){+ dictionaryWithObjects:forKeys:count:}
&space(8)&link_anchor(dictionaryWithObjectsAndKeys:){+ dictionaryWithObjectsAndKeys:}
***NSDictionaryインスタンスの初期化(Initializing an NSDictionary Instance)
&space(8)&link_anchor(initWithContentsOfFile:){– initWithContentsOfFile:}
&space(8)&link_anchor(initWithContentsOfURL:){– initWithContentsOfURL:}
&space(8)&link_anchor(initWithDictionary:){– initWithDictionary:}
&space(8)&link_anchor(initWithDictionary:copyItems:){– initWithDictionary:copyItems:}
&space(8)&link_anchor(initWithObjects:forKeys:){– initWithObjects:forKeys:}
&space(8)&link_anchor(initWithObjects:forKeys:count:){– initWithObjects:forKeys:count:}
&space(8)&link_anchor(initWithObjectsAndKeys:){– initWithObjectsAndKeys:}
***エントリの数え上げ(Counting Entries)
&space(8)&link_anchor(count){– count}
***辞書の比較(Comparing Dictionaries)
&space(8)&link_anchor(isEqualToDictionary:){– isEqualToDictionary:}
***キーや値へのアクセス(Accessing Keys and Values)
&space(8)&link_anchor(allKeys){– allKeys}
&space(8)&link_anchor(allKeysForObject:){– allKeysForObject:}
&space(8)&link_anchor(allValues){– allValues}
&space(8)&link_anchor(getObjects:andKeys:){– getObjects:andKeys:}
&space(8)&link_anchor(objectForKey:){– objectForKey:}
&space(8)&link_anchor(objectsForKeys:notFoundMarker:){– objectsForKeys:notFoundMarker:}
&space(8)&link_anchor(valueForKey:){– valueForKey:}
***辞書の列挙(Enumerating Dictionaries)
&space(8)&link_anchor(keyEnumerator){– keyEnumerator}
&space(8)&link_anchor(objectEnumerator){– objectEnumerator}
&space(8)&link_anchor(enumerateKeysAndObjectsUsingBlock:){– enumerateKeysAndObjectsUsingBlock:}
&space(8)&link_anchor(enumerateKeysAndObjectsWithOptions:usingBlock:){– enumerateKeysAndObjectsWithOptions:usingBlock:}
***辞書の整理(Sorting Dictionaries)
&space(8)&link_anchor(keysSortedByValueUsingSelector:){– keysSortedByValueUsingSelector:}
&space(8)&link_anchor(keysSortedByValueUsingComparator:){– keysSortedByValueUsingComparator:}
&space(8)&link_anchor(keysSortedByValueWithOptions:usingComparator:){– keysSortedByValueWithOptions:usingComparator:}
***辞書の濾過(Filtering Dictionaries)
&space(8)&link_anchor(keysOfEntriesPassingTest:){– keysOfEntriesPassingTest:}
&space(8)&link_anchor(keysOfEntriesWithOptions:passingTest:){– keysOfEntriesWithOptions:passingTest:}
***辞書のストア(Storing Dictionaries)
&space(8)&link_anchor(writeToFile:atomically:){– writeToFile:atomically:}
&space(8)&link_anchor(writeToURL:atomically:){– writeToURL:atomically:}
***ファイル属性へのアクセス(Accessing File Attributes)
&space(8)&link_anchor(fileCreationDate){– fileCreationDate}
&space(8)&link_anchor(fileExtensionHidden){– fileExtensionHidden}
&space(8)&link_anchor(fileGroupOwnerAccountID){– fileGroupOwnerAccountID}
&space(8)&link_anchor(fileGroupOwnerAccountName){– fileGroupOwnerAccountName}
&space(8)&link_anchor(fileHFSCreatorCode){– fileHFSCreatorCode}
&space(8)&link_anchor(fileHFSTypeCode){– fileHFSTypeCode}
&space(8)&link_anchor(fileIsAppendOnly){– fileIsAppendOnly}
&space(8)&link_anchor(fileIsImmutable){– fileIsImmutable}
&space(8)&link_anchor(fileModificationDate){– fileModificationDate}
&space(8)&link_anchor(fileOwnerAccountID){– fileOwnerAccountID}
&space(8)&link_anchor(fileOwnerAccountName){– fileOwnerAccountName}
&space(8)&link_anchor(filePosixPermissions){– filePosixPermissions}
&space(8)&link_anchor(fileSize){– fileSize}
&space(8)&link_anchor(fileSystemFileNumber){– fileSystemFileNumber}
&space(8)&link_anchor(fileSystemNumber){– fileSystemNumber}
&space(8)&link_anchor(fileType){– fileType}
***記述の生成(Creating a Description)
&space(8)&link_anchor(description){– description}
&space(8)&link_anchor(descriptionInStringsFileFormat){– descriptionInStringsFileFormat}
&space(8)&link_anchor(descriptionWithLocale:){– descriptionWithLocale:}
&space(8)&link_anchor(descriptionWithLocale:indent:){– descriptionWithLocale:indent:}
**クラスメソッド
----
***&anchor(option=nolink,dictionary){dictionary}
***&anchor(option=nolink,dictionaryWithContentsOfFile:){dictionaryWithContentsOfFile:}
***&anchor(option=nolink,dictionaryWithContentsOfURL:){dictionaryWithContentsOfURL:}
***&anchor(option=nolink,dictionaryWithDictionary:){dictionaryWithDictionary:}
***&anchor(option=nolink,dictionaryWithObject:forKey:){dictionaryWithObject:forKey:}
***&anchor(option=nolink,dictionaryWithObjects:forKeys:){dictionaryWithObjects:forKeys:}
***&anchor(option=nolink,dictionaryWithObjects:forKeys:count:){dictionaryWithObjects:forKeys:count:}
***&anchor(option=nolink,dictionaryWithObjectsAndKeys:){dictionaryWithObjectsAndKeys:}
**インスタンスメソッド
----
***&anchor(option=nolink,allKeys){allKeys}
***&anchor(option=nolink,allKeysForObject:){allKeysForObject:}
***&anchor(option=nolink,allValues){allValues}
***&anchor(option=nolink,count){count}
***&anchor(option=nolink,description){description}
***&anchor(option=nolink,descriptionInStringsFileFormat){descriptionInStringsFileFormat}
***&anchor(option=nolink,descriptionWithLocale:){descriptionWithLocale:}
***&anchor(option=nolink,descriptionWithLocale:indent:){descriptionWithLocale:indent:}
***&anchor(option=nolink,enumerateKeysAndObjectsUsingBlock:){enumerateKeysAndObjectsUsingBlock:}
***&anchor(option=nolink,enumerateKeysAndObjectsWithOptions:usingBlock:){enumerateKeysAndObjectsWithOptions:usingBlock:}
***&anchor(option=nolink,fileCreationDate){fileCreationDate}
***&anchor(option=nolink,fileExtensionHidden){fileExtensionHidden}
***&anchor(option=nolink,fileGroupOwnerAccountID){fileGroupOwnerAccountID}
***&anchor(option=nolink,fileGroupOwnerAccountName){fileGroupOwnerAccountName}
***&anchor(option=nolink,fileHFSCreatorCode){fileHFSCreatorCode}
***&anchor(option=nolink,fileHFSTypeCode){fileHFSTypeCode}
***&anchor(option=nolink,fileIsAppendOnly){fileIsAppendOnly}
***&anchor(option=nolink,fileIsImmutable){fileIsImmutable}
***&anchor(option=nolink,fileModificationDate){fileModificationDate}
***&anchor(option=nolink,fileOwnerAccountID){fileOwnerAccountID}
***&anchor(option=nolink,fileOwnerAccountName){fileOwnerAccountName}
***&anchor(option=nolink,filePosixPermissions){filePosixPermissions}
***&anchor(option=nolink,fileSize){fileSize}
***&anchor(option=nolink,fileSystemFileNumber){fileSystemFileNumber}
***&anchor(option=nolink,fileSystemNumber){fileSystemNumber}
***&anchor(option=nolink,fileType){fileType}
***&anchor(option=nolink,getObjects:andKeys:){getObjects:andKeys:}
***&anchor(option=nolink,initWithContentsOfFile:){initWithContentsOfFile:}
***&anchor(option=nolink,initWithContentsOfURL:){initWithContentsOfURL:}
***&anchor(option=nolink,initWithDictionary:){initWithDictionary:}
***&anchor(option=nolink,initWithDictionary:copyItems:){initWithDictionary:copyItems:}
***&anchor(option=nolink,initWithObjects:forKeys:){initWithObjects:forKeys:}
***&anchor(option=nolink,initWithObjects:forKeys:count:){initWithObjects:forKeys:count:}
***&anchor(option=nolink,initWithObjectsAndKeys:){initWithObjectsAndKeys:}
***&anchor(option=nolink,isEqualToDictionary:){isEqualToDictionary:}
***&anchor(option=nolink,keyEnumerator){keyEnumerator}
***&anchor(option=nolink,keysOfEntriesPassingTest:)keysOfEntriesPassingTest:}
***&anchor(option=nolink,keysOfEntriesWithOptions:passingTest:){keysOfEntriesWithOptions:passingTest:}
***&anchor(option=nolink,keysSortedByValueUsingComparator:){keysSortedByValueUsingComparator:}
***&anchor(option=nolink,keysSortedByValueUsingSelector:){keysSortedByValueUsingSelector:}
***&anchor(option=nolink,keysSortedByValueWithOptions:usingComparator:){keysSortedByValueWithOptions:usingComparator:}
***&anchor(option=nolink,objectEnumerator){objectEnumerator}
***&anchor(option=nolink,objectForKey:){objectForKey:}
***&anchor(option=nolink,objectsForKeys:notFoundMarker:){objectsForKeys:notFoundMarker:}
***&anchor(option=nolink,valueForKey:){valueForKey:}
***&anchor(option=nolink,writeToFile:atomically:){writeToFile:atomically:}
***&anchor(option=nolink,writeToURL:atomically:){writeToURL:atomically:}
----
表示オプション
横に並べて表示:
変化行の前後のみ表示: