![]() |
API
0.9.6
|
#import <CPUserDefaults.h>
Class Methods | |
(void) | + resetStandardUserDefaults |
(id) | + standardUserDefaults |
![]() | |
(BOOL) | + accessInstanceVariablesDirectly |
(id) | + alloc |
(id) | + allocWithCoder: |
(BOOL) | + automaticallyNotifiesObserversForKey: |
(Class) | + class |
(void) | + exposeBinding: |
(void) | + initialize |
(IMP) | + instanceMethodForSelector: |
(BOOL) | + instancesRespondToSelector: |
(BOOL) | + isSubclassOfClass: |
(CPSet) | + keyPathsForValuesAffectingValueForKey: |
(void) | + load |
(id) | + new |
(void) | + setVersion: |
(Class) | + superclass |
(int) | + version |
Additional Inherited Members | |
![]() | |
Class | isa |
CPUserDefaults provides a way of storing a list of user preferences. Everything you store must be CPCoding compliant because it is stored as CPData.
Unlike in Cocoa, CPUserDefaults is per-host by default because of the method of storage. By default, the localStorage API will be used if the browser supports it. Otherwise a cookie fallback mechanism is utilized. Be aware that if the user erases the local database or clears their cookies, all the preferences will be lost. Also be aware that this is not a safe storage method; do not store sensitive data in the defaults database.
The storage method utilized is determined by matching the writing domain to a dictionary of stores, concrete subclasses of the CPUserDefaultsStore abstract class. This is a deviation from Cocoa. You can create a custom defaults store by subclassing the abstract class and implementing the protocol. Currently the protocol consists of only two methods: -data and -setData:. The latter needs to store the passed in CPData object in your storage mechanism and the former needs to return an equivalent CPData object synchronously. You can then configure CPUserDefaults to use your storage mechanism using -setPersistentStoreClass:forDomain:reloadData:
Definition at line 2 of file CPUserDefaults.h.
Returns the array value associated with the specified key.
Definition at line 370 of file CPUserDefaults.j.
|
implementation |
Returns the Boolean value associated with the specified key.
Definition at line 382 of file CPUserDefaults.j.
Returns the data object associated with the specified key.
Definition at line 395 of file CPUserDefaults.j.
|
implementation |
Returns the Boolean value associated with the specified key.
Definition at line 407 of file CPUserDefaults.j.
|
implementation |
Definition at line 337 of file CPUserDefaults.j.
|
implementation |
Returns the double value associated with the specified key.
Definition at line 449 of file CPUserDefaults.j.
|
implementation |
Returns the float value associated with the specified key.
Definition at line 419 of file CPUserDefaults.j.
|
implementation |
Initializes the receiver
Reimplemented from CPObject.
Definition at line 86 of file CPUserDefaults.j.
|
implementation |
Returns the integer value associated with the specified key.
Definition at line 434 of file CPUserDefaults.j.
|
implementation |
Return a default value. The order of domains in the search list is: CPRegistrationDomain, CPGlobalDomain, CPApplicationDomain, CPArgumentDomain. Calling this method may cause the search list to be recreated if any new values have recently been set. Be aware of the performance ramifications.
Definition at line 126 of file CPUserDefaults.j.
|
implementation |
Return a default value from a specific domain. If you know which domain you'd like to use you should always use this method because it doesn't have to hit the search list.
Definition at line 147 of file CPUserDefaults.j.
|
implementation |
Returns an array of currently persistent domain names.
Definition at line 284 of file CPUserDefaults.j.
|
implementation |
Returns the currently used instance of CPUserDefaultStore concrete subclass for the given domain name.
Definition at line 292 of file CPUserDefaults.j.
|
implementation |
Adds the contents the specified dictionary to the registration domain.
If there is no registration domain, one is created using the specified dictionary, and CPRegistrationDomain is added to the end of the search list. The contents of the registration domain are not written to disk; you need to call this method each time your application starts. You can place a plist file in the application's Resources directory and call registerDefaultsWithContentsOfFile:
aDictionary | The dictionary of keys and values you want to register. |
Definition at line 212 of file CPUserDefaults.j.
|
implementation |
This is just a convenience method to load a plist resource and register all the values it contains as defaults.
NOTE: This sends a synchronous request. If you don't want to do that, create a dictionary any way you want (including loading a plist) and pass it to -registerDefaults:
Definition at line 231 of file CPUserDefaults.j.
|
implementation |
Definition at line 324 of file CPUserDefaults.j.
|
implementation |
Removes the value of the specified default key in the standard application domain. Removing a default has no effect on the value returned by the objectForKey: method if the same key exists in a domain that precedes the standard application domain in the search list.
Definition at line 182 of file CPUserDefaults.j.
|
implementation |
Removes the value of the specified default key in the specified domain.
Definition at line 190 of file CPUserDefaults.j.
|
implementation |
Synchronizes any changes made to the shared user defaults object and releases it from memory. A subsequent invocation of standardUserDefaults creates a new shared user defaults object with the standard search list.
Definition at line 75 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the specified Boolean value. A cast will be attempted with -boolValue.
Definition at line 507 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the double value.
Definition at line 528 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the specified float value. A cast will be attempted with -floatValue and parseFloat().
Definition at line 517 of file CPUserDefaults.j.
|
implementation |
Sets the value of the specified default key to the specified integer value. A cast will be attempted with -intValue and parseInt().
Definition at line 537 of file CPUserDefaults.j.
|
implementation |
Set a default value in your application domain.
Definition at line 137 of file CPUserDefaults.j.
|
implementation |
Set a default value in the domain you pass in. If the domain is CPApplicationDomain or CPGlobalDomain, the defaults store will eventually be persisted. You can call -forceFlush to force a persist.
Definition at line 161 of file CPUserDefaults.j.
|
implementation |
Set the CPUserDefaultStore concrete subclass that should be instantiated for use in persisting the given domain name.
aStoreClass | The concrete subclass of CPUserDefaultsStore to use to store the defaults database for this domain |
aDomain | The name of the domain for which you want to change the storage mechanism |
reloadData | Empty the cached defaults for this domain and reload them from the new storage mechanism |
Definition at line 305 of file CPUserDefaults.j.
Sets the value of the specified default key to the specified URL. The adjustments made in Cocoa are not present here.
Definition at line 549 of file CPUserDefaults.j.
|
implementation |
Returns the shared defaults object.
Definition at line 63 of file CPUserDefaults.j.
Returns the string array value associated with the specified key.
Definition at line 473 of file CPUserDefaults.j.
Returns the string value associated with the specified key.
Definition at line 457 of file CPUserDefaults.j.
|
implementation |
Force write out of defaults database immediately.
Definition at line 348 of file CPUserDefaults.j.
Returns the CPURL value associated with the specified key.
Definition at line 489 of file CPUserDefaults.j.
|
implementation |
Returns an array of currently volatile domain names.
Definition at line 276 of file CPUserDefaults.j.