VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /usr/share/doc/gnustep-base-doc/Base/Reference/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/gnustep-base-doc/Base/Reference/NSUserDefaults.gsdoc
<?xml version="1.0"?>
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.4//EN" "http://www.gnustep.org/gsdoc-1_0_4.dtd">
<gsdoc base="NSUserDefaults" up="Base">
  <head>
    <title>NSUserDefaults class reference</title>
    <author name="Georg Tuparev">
      <email address="Tuparev@EMBL-Heidelberg.de">
        Tuparev@EMBL-Heidelberg.de
      </email>
    </author>
    <author name="Richard Frith-Macdonald">
      <email address="rfm@gnu.org">
        rfm@gnu.org
      </email>
    </author>
    <copy>1995-2016 Free Software Foundation, Inc.</copy>
  </head>
  <body>
    <front><contents /></front>
    <chapter>
      <heading>
        Software documentation for the NSUserDefaults class
      </heading>
      <class name="NSUserDefaults" super="NSObject" ovadd="1.0.0">
        <declared>Foundation/NSUserDefaults.h</declared>
        <desc>
          <p>
            NSUserDefaults provides an interface to the
            defaults system, which allows an application
            access to global and/or application specific
            defaults set by the user. A particular instance of
            NSUserDefaults, standardUserDefaults, is
            provided as a convenience. Most of the information
            described below pertains to the
            standardUserDefaults. It is unlikely
            that you would want to instantiate your own
            userDefaults object, since it would not be set
            up in the same way as the standardUserDefaults.
          </p>
          <p>
            Defaults are managed based on <em>domains</em>.
            Certain domains, such as
            <code>NSGlobalDomain</code>, are persistent. These
            domains have defaults that are stored externally.
            Other domains are volatile. The defaults in these
            domains remain in effect only during the existence
            of the application and may in fact be different for
            applications running at the same time. When
            asking for a default value from
            standardUserDefaults, NSUserDefaults
            looks through the various domains in a particular
            order.
          </p>
          <deflist>
            <term>
              <code>GSPrimaryDomain</code>... volatile
            </term>
            <desc>
              Contains values set at runtime and intended to
              supercede any values set in other domains. This
              should be used with great care since it overrides
              values which may have been set explicitly by the
              user.
            </desc>
            <term>
              <code>NSArgumentDomain</code>... volatile
            </term>
            <desc>
              Contains defaults read from the arguments
              provided to the application at startup. <br />
              Pairs of arguments are used for this, with the
              first argument in each pair being the name of a
              default (with a hyphen prepended) and the second
              argument of the pair being the value of the
              default. <br /> NB. In GNUstep special arguments
              of the form <code>--GNU-Debug=...</code> are used to
              enable debugging. Despite beginning with a hyphen,
              these are not treated as default keys.
            </desc>
            <term>
              Application (name of the current process)...
              persistent
            </term>
            <desc>
              Contains application specific defaults, such as
              window positions. This is the domain used by the
              <ref type="method" id="-setObject:forKey:">
                -setObject:forKey:
              </ref>
              method and is the domain normally used when
              setting preferences for an application.
            </desc>
            <term>
              <code>NSGlobalDomain</code>... persistent
            </term>
            <desc>
              Global defaults applicable to all applications.
            </desc>
            <term>
              Language (name based on users's language)...
              volatile
            </term>
            <desc>
              Constants that help with localization to the
              users's language.
            </desc>
            <term><code>GSConfigDomain</code>... volatile</term>
            <desc>
              Information retrieved from the GNUstep
              configuration system. Usually the system
              wide and user specific GNUstep.conf files, or from
              information compiled in when the base library
              was built. <br /> In addition to this standard
              configuration information, this domain
              contains all values from property lists store in
              the GlobalDefaults subdirectory or from the
              GlobalDefaults.plist file stored in
              the same directory as the system wide GNUstep.conf
              file.
            </desc>
            <term>
              <code>NSRegistrationDomain</code>... volatile
            </term>
            <desc>
              Temporary defaults set up by the application.
            </desc>
          </deflist>
          <p>
            The <em>NSLanguages</em> default value is used to set
            up the constants for localization. GNUstep will also
            look for the <code>LANGUAGES</code> environment
            variable if it is not set in the defaults system.
            If it exists, it consists of an array of languages that
            the user prefers. At least one of the languages should
            have a corresponding localization file (typically
            located in the <file>Languages</file> directory of
            the GNUstep resources).
          </p>
          <p>
            As a special extension, on systems that support locales
            (e.g. GNU/Linux and Solaris), GNUstep will use
            information from the user specified locale, if
            the <em>NSLanguages</em> default value is not found.
            Typically the locale is specified in the
            environment with the <code>LANG</code>
            environment variable.
          </p>
          <p>
            The first change to a persistent domain after a
            <ref type="method" id="-synchronize">
              -synchronize
            </ref>
            will cause an NSUserDefaultsDidChangeNotification to
            be posted (as will any change caused by reading new
            values from disk), so your application can keep
            track of changes made to the defaults by other
            software.
          </p>
          <p>
            NB. The GNUstep implementation differs from the Apple
            one in that it is thread-safe while Apple's (as of
            MacOS-X 10.1) is not.
          </p>
        </desc>
        <method type="void" factory="yes" ovadd="0.0.0">
          <sel>resetStandardUserDefaults</sel>
          <desc>
            Resets the shared user defaults object to reflect
            the current user ID. Needed by setuid processes which
            change the user they are running as. <br /> In
            GNUstep you should call
            <ref type="function" id="GSSetUserName">
              GSSetUserName()
            </ref>
            when changing your effective user ID, and that
            function will call this function for you.
          </desc>
        </method>
        <method type="void" factory="yes" ovadd="0.0.0" ovrem="0.0.0">
          <sel>setUserLanguages:</sel>
          <arg type="NSArray*">languages</arg>
          <desc>
            Sets the array of user <var>languages</var>
            preferences. Places the specified array in the
            <em>NSLanguages</em> user default.
          </desc>
        </method>
        <method type="NSUserDefaults*" factory="yes" ovadd="1.0.0">
          <sel>standardUserDefaults</sel>
          <desc>
            Returns the shared defaults object. If it doesn't
            exist yet, it's created. The defaults are initialized
            for the current user. The search list is guaranteed to
            be standard only the first time this method is invoked.
            The shared instance is provided as a convenience; other
            instances may also be created.
          </desc>
        </method>
        <method type="NSArray*" factory="yes" ovadd="0.0.0" ovrem="0.0.0">
          <sel>userLanguages</sel>
          <desc>
            Returns the array of user languages preferences.
            Uses the <em>NSLanguages</em> user default if
            available, otherwise tries to infer setup from
            operating system information etc (in particular,
            uses the <em>LANGUAGES</em> environment variable).
          </desc>
        </method>
        <method type="void" ovadd="0.0.0">
          <sel>addSuiteNamed:</sel>
          <arg type="NSString*">aName</arg>
          <desc>
            Adds the domain names <var>aName</var> to the search
            list of the receiver. <br /> The domain is added after
            the application domain. <br /> Suites may be removed
            using the
            <ref type="method" id="-removeSuiteNamed:">
              -removeSuiteNamed:
            </ref>
            method.
          </desc>
        </method>
        <method type="NSArray*" ovadd="1.0.0">
          <sel>arrayForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and checks that it is an NSArray object. Returns
            <code>nil</code> if it is not.
          </desc>
        </method>
        <method type="BOOL" ovadd="1.0.0">
          <sel>boolForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and returns its boolean representation. <br /> Returns
            <code>NO</code> if it is not a boolean. <br /> The
            text 'yes' or 'true' or any non zero numeric value is
            considered to be a boolean <code>YES</code>.
            Other string values are <code>NO</code>. <br /> NB.
            This differs slightly from the documented behavior for
            MacOS-X (August 2002) in that the GNUstep version
            accepts the string 'TRUE' as equivalent to 'YES'.
          </desc>
        </method>
        <method type="NSData*" ovadd="1.0.0">
          <sel>dataForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and checks that it is an NSData object. Returns
            <code>nil</code> if it is not.
          </desc>
        </method>
        <method type="NSDictionary*" ovadd="1.0.0">
          <sel>dictionaryForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and checks that it is an NSDictionary object. Returns
            <code>nil</code> if it is not.
          </desc>
        </method>
        <method type="NSDictionary*" ovadd="1.0.0">
          <sel>dictionaryRepresentation</sel>
          <desc>
            Returns a dictionary representing the current state
            of the defaults system... this is a merged version of
            all the domains in the search list.
          </desc>
        </method>
        <method type="double" ovadd="10.5.0">
          <sel>doubleForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and checks that it is a <strong>double</strong>.
            Returns 0.0 if it is not.
          </desc>
        </method>
        <method type="float" ovadd="1.0.0">
          <sel>floatForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and checks that it is a <strong>float</strong>. Returns
            0.0 if it is not.
          </desc>
        </method>
        <method type="id" ovadd="1.0.0">
          <sel>init</sel>
          <desc>
            Initializes defaults for current user calling
            initWithUser:
          </desc>
        </method>
        <method type="id" init="yes" ovadd="1.0.0">
          <sel>initWithUser:</sel>
          <arg type="NSString*">userName</arg>
          <desc>
            Initializes defaults for the specified user.
            <br /> Returns an object with an empty search list.
          </desc>
        </method>
        <method type="NSInteger" ovadd="1.0.0">
          <sel>integerForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and returns its integer value or 0 if it is not
            representable as an integer.
          </desc>
        </method>
        <method type="id" ovadd="1.0.0">
          <sel>objectForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using. The
            lookup is performed by accessing the domains in the
            order given in the search list. <br /> Returns
            <code>nil</code> if <var>defaultName</var> cannot be
            found.
          </desc>
        </method>
        <method type="NSDictionary*" ovadd="1.0.0">
          <sel>persistentDomainForName:</sel>
          <arg type="NSString*">domainName</arg>
          <desc>
            Returns the persistent domain specified by
            <var>domainName</var>.
          </desc>
        </method>
        <method type="NSArray*" ovadd="1.0.0">
          <sel>persistentDomainNames</sel>
          <desc>
            Returns an array listing the name of all the
            persistent domains.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>registerDefaults:</sel>
          <arg type="NSDictionary*">newVals</arg>
          <desc>
            Merges the contents of the dictionary
            <var>newVals</var> into the registration domain.
            Registration defaults may be added to or
            replaced using this method, but may never be
            removed. Thus, setting registration defaults at
            any point in your program guarantees that the defaults
            will be available thereafter.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>removeObjectForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Removes the default with the specified name from
            the application domain.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>removePersistentDomainForName:</sel>
          <arg type="NSString*">domainName</arg>
          <desc>
            Removes the persistent domain specified by
            <var>domainName</var> from the user defaults. <br />
            Causes a NSUserDefaultsDidChangeNotification to be
            posted if this is the first change to a
            persistent-domain since the last
            <ref type="method" id="-synchronize">
              -synchronize
            </ref>
            .
          </desc>
        </method>
        <method type="void" ovadd="0.0.0">
          <sel>removeSuiteNamed:</sel>
          <arg type="NSString*">aName</arg>
          <desc>
            Removes the named domain from the search list of
            the receiver. <br /> Suites may be added using the
            <ref type="method" id="-addSuiteNamed:">
              -addSuiteNamed:
            </ref>
            method.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>removeVolatileDomainForName:</sel>
          <arg type="NSString*">domainName</arg>
          <desc>
            Removes the volatile domain specified by
            <var>domainName</var> from the user defaults.
          </desc>
        </method>
        <method type="NSArray*" ovadd="1.0.0">
          <sel>searchList</sel>
          <desc>
            Returns an array listing the domains searched in
            order to look up a value in the defaults system. The
            order of the names in the array is the order in which
            the domains are searched.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>setBool:</sel>
          <arg type="BOOL">value</arg>
          <sel>forKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Sets a boolean <var>value</var> for
            <var>defaultName</var> in the application domain.
            <br /> Calls
            <ref type="method" id="-setObject:forKey:">
              -setObject:forKey:
            </ref>
            to make the change by storing a string containing either
            the word <code>YES</code> or <code>NO</code>.
          </desc>
        </method>
        <method type="void" ovadd="10.5.0">
          <sel>setDouble:</sel>
          <arg type="double">value</arg>
          <sel>forKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Sets a <strong>double</strong> <var>value</var> for
            <var>defaultName</var> in the application domain.
            <br /> Calls
            <ref type="method" id="-setObject:forKey:">
              -setObject:forKey:
            </ref>
            to make the change by storing a <strong>double</strong>
            <ref type="class" id="NSNumber">NSNumber</ref>
              instance.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>setFloat:</sel>
          <arg type="float">value</arg>
          <sel>forKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Sets a <strong>float</strong> <var>value</var> for
            <var>defaultName</var> in the application domain.
            <br /> Calls
            <ref type="method" id="-setObject:forKey:">
              -setObject:forKey:
            </ref>
            to make the change by storing a <strong>float</strong>
            <ref type="class" id="NSNumber">NSNumber</ref>
              instance.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>setInteger:</sel>
          <arg type="NSInteger">value</arg>
          <sel>forKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Sets an integer <var>value</var> for
            <var>defaultName</var> in the application domain.
            <br /> Calls
            <ref type="method" id="-setObject:forKey:">
              -setObject:forKey:
            </ref>
            to make the change by storing an intege
            <ref type="class" id="NSNumber">NSNumber</ref>
              instance.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>setObject:</sel>
          <arg type="id">value</arg>
          <sel>forKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Sets a copy of an object <var>value</var> for
            <var>defaultName</var> in the application domain.
            <br /> The <var>defaultName</var> must be a
            non-empty string. <br /> The <var>value</var> to
            be copied into the domain must be an instance of one of
            the
            <ref type="method" id="-propertyList" class="NSString">
              [NSString -propertyList]
            </ref>
            classes. <br />
            <p>
              Causes a NSUserDefaultsDidChangeNotification to be
              posted if this is the first change to a
              persistent-domain since the last
              <ref type="method" id="-synchronize">
                -synchronize
              </ref>
              .
            </p>
            If <var>value</var> is <code>nil</code>, this is
            equivalent to the
            <ref type="method" id="-removeObjectForKey:">
              -removeObjectForKey:
            </ref>
            method.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>setPersistentDomain:</sel>
          <arg type="NSDictionary*">domain</arg>
          <sel>forName:</sel>
          <arg type="NSString*">domainName</arg>
          <desc>
            Replaces the persistent-domain specified by
            <var>domainName</var> with <var>domain</var>... a
            dictionary containing keys and defaults values.
            <br /> Raises an NSInvalidArgumentException if
            <var>domainName</var> already exists as a
            volatile-domain. <br /> Causes a
            NSUserDefaultsDidChangeNotification
            to be posted if this is the first change to a
            persistent-domain since the last
            <ref type="method" id="-synchronize">
              -synchronize
            </ref>
            .
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>setSearchList:</sel>
          <arg type="NSArray*">newList</arg>
          <desc>
            Sets the list of the domains searched in order to look
            up a value in the defaults system. The order of the
            names in the array is the order in which the domains
            are searched. <br /> On lookup, the first match is
            used.
          </desc>
        </method>
        <method type="void" ovadd="1.0.0">
          <sel>setVolatileDomain:</sel>
          <arg type="NSDictionary*">domain</arg>
          <sel>forName:</sel>
          <arg type="NSString*">domainName</arg>
          <desc>
            Sets the volatile-domain specified by
            <var>domainName</var> to <var>domain</var>... a
            dictionary containing keys and defaults values.
            <br /> Raises an NSInvalidArgumentException if
            <var>domainName</var> already exists as either a
            volatile-domain or a persistent-domain.
          </desc>
        </method>
        <method type="NSArray*" ovadd="1.0.0">
          <sel>stringArrayForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Calls
            <ref type="method" id="-arrayForKey:">
              -arrayForKey:
            </ref>
            to get an array value for <var>defaultName</var> and
            checks that the array contents are string objects...
            if not, returns <code>nil</code>.
          </desc>
        </method>
        <method type="NSString*" ovadd="1.0.0">
          <sel>stringForKey:</sel>
          <arg type="NSString*">defaultName</arg>
          <desc>
            Looks up a value for a specified default using
            <ref type="method" id="-objectForKey:">
              -objectForKey:
            </ref>
            and checks that it is an NSString. Returns
            <code>nil</code> if it is not.
          </desc>
        </method>
        <method type="BOOL" ovadd="1.0.0">
          <sel>synchronize</sel>
          <desc>
            Ensures that the in-memory and on-disk
            representations of the defaults are in
            sync. You may call this yourself, but probably don't
            need to since it is invoked at intervals whenever a
            runloop is running. <br /> If any persistent domain
            is changed by reading new values from disk, an
            NSUserDefaultsDidChangeNotification
            is posted.
          </desc>
        </method>
        <method type="NSDictionary*" ovadd="1.0.0">
          <sel>volatileDomainForName:</sel>
          <arg type="NSString*">domainName</arg>
          <desc>
            Returns the volatile domain specified by
            <var>domainName</var>.
          </desc>
        </method>
        <method type="NSArray*" ovadd="1.0.0">
          <sel>volatileDomainNames</sel>
          <desc>
            Returns an array listing the name of all the
            volatile domains.
          </desc>
        </method>
      </class>
    </chapter>
  </body>
</gsdoc>

VaKeR 2022