2
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
3
<gsdoc base="NSUserDefaults" prev="NSUndoManager" next="NSValue" up="Base">
5
<title>NSUserDefaults</title>
6
<author name="Richard Frith-Macdonald">
7
<email address="rfm@gnu.org"/>
8
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
10
<version>$Revision: 1.11 $</version>
11
<date>$Date: 2001/11/13 07:44:57 $</date>
15
<heading>NSUserDefaults</heading>
16
<class name="NSUserDefaults" super="NSObject">
17
<declared>Foundation/NSUserDefaults.h</declared>
18
<conform>NSObject</conform>
21
NSUserDefaults provides an interface to the defaults system,
22
which allows an application access to global and/or application
23
specific defualts set by the user. A particular instance of
24
NSUserDefaults, standardUserDefaults, is provided as a
25
convenience. Most of the information described below
26
pertains to the standardUserDefaults. It is unlikely
27
that you would want to instantiate your own userDefaults
28
object, since it would not be set up in the same way as the
32
Defaults are managed based on <em>domains</em>. Certain
33
domains, such as <code>NSGlobalDomain</code>, are
34
persistant. These domains have defaults that are stored
35
externally. Other domains are volitale. The defaults in
36
these domains remain in effect only during the existance of
37
the application and may in fact be different for
38
applications running at the same time. When asking for a
39
default value from standardUserDefaults, NSUserDefaults
40
looks through the various domains in a particular order.
43
<term><code>NSArgumentDomain</code></term>
45
Contains defaults read from the arguments provided to
46
the application at startup. Volitile.
48
<term>Application (name of the current process)</term>
50
Application specific defaults, such as window positions. Persistant.
52
<term><code>NSGlobalDomain</code></term>
54
Global defaults. Persistant.
56
<term>Language (name based on users's language)</term>
58
Constants that help with localization to the users's
61
<term><code>NSRegistrationDomain</code></term>
63
Temporary defaults set up by the application. Volitile.
67
The <em>NSLanguages</em> default value is used to set up the
68
constants for localization. GNUstep will also look for the
69
<code>LANGUAGES</code> environment variable if it is not set
70
in the defaults system. If it exists, it consists of an
71
array of languages that the user prefers. At least one of
72
the languages should have a corresponding localization file
73
(typically located in the <file>Languages</file> directory
74
of the GNUstep resources).
77
As a special extension, on systems that support locales
78
(e.g. GNU/Linux and Solaris), GNUstep will use information
79
from the user specified locale, if the <em>NSLanguages</em>
80
default value is not found. Typically the locale is
81
specified in the environment with the <code>LANG</code>
85
<method type="void" factory="yes">
86
<sel>resetStandardUserDefaults</sel>
88
Resets the shared user defaults object to reflect the current
89
user ID. Needed by setuid processes whiich change the user they
93
<method type="NSUserDefaults*" factory="yes">
94
<sel>standardUserDefaults</sel>
96
Returns a shared instance of the class containing the standard
97
defaults for the process.
100
<method type="NSArray*" factory="yes">
101
<sel>userLanguages</sel>
103
Returns the array of user languages preferences. Uses the
104
<em>NSLanguages</em> user default if available, otherwise
105
tries to infer setup from operating system information etc
106
(in particular, uses the <em>LANGUAGES</em> environment variable).
108
<standards><GNUstep/><NotMacOS-X/><NotOpenStep/></standards>
110
<method type="void" factory="yes">
111
<sel>setUserLanguages:</sel>
112
<arg type="NSArray*">languages</arg>
114
Sets the array of user languages preferences. Places the specified
115
array in the <em>NSLanguages</em> user default.
117
<standards><GNUstep/><NotMacOS-X/><NotOpenStep/></standards>
119
<method type="NSArray*">
120
<sel>arrayForKey:</sel>
121
<arg type="NSString*">defaultName</arg>
123
Looks up a value for a specified default, checks that it is
124
an array. Returns nil if it is not.
128
<sel>boolForKey:</sel>
129
<arg type="NSString*">defaultName</arg>
131
Looks up a value for a specified default, checks that it is
132
a boolean. Returns NO if it is not present.
135
<method type="NSData*">
136
<sel>dataForKey:</sel>
137
<arg type="NSString*">defaultName</arg>
139
Looks up a value for a specified default, checks that it is
140
an NSData object. Returns nil if it is not.
143
<method type="NSDictionary*">
144
<sel>dictionaryForKey:</sel>
145
<arg type="NSString*">defaultName</arg>
147
Looks up a value for a specified default, checks that it is
148
an NSDictionary object. Returns nil if it is not.
151
<method type="NSDictionary*">
152
<sel>dictionaryRepresentation</sel>
156
<method type="float">
157
<sel>floatForKey:</sel>
158
<arg type="NSString*">defaultName</arg>
168
<sel>initWithUser:</sel>
169
<arg type="NSString*">username</arg>
174
<sel>integerForKey:</sel>
175
<arg type="NSString*">defaultName</arg>
180
<sel>objectForKey:</sel>
181
<arg type="NSString*">defaultName</arg>
185
<method type="NSDictionary*">
186
<sel>persistentDomainForName:</sel>
187
<arg type="NSString*">domainName</arg>
191
<method type="NSArray*">
192
<sel>persistentDomainNames</sel>
197
<sel>registerDefaults:</sel>
198
<arg type="NSDictionary*">dictionary</arg>
203
<sel>removeObjectForKey:</sel>
204
<arg type="NSString*">defaultName</arg>
209
<sel>removePersistentDomainForName:</sel>
210
<arg type="NSString*">domainName</arg>
215
<sel>removeVolatileDomainForName:</sel>
216
<arg type="NSString*">domainName</arg>
220
<method type="NSArray*">
221
<sel>searchList</sel>
227
<arg type="BOOL">value</arg>
229
<arg type="NSString*">defaultName</arg>
235
<arg type="float">value</arg>
237
<arg type="NSString*">defaultName</arg>
242
<sel>setInteger:</sel>
243
<arg type="int">value</arg>
245
<arg type="NSString*">defaultName</arg>
250
<sel>setObject:</sel>
251
<arg type="id">value</arg>
253
<arg type="NSString*">defaultName</arg>
258
<sel>setPersistentDomain:</sel>
259
<arg type="NSDictionary*">domain</arg>
261
<arg type="NSString*">domainName</arg>
266
<sel>setSearchList:</sel>
267
<arg type="NSArray*">array</arg>
272
<sel>setVolatileDomain:</sel>
273
<arg type="NSDictionary*">domain</arg>
275
<arg type="NSString*">domainName</arg>
279
<method type="NSArray*">
280
<sel>stringArrayForKey:</sel>
281
<arg type="NSString*">defaultName</arg>
285
<method type="NSString*">
286
<sel>stringForKey:</sel>
287
<arg type="NSString*">defaultName</arg>
292
<sel>synchronize</sel>
296
<method type="NSDictionary*">
297
<sel>volatileDomainForName:</sel>
298
<arg type="NSString*">domainName</arg>
302
<method type="NSArray*">
303
<sel>volatileDomainNames</sel>