Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Attributes | Private Attributes
nsPref Class Reference
Inheritance diagram for nsPref:
Inheritance graph
[legend]
Collaboration diagram for nsPref:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIPREFBRANCH
NS_DECL_NSIPREFBRANCH2
NS_DECL_NSISECURITYPREF
NS_DECL_NSIOBSERVER NS_IMETHOD 
CopyCharPref (const char *pref, char **return_buf)
NS_IMETHODIMP GetDefaultBoolPref (const char *pref, PRBool *_retval)
NS_IMETHODIMP CopyDefaultCharPref (const char *pref, char **_retval)
NS_IMETHODIMP GetDefaultIntPref (const char *pref, PRInt32 *_retval)
NS_IMETHODIMP SetDefaultBoolPref (const char *pref, PRBool value)
NS_IMETHODIMP SetDefaultCharPref (const char *pref, const char *value)
NS_IMETHODIMP SetDefaultIntPref (const char *pref, PRInt32 value)
NS_IMETHOD CopyUnicharPref (const char *pref, PRUnichar **_retval)
NS_IMETHOD CopyDefaultUnicharPref (const char *pref, PRUnichar **_retval)
NS_IMETHOD SetUnicharPref (const char *pref, const PRUnichar *value)
NS_IMETHOD SetDefaultUnicharPref (const char *pref, const PRUnichar *value)
NS_IMETHOD GetLocalizedUnicharPref (const char *pref, PRUnichar **_retval)
NS_IMETHOD GetDefaultLocalizedUnicharPref (const char *pref, PRUnichar **_retval)
NS_IMETHOD GetFilePref (const char *pref, nsIFileSpec **_retval)
NS_IMETHOD SetFilePref (const char *pref, nsIFileSpec *value, PRBool setDefault)
NS_IMETHOD GetFileXPref (const char *pref, nsILocalFile **_retval)
NS_IMETHOD SetFileXPref (const char *pref, nsILocalFile *value)
NS_IMETHOD RegisterCallback (const char *domain, PrefChangedFunc callback, void *closure)
NS_IMETHOD UnregisterCallback (const char *domain, PrefChangedFunc callback, void *closure)
NS_IMETHOD EnumerateChildren (const char *parent, PrefEnumerationFunc callback, void *data)
void readUserPrefs (in nsIFile aFile)
void ResetPrefs ()
void ResetUserPrefs ()
void savePrefFile (in nsIFile aFile)
nsIPrefBranch getBranch (in string aPrefRoot)
nsIPrefBranch getDefaultBranch (in string aPrefRoot)
long GetPrefType (in string aPrefName)
boolean GetBoolPref (in string aPrefName)
void SetBoolPref (in string aPrefName, in long aValue)
string GetCharPref (in string aPrefName)
void SetCharPref (in string aPrefName, in string aValue)
long GetIntPref (in string aPrefName)
void SetIntPref (in string aPrefName, in long aValue)
void getComplexValue (in string aPrefName, in nsIIDRef aType,[iid_is(aType), retval] out nsQIResult aValue)
void setComplexValue (in string aPrefName, in nsIIDRef aType, in nsISupports aValue)
void ClearUserPref (in string aPrefName)
boolean PrefIsLocked (in string aPrefName)
void lockPref (in string aPrefName)
void unlockPref (in string aPrefName)
void resetBranch (in string aStartingAt)
void DeleteBranch (in string aStartingAt)
void getChildList (in string aStartingAt, out unsigned long aCount,[array, size_is(aCount), retval] out string aChildArray)
void addObserver (in string aDomain, in nsIObserver aObserver, in boolean aHoldWeak)
void removeObserver (in string aDomain, in nsIObserver aObserver)
string CopyCharPref (in string pref)
string CopyDefaultCharPref (in string pref)
boolean GetDefaultBoolPref (in string pref)
long GetDefaultIntPref (in string pref)
void SetDefaultBoolPref (in string pref, in boolean value)
void SetDefaultCharPref (in string pref, in string value)
void SetDefaultIntPref (in string pref, in long value)
wstring CopyUnicharPref (in string pref)
wstring CopyDefaultUnicharPref (in string pref)
void SetUnicharPref (in string pref, in wstring value)
void SetDefaultUnicharPref (in string pref, in wstring value)
wstring getLocalizedUnicharPref (in string pref)
wstring getDefaultLocalizedUnicharPref (in string pref)
nsIFileSpec GetFilePref (in string pref)
void SetFilePref (in string pref, in nsIFileSpec value, in boolean setDefault)
nsILocalFile getFileXPref (in string pref)
void setFileXPref (in string pref, in nsILocalFile value)
void RegisterCallback (in string domain, in PrefChangedFunc callback, in voidPtr closure)
void UnregisterCallback (in string domain, in PrefChangedFunc callback, in voidPtr closure)
void EnumerateChildren (in string parent, in PrefEnumerationFunc callback, in voidPtr data)
 EnumerateChildren.
void readUserPrefs (in nsIFile aFile)
 Called to read in the preferences specified in a user preference file.
void resetPrefs ()
 Called to completely flush and re-initialize the preferences system.
void resetUserPrefs ()
 Called to reset all preferences with user set values back to the application default values.
void savePrefFile (in nsIFile aFile)
 Called to write current preferences state to a file.
nsIPrefBranch getBranch (in string aPrefRoot)
 Call to get a Preferences "Branch" which accesses user preference data.
nsIPrefBranch getDefaultBranch (in string aPrefRoot)
 Call to get a Preferences "Branch" which accesses only the default preference data.
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.
void addObserver (in string aDomain, in nsIObserver aObserver, in boolean aHoldWeak)
 Add a preference change observer.
void removeObserver (in string aDomain, in nsIObserver aObserver)
 Remove a preference change observer.
long getPrefType (in string aPrefName)
 Called to determine the type of a specific preference.
boolean getBoolPref (in string aPrefName)
 Called to get the state of an individual boolean preference.
void setBoolPref (in string aPrefName, in long aValue)
 Called to set the state of an individual boolean preference.
string getCharPref (in string aPrefName)
 Called to get the state of an individual string preference.
void setCharPref (in string aPrefName, in string aValue)
 Called to set the state of an individual string preference.
long getIntPref (in string aPrefName)
 Called to get the state of an individual integer preference.
void setIntPref (in string aPrefName, in long aValue)
 Called to set the state of an individual integer preference.
void getComplexValue (in string aPrefName, in nsIIDRef aType,[iid_is(aType), retval] out nsQIResult aValue)
 Called to get the state of an individual complex preference.
void setComplexValue (in string aPrefName, in nsIIDRef aType, in nsISupports aValue)
 Called to set the state of an individual complex preference.
void clearUserPref (in string aPrefName)
 Called to clear a user set value from a specific preference.
void lockPref (in string aPrefName)
 Called to lock a specific preference.
boolean prefHasUserValue (in string aPrefName)
 Called to check if a specific preference has a user value associated to it.
boolean prefIsLocked (in string aPrefName)
 Called to check if a specific preference is locked.
void unlockPref (in string aPrefName)
 Called to unlock a specific preference.
void deleteBranch (in string aStartingAt)
 Called to remove all of the preferences referenced by this branch.
void getChildList (in string aStartingAt, out unsigned long aCount,[array, size_is(aCount), retval] out string aChildArray)
 Returns an array of strings representing the child preferences of the root of this branch.
void resetBranch (in string aStartingAt)
 Called to reset all of the preferences referenced by this branch to their default values.
boolean securityGetBoolPref (in string pref)
 Called to get the state of a "capability" boolean preference.
void securitySetBoolPref (in string pref, in boolean value)
 Called to set the state of a "capability" boolean preference.
string securityGetCharPref (in string pref)
 Called to get the state of a "capability" string preference.
void securitySetCharPref (in string pref, in string value)
 Called to set the state of a "capability" string preference.
long securityGetIntPref (in string pref)
 Called to get the state of a "capability" integer preference.
void securitySetIntPref (in string pref, in long value)
 Called to set the state of a "capability" integer preference.
void securityClearUserPref (in string pref_name)
 Called to clear a user set value from a "capability" preference.

Static Public Member Functions

static nsPrefGetInstance ()

Public Attributes

const long ePrefInvalid = 0
const long ePrefLocked = 1
const long ePrefUserset = 2
const long ePrefConfig = 4
const long ePrefRemote = 8
const long ePrefLilocal = 16
const long ePrefString = 32
const long ePrefInt = 64
const long ePrefBool = 128
const long ePrefValuetypeMask = (ePrefString | ePrefInt | ePrefBool)
readonly attribute string root
const long PREF_INVALID = 0
 Values describing the basic preference types.
const long PREF_STRING = 32
const long PREF_INT = 64
const long PREF_BOOL = 128
readonly attribute string root
 Called to get the root on which this branch is based, such as "browser.startup.".

Protected Member Functions

 nsPref ()
virtual ~nsPref ()

Static Protected Attributes

static nsPrefgInstance = NULL

Private Attributes

nsCOMPtr< nsIPrefServicemPrefService
nsCOMPtr< nsIPrefBranchmDefaultBranch

Detailed Description

Definition at line 84 of file nsPref.cpp.


Constructor & Destructor Documentation

nsPref::nsPref ( ) [protected]
nsPref::~nsPref ( ) [protected, virtual]

Definition at line 172 of file nsPref.cpp.

Here is the call graph for this function:


Member Function Documentation

void nsIPrefBranch2::addObserver ( in string  aDomain,
in nsIObserver  aObserver,
in boolean  aHoldWeak 
) [inherited]

Add a preference change observer.

On preference changes, the following arguments will be passed to the nsIObserver.observe() method: aSubject - The nsIPrefBranch object (this) aTopic - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID aData - The preference which has changed

Parameters:
aDomainThe preference on which to listen for changes. This can be the name of an entire branch to observe. e.g. Holding the "root" prefbranch and calling addObserver("foo.bar.", ...) will observe changes to foo.bar.baz and foo.bar.bzip
aObserverThe object to be notified if the preference changes.
aHoldWeaktrue Hold a weak reference to |aObserver|. The object must implement the nsISupportsWeakReference interface or this will fail. false Hold a strong reference to |aObserver|.
Note:
Registering as a preference observer can open an object to potential cyclical references which will cause memory leaks. These cycles generally occur because an object both registers itself as an observer (causing the branch to hold a reference to the observer) and holds a reference to the branch object for the purpose of getting/setting preference values. There are 3 approaches which have been implemented in an attempt to avoid these situations. 1) The nsPrefBranch object supports nsISupportsWeakReference. Any consumer may hold a weak reference to it instead of a strong one. 2) The nsPrefBranch object listens for xpcom-shutdown and frees all of the objects currently in its observer list. This insures that long lived objects (services for example) will be freed correctly. 3) The observer can request to be held as a weak reference when it is registered. This insures that shorter lived objects (say one tied to an open window) will not fall into the cyclical reference trap.
The list of registered observers may be changed during the dispatch of nsPref:changed notification. However, the observers are not guaranteed to be notified in any particular order, so you can't be sure whether the added/removed observer will be called during the notification when it is added/removed.
It is possible to change preferences during the notification.
It is not safe to change observers during this callback in Gecko releases before 1.9. If you want a safe way to remove a pref observer, please use an nsITimer.
See also:
nsIObserver
removeObserver
void nsIPref::addObserver ( in string  aDomain,
in nsIObserver  aObserver,
in boolean  aHoldWeak 
) [inherited]
void nsIPref::ClearUserPref ( in string  aPrefName) [inherited]
void nsIPrefBranch::clearUserPref ( in string  aPrefName) [inherited]

Called to clear a user set value from a specific preference.

This will, in effect, reset the value to the default value. If no default value exists the preference will cease to exist.

Parameters:
aPrefNameThe preference to be cleared.
Note:
This method does nothing if this object is a default branch.
Returns:
NS_OK The user preference was successfully cleared.
Other The preference does not exist or have a user set value.
NS_IMETHODIMP nsPref::CopyCharPref ( const char *  pref,
char **  return_buf 
)

Definition at line 203 of file nsPref.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
  if (NS_SUCCEEDED(rv))
    rv = prefBranch->GetCharPref(pref, return_buf);
  return rv;
}

Here is the call graph for this function:

string nsIPref::CopyCharPref ( in string  pref) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP nsPref::CopyDefaultCharPref ( const char *  pref,
char **  _retval 
) [inline]

Definition at line 106 of file nsPref.cpp.

                  { return mDefaultBranch->GetCharPref(pref, _retval); }

Here is the caller graph for this function:

NS_IMETHODIMP nsPref::CopyDefaultUnicharPref ( const char *  pref,
PRUnichar **  _retval 
)

Definition at line 429 of file nsPref.cpp.

{
  nsresult rv;
  nsCOMPtr<nsISupportsString> theString;

  rv = mDefaultBranch->GetComplexValue(pref, NS_GET_IID(nsISupportsString),
                                       getter_AddRefs(theString));
  if (NS_FAILED(rv))
    return rv;

  return theString->ToString(_retval);
}

Here is the call graph for this function:

wstring nsIPref::CopyDefaultUnicharPref ( in string  pref) [inherited]
NS_IMETHODIMP nsPref::CopyUnicharPref ( const char *  pref,
PRUnichar **  _retval 
)

Definition at line 412 of file nsPref.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
  if (NS_SUCCEEDED(rv)) {
    nsCOMPtr<nsISupportsString> theString;
    rv = prefBranch->GetComplexValue(pref, NS_GET_IID(nsISupportsString),
                                     getter_AddRefs(theString));
    if (NS_FAILED(rv))
      return rv;

    return theString->ToString(_retval);
  }
  return rv;
}

Here is the call graph for this function:

wstring nsIPref::CopyUnicharPref ( in string  pref) [inherited]

Here is the caller graph for this function:

void nsIPref::DeleteBranch ( in string  aStartingAt) [inherited]
void nsIPrefBranch::deleteBranch ( in string  aStartingAt) [inherited]

Called to remove all of the preferences referenced by this branch.

Parameters:
aStartingAtThe point on the branch at which to start the deleting preferences. Pass in "" to remove all preferences referenced by this branch.
Note:
This method can be called on either a default or user branch but, in effect, always operates on both.
Returns:
NS_OK The preference(s) were successfully removed.
Other The preference(s) do not exist or an error occurred.
NS_IMETHODIMP nsPref::EnumerateChildren ( const char *  parent,
PrefEnumerationFunc  callback,
void data 
)

Definition at line 580 of file nsPref.cpp.

{
  PRUint32 theCount;
  PRUint32 i;
  nsresult rv;
  char     **childArray;
  char     *prefName;

  rv = GetChildList(parent, &theCount, &childArray);
  if (NS_SUCCEEDED(rv)) {
    // now that we've built up the list, run the callback on all the matching elements
    for (i = 0; i < theCount; i++) {
      prefName = (char *)childArray[i];
      (*callback)((char*)prefName, arg);
    }

    // now release all the memory
    NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(theCount, childArray);
  }

  return NS_OK;
}
void nsIPref::EnumerateChildren ( in string  parent,
in PrefEnumerationFunc  callback,
in voidPtr  data 
) [inherited]

EnumerateChildren.

Call back function "callback" with every preference string having prefix "parent". Pass "data" to "callback" when calling.

Parameters:
parentA string representation of a prefix of preferences
callbackA function to call back for each matching preference
dataA piece of data to pass on to the callback

Here is the caller graph for this function:

boolean nsIPrefBranch::getBoolPref ( in string  aPrefName) [inherited]

Called to get the state of an individual boolean preference.

Parameters:
aPrefNameThe boolean preference to get the state of.
Returns:
boolean The value of the requested boolean preference.
See also:
setBoolPref
boolean nsIPref::GetBoolPref ( in string  aPrefName) [inherited]

Here is the caller graph for this function:

nsIPrefBranch nsIPref::getBranch ( in string  aPrefRoot) [inherited]
nsIPrefBranch nsIPrefService::getBranch ( in string  aPrefRoot) [inherited]

Call to get a Preferences "Branch" which accesses user preference data.

Using a Set method on this object will always create or set a user preference value. When using a Get method a user set value will be returned if one exists, otherwise a default value will be returned.

Parameters:
aPrefRootThe preference "root" on which to base this "branch". For example, if the root "browser.startup." is used, the branch will be able to easily access the preferences "browser.startup.page", "browser.startup.homepage", or "browser.startup.homepage_override" by simply requesting "page", "homepage", or "homepage_override". nsnull or "" may be used to access to the entire preference "tree".
Returns:
nsIPrefBranch The object representing the requested branch.
See also:
getDefaultBranch
string nsIPrefBranch::getCharPref ( in string  aPrefName) [inherited]

Called to get the state of an individual string preference.

Parameters:
aPrefNameThe string preference to retrieve.
Returns:
string The value of the requested string preference.
See also:
setCharPref
string nsIPref::GetCharPref ( in string  aPrefName) [inherited]

Here is the caller graph for this function:

void nsIPref::getChildList ( in string  aStartingAt,
out unsigned long  aCount,
[array, size_is(aCount), retval] out string  aChildArray 
) [inherited]
void nsIPrefBranch::getChildList ( in string  aStartingAt,
out unsigned long  aCount,
[array, size_is(aCount), retval] out string  aChildArray 
) [inherited]

Returns an array of strings representing the child preferences of the root of this branch.

Parameters:
aStartingAtThe point on the branch at which to start enumerating the child preferences. Pass in "" to enumerate all preferences referenced by this branch.
aCountReceives the number of elements in the array.
aChildArrayReceives the array of child preferences.
Note:
This method can be called on either a default or user branch but, in effect, always operates on both.
Returns:
NS_OK The preference list was successfully retrieved.
Other The preference(s) do not exist or an error occurred.
void nsIPref::getComplexValue ( in string  aPrefName,
in nsIIDRef  aType,
[iid_is(aType), retval] out nsQIResult  aValue 
) [inherited]
void nsIPrefBranch::getComplexValue ( in string  aPrefName,
in nsIIDRef  aType,
[iid_is(aType), retval] out nsQIResult  aValue 
) [inherited]

Called to get the state of an individual complex preference.

A complex preference is a preference which represents an XPCOM object that can not be easily represented using a standard boolean, integer or string value.

Parameters:
aPrefNameThe complex preference to get the value of.
aTypeThe XPCOM interface that this complex preference represents. Interfaces currently supported are:
aValueThe XPCOM object into which to the complex preference value should be retrieved.
Returns:
NS_OK The value was successfully retrieved.
Other The value does not exist or is the wrong type.
See also:
setComplexValue
NS_IMETHODIMP nsPref::GetDefaultBoolPref ( const char *  pref,
PRBool _retval 
) [inline]

Definition at line 104 of file nsPref.cpp.

                  { return mDefaultBranch->GetBoolPref(pref, _retval); }
nsIPrefBranch nsIPref::getDefaultBranch ( in string  aPrefRoot) [inherited]

Call to get a Preferences "Branch" which accesses only the default preference data.

Using a Set method on this object will always create or set a default preference value. When using a Get method a default value will always be returned.

Parameters:
aPrefRootThe preference "root" on which to base this "branch". For example, if the root "browser.startup." is used, the branch will be able to easily access the preferences "browser.startup.page", "browser.startup.homepage", or "browser.startup.homepage_override" by simply requesting "page", "homepage", or "homepage_override". nsnull or "" may be used to access to the entire preference "tree".
Note:
Few consumers will want to create default branch objects. Many of the branch methods do nothing on a default branch because the operations only make sense when applied to user set preferences.
Returns:
nsIPrefBranch The object representing the requested default branch.
See also:
getBranch
NS_IMETHODIMP nsPref::GetDefaultIntPref ( const char *  pref,
PRInt32 _retval 
) [inline]

Definition at line 108 of file nsPref.cpp.

                  { return mDefaultBranch->GetIntPref(pref, _retval); }
long nsIPref::GetDefaultIntPref ( in string  pref) [inherited]

Here is the caller graph for this function:

Definition at line 485 of file nsPref.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIPrefLocalizedString> theString;

  rv = mDefaultBranch->GetComplexValue(pref, NS_GET_IID(nsIPrefLocalizedString),
                                       getter_AddRefs(theString));
  if (NS_SUCCEEDED(rv)) {
    rv = theString->ToString(_retval);
  }
  
  return rv;
}

Here is the call graph for this function:

wstring nsIPref::getDefaultLocalizedUnicharPref ( in string  pref) [inherited]
NS_IMETHODIMP nsPref::GetFilePref ( const char *  pref,
nsIFileSpec **  _retval 
)

Definition at line 499 of file nsPref.cpp.

{
#ifdef MOZ_NO_XPCOM_OBSOLETE
  return NS_ERROR_NOT_IMPLEMENTED;
#else
  nsresult rv;

  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
  if (NS_SUCCEEDED(rv))
    rv = prefBranch->GetComplexValue(pref, NS_GET_IID(nsIFileSpec), (void **)_retval);
  return rv;
#endif
}

Here is the call graph for this function:

nsIFileSpec nsIPref::GetFilePref ( in string  pref) [inherited]
NS_IMETHODIMP nsPref::GetFileXPref ( const char *  pref,
nsILocalFile **  _retval 
)

Definition at line 531 of file nsPref.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
  if (NS_SUCCEEDED(rv))
    rv = prefBranch->GetComplexValue(pref, NS_GET_IID(nsILocalFile), (void **)_retval);
  return rv;
}

Here is the call graph for this function:

nsPref * nsPref::GetInstance ( ) [static]

Definition at line 709 of file nsPref.cpp.

{
  if (!gInstance)
  {
    NS_NEWXPCOM(gInstance, nsPref);
  }
  return gInstance;
} // nsPref::GetInstance

Here is the caller graph for this function:

long nsIPrefBranch::getIntPref ( in string  aPrefName) [inherited]

Called to get the state of an individual integer preference.

Parameters:
aPrefNameThe integer preference to get the value of.
Returns:
long The value of the requested integer preference.
See also:
setIntPref
long nsIPref::GetIntPref ( in string  aPrefName) [inherited]

Here is the caller graph for this function:

NS_IMETHODIMP nsPref::GetLocalizedUnicharPref ( const char *  pref,
PRUnichar **  _retval 
)

Definition at line 469 of file nsPref.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
  if (NS_SUCCEEDED(rv)) {
    nsCOMPtr<nsIPrefLocalizedString> theString;
    rv = prefBranch->GetComplexValue(pref, NS_GET_IID(nsIPrefLocalizedString),
                                       getter_AddRefs(theString));
    if (NS_SUCCEEDED(rv)) {
      rv = theString->ToString(_retval);
    }
  }
  return rv;
}

Here is the call graph for this function:

wstring nsIPref::getLocalizedUnicharPref ( in string  pref) [inherited]
long nsIPrefBranch::getPrefType ( in string  aPrefName) [inherited]

Called to determine the type of a specific preference.

Parameters:
aPrefNameThe preference to get the type of.
Returns:
long A value representing the type of the preference. This value will be PREF_STRING, PREF_INT, or PREF_BOOL.
long nsIPref::GetPrefType ( in string  aPrefName) [inherited]
void nsIPref::lockPref ( in string  aPrefName) [inherited]
void nsIPrefBranch::lockPref ( in string  aPrefName) [inherited]

Called to lock a specific preference.

Locking a preference will cause the preference service to always return the default value regardless of whether there is a user set value or not.

Parameters:
aPrefNameThe preference to be locked.
Note:
This method can be called on either a default or user branch but, in effect, always operates on the default branch.
Returns:
NS_OK The preference was successfully locked.
Other The preference does not exist or an error occurred.
See also:
unlockPref
void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.
boolean nsIPrefBranch::prefHasUserValue ( in string  aPrefName) [inherited]

Called to check if a specific preference has a user value associated to it.

Parameters:
aPrefNameThe preference to be tested.
Note:
This method can be called on either a default or user branch but, in effect, always operates on the user branch.
Returns:
boolean true The preference has a user set value. false The preference only has a default value.
boolean nsIPref::PrefIsLocked ( in string  aPrefName) [inherited]
boolean nsIPrefBranch::prefIsLocked ( in string  aPrefName) [inherited]

Called to check if a specific preference is locked.

If a preference is locked calling its Get method will always return the default value.

Parameters:
aPrefNameThe preference to be tested.
Note:
This method can be called on either a default or user branch but, in effect, always operates on the default branch.
Returns:
boolean true The preference is locked. false The preference is not locked.
See also:
lockPref
unlockPref
void nsIPrefService::readUserPrefs ( in nsIFile  aFile) [inherited]

Called to read in the preferences specified in a user preference file.

Parameters:
aFileThe file to be read.
Note:
If nsnull is passed in for the aFile parameter the default preferences file(s) [prefs.js, user.js] will be read and processed.
Returns:
NS_OK File was read and processed.
Other File failed to read or contained invalid data.
See also:
savePrefFile
nsIFile
void nsIPref::readUserPrefs ( in nsIFile  aFile) [inherited]
NS_IMETHODIMP nsPref::RegisterCallback ( const char *  domain,
PrefChangedFunc  callback,
void closure 
)

Definition at line 558 of file nsPref.cpp.

{
    PREF_RegisterCallback(domain, callback, instance_data);
    return NS_OK;
}

Here is the call graph for this function:

void nsIPref::RegisterCallback ( in string  domain,
in PrefChangedFunc  callback,
in voidPtr  closure 
) [inherited]

Here is the caller graph for this function:

void nsIPrefBranch2::removeObserver ( in string  aDomain,
in nsIObserver  aObserver 
) [inherited]

Remove a preference change observer.

Parameters:
aDomainThe preference which is being observed for changes.
aObserverAn observer previously registered with addObserver().
See also:
nsIObserver
addObserver
void nsIPref::removeObserver ( in string  aDomain,
in nsIObserver  aObserver 
) [inherited]
void nsIPref::resetBranch ( in string  aStartingAt) [inherited]
void nsIPrefBranch::resetBranch ( in string  aStartingAt) [inherited]

Called to reset all of the preferences referenced by this branch to their default values.

Parameters:
aStartingAtThe point on the branch at which to start the resetting preferences to their default values. Pass in "" to reset all preferences referenced by this branch.
Note:
This method can be called on either a default or user branch but, in effect, always operates on the user branch.
Returns:
NS_OK The preference(s) were successfully reset.
Other The preference(s) do not exist or an error occurred.

Called to completely flush and re-initialize the preferences system.

Returns:
NS_OK The preference service was re-initialized correctly.
Other The preference service failed to restart correctly.
void nsIPref::ResetPrefs ( ) [inherited]

Called to reset all preferences with user set values back to the application default values.

Returns:
NS_OK Always.
void nsIPref::ResetUserPrefs ( ) [inherited]
void nsIPrefService::savePrefFile ( in nsIFile  aFile) [inherited]

Called to write current preferences state to a file.

Parameters:
aFileThe file to be written.
Note:
If nsnull is passed in for the aFile parameter the preference data is written out to the current preferences file (usually prefs.js.)
Returns:
NS_OK File was written.
Other File failed to write.
See also:
readUserPrefs
nsIFile
void nsIPref::savePrefFile ( in nsIFile  aFile) [inherited]

Called to clear a user set value from a "capability" preference.

This will, in effect, reset the value to the default value. If no default value exists the preference will cease to exist.

Parameters:
pref_nameThe preference to be cleared.
Note:
This method does nothing if this object is a default branch.
Returns:
NS_OK The user preference was successfully cleared.
Other The preference does not exist or have a user set value.

Called to get the state of a "capability" boolean preference.

Parameters:
prefThe boolean preference to get the state of.
Returns:
boolean The value of the requested boolean preference.
See also:
securitySetBoolPref

Called to get the state of a "capability" string preference.

Parameters:
prefThe string preference to retrieve.
Returns:
string The value of the requested string preference.
See also:
securitySetCharPref

Called to get the state of a "capability" integer preference.

Parameters:
prefThe integer preference to get the value of.
Returns:
long The value of the requested integer preference.
See also:
securitySetIntPref
void nsISecurityPref::securitySetBoolPref ( in string  pref,
in boolean  value 
) [inherited]

Called to set the state of a "capability" boolean preference.

Parameters:
prefThe boolean preference to set the state of.
valueThe boolean value to set the preference to.
Returns:
NS_OK The value was successfully set.
Other The value was not set or is the wrong type.
See also:
securityGetBoolPref
void nsISecurityPref::securitySetCharPref ( in string  pref,
in string  value 
) [inherited]

Called to set the state of a "capability" string preference.

Parameters:
prefThe string preference to set.
valueThe string value to set the preference to.
Returns:
NS_OK The value was successfully set.
Other The value was not set or is the wrong type.
See also:
securityGetCharPref
void nsISecurityPref::securitySetIntPref ( in string  pref,
in long  value 
) [inherited]

Called to set the state of a "capability" integer preference.

Parameters:
prefThe integer preference to set the value of.
valueThe integer value to set the preference to.
Returns:
NS_OK The value was successfully set.
Other The value was not set or is the wrong type.
See also:
securityGetIntPref
void nsIPrefBranch::setBoolPref ( in string  aPrefName,
in long  aValue 
) [inherited]

Called to set the state of an individual boolean preference.

Parameters:
aPrefNameThe boolean preference to set the state of.
aValueThe boolean value to set the preference to.
Returns:
NS_OK The value was successfully set.
Other The value was not set or is the wrong type.
See also:
getBoolPref
void nsIPref::SetBoolPref ( in string  aPrefName,
in long  aValue 
) [inherited]

Here is the caller graph for this function:

void nsIPrefBranch::setCharPref ( in string  aPrefName,
in string  aValue 
) [inherited]

Called to set the state of an individual string preference.

Parameters:
aPrefNameThe string preference to set.
aValueThe string value to set the preference to.
Returns:
NS_OK The value was successfully set.
Other The value was not set or is the wrong type.
See also:
getCharPref
void nsIPref::SetCharPref ( in string  aPrefName,
in string  aValue 
) [inherited]

Here is the caller graph for this function:

void nsIPref::setComplexValue ( in string  aPrefName,
in nsIIDRef  aType,
in nsISupports  aValue 
) [inherited]
void nsIPrefBranch::setComplexValue ( in string  aPrefName,
in nsIIDRef  aType,
in nsISupports  aValue 
) [inherited]

Called to set the state of an individual complex preference.

A complex preference is a preference which represents an XPCOM object that can not be easily represented using a standard boolean, integer or string value.

Parameters:
aPrefNameThe complex preference to set the value of.
aTypeThe XPCOM interface that this complex preference represents. Interfaces currently supported are:
aValueThe XPCOM object from which to set the complex preference value.
Returns:
NS_OK The value was successfully set.
Other The value was not set or is the wrong type.
See also:
getComplexValue
NS_IMETHODIMP nsPref::SetDefaultBoolPref ( const char *  pref,
PRBool  value 
) [inline]

Definition at line 110 of file nsPref.cpp.

                  { return mDefaultBranch->SetBoolPref(pref, value); }
void nsIPref::SetDefaultBoolPref ( in string  pref,
in boolean  value 
) [inherited]
NS_IMETHODIMP nsPref::SetDefaultCharPref ( const char *  pref,
const char *  value 
) [inline]

Definition at line 112 of file nsPref.cpp.

                  { return mDefaultBranch->SetCharPref(pref, value); }
void nsIPref::SetDefaultCharPref ( in string  pref,
in string  value 
) [inherited]
NS_IMETHODIMP nsPref::SetDefaultIntPref ( const char *  pref,
PRInt32  value 
) [inline]

Definition at line 114 of file nsPref.cpp.

                  { return mDefaultBranch->SetIntPref(pref, value); }
void nsIPref::SetDefaultIntPref ( in string  pref,
in long  value 
) [inherited]

Definition at line 457 of file nsPref.cpp.

{
  nsresult rv;

  nsCOMPtr<nsISupportsString> theString = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
  if (NS_SUCCEEDED(rv)) {
    theString->SetData(nsDependentString(value));
    rv = mDefaultBranch->SetComplexValue(pref, NS_GET_IID(nsISupportsString), theString);
  }
  return rv;
}

Here is the call graph for this function:

void nsIPref::SetDefaultUnicharPref ( in string  pref,
in wstring  value 
) [inherited]
NS_IMETHODIMP nsPref::SetFilePref ( const char *  pref,
nsIFileSpec value,
PRBool  setDefault 
)

Definition at line 513 of file nsPref.cpp.

{
#ifdef MOZ_NO_XPCOM_OBSOLETE
  return NS_ERROR_NOT_IMPLEMENTED;
#else
  nsresult  rv;

  if (setDefault) {
    rv = mDefaultBranch->SetComplexValue(pref, NS_GET_IID(nsIFileSpec), value);
  } else {
    nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
    if (NS_SUCCEEDED(rv))
      rv = prefBranch->SetComplexValue(pref, NS_GET_IID(nsIFileSpec), value);
  }
    return rv;
#endif
}

Here is the call graph for this function:

void nsIPref::SetFilePref ( in string  pref,
in nsIFileSpec  value,
in boolean  setDefault 
) [inherited]
NS_IMETHODIMP nsPref::SetFileXPref ( const char *  pref,
nsILocalFile value 
)

Definition at line 541 of file nsPref.cpp.

{
  nsresult rv;

  NS_ENSURE_ARG_POINTER(value);
  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
  if (NS_SUCCEEDED(rv))
    rv = prefBranch->SetComplexValue(pref, NS_GET_IID(nsILocalFile), value);
  return rv;
}

Here is the call graph for this function:

void nsIPref::setFileXPref ( in string  pref,
in nsILocalFile  value 
) [inherited]
void nsIPref::SetIntPref ( in string  aPrefName,
in long  aValue 
) [inherited]

Here is the caller graph for this function:

void nsIPrefBranch::setIntPref ( in string  aPrefName,
in long  aValue 
) [inherited]

Called to set the state of an individual integer preference.

Parameters:
aPrefNameThe integer preference to set the value of.
aValueThe integer value to set the preference to.
Returns:
NS_OK The value was successfully set.
Other The value was not set or is the wrong type.
See also:
getIntPref
NS_IMETHODIMP nsPref::SetUnicharPref ( const char *  pref,
const PRUnichar value 
)

Definition at line 442 of file nsPref.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);
  if (NS_SUCCEEDED(rv)) {
    nsCOMPtr<nsISupportsString> theString = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
    if (NS_SUCCEEDED(rv)) {
      theString->SetData(nsDependentString(value));
      rv = prefBranch->SetComplexValue(pref, NS_GET_IID(nsISupportsString), theString);
    }
  }
  return rv;
}

Here is the call graph for this function:

void nsIPref::SetUnicharPref ( in string  pref,
in wstring  value 
) [inherited]

Here is the caller graph for this function:

void nsIPref::unlockPref ( in string  aPrefName) [inherited]
void nsIPrefBranch::unlockPref ( in string  aPrefName) [inherited]

Called to unlock a specific preference.

Unlocking a previously locked preference allows the preference service to once again return the user set value of the preference.

Parameters:
aPrefNameThe preference to be unlocked.
Note:
This method can be called on either a default or user branch but, in effect, always operates on the default branch.
Returns:
NS_OK The preference was successfully unlocked.
Other The preference does not exist or an error occurred.
See also:
lockPref
NS_IMETHODIMP nsPref::UnregisterCallback ( const char *  domain,
PrefChangedFunc  callback,
void closure 
)

Definition at line 568 of file nsPref.cpp.

{
  return PREF_UnregisterCallback(domain, callback, instance_data);
}

Here is the call graph for this function:

void nsIPref::UnregisterCallback ( in string  domain,
in PrefChangedFunc  callback,
in voidPtr  closure 
) [inherited]

Here is the caller graph for this function:


Member Data Documentation

const long nsIPref::ePrefBool = 128 [inherited]

Definition at line 135 of file nsIPref.idl.

const long nsIPref::ePrefConfig = 4 [inherited]

Definition at line 130 of file nsIPref.idl.

const long nsIPref::ePrefInt = 64 [inherited]

Definition at line 134 of file nsIPref.idl.

const long nsIPref::ePrefInvalid = 0 [inherited]

Definition at line 127 of file nsIPref.idl.

const long nsIPref::ePrefLilocal = 16 [inherited]

Definition at line 132 of file nsIPref.idl.

const long nsIPref::ePrefLocked = 1 [inherited]

Definition at line 128 of file nsIPref.idl.

const long nsIPref::ePrefRemote = 8 [inherited]

Definition at line 131 of file nsIPref.idl.

const long nsIPref::ePrefString = 32 [inherited]

Definition at line 133 of file nsIPref.idl.

const long nsIPref::ePrefUserset = 2 [inherited]

Definition at line 129 of file nsIPref.idl.

Definition at line 136 of file nsIPref.idl.

nsPref * nsPref::gInstance = NULL [static, protected]

Definition at line 137 of file nsPref.cpp.

Definition at line 141 of file nsPref.cpp.

Definition at line 140 of file nsPref.cpp.

const long nsIPrefBranch::PREF_BOOL = 128 [inherited]

Definition at line 72 of file nsIPrefBranch.idl.

Definition at line 71 of file nsIPrefBranch.idl.

Values describing the basic preference types.

See also:
getPrefType

Definition at line 69 of file nsIPrefBranch.idl.

Definition at line 70 of file nsIPrefBranch.idl.

readonly attribute string nsIPrefBranch::root [inherited]

Called to get the root on which this branch is based, such as "browser.startup.".

Definition at line 78 of file nsIPrefBranch.idl.

readonly attribute string nsIPref::root [inherited]

Definition at line 141 of file nsIPref.idl.


The documentation for this class was generated from the following file: