Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
nsPersistentProperties Class Reference

#include <nsPersistentProperties.h>

Inheritance diagram for nsPersistentProperties:
Inheritance graph
[legend]
Collaboration diagram for nsPersistentProperties:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsPersistentProperties ()
nsresult Init ()
NS_DECL_ISUPPORTS
NS_DECL_NSIPROPERTIES
NS_DECL_NSIPERSISTENTPROPERTIES
PRInt32 
Read ()
PRInt32 SkipLine (PRInt32 c)
PRInt32 SkipWhiteSpace (PRInt32 c)
void load (in nsIInputStream input)
 load a set of name/value pairs from the input stream names and values should be in UTF8
void save (in nsIOutputStream output, in AUTF8String header)
 output the values to the stream - results will be in UTF8
void subclass (in nsIPersistentProperties superclass)
 call subclass() to make future calls to load() set the properties in this "superclass" instead
nsISimpleEnumerator enumerate ()
 get an enumeration of nsIPropertyElement objects, which are read-only (i.e.
AString getStringProperty (in AUTF8String key)
 shortcut to nsIProperty's get() which retrieves a string value directly (and thus faster)
AString setStringProperty (in AUTF8String key, in AString value)
 shortcut to nsIProperty's set() which sets a string value directly (and thus faster)
void get (in string prop, in nsIIDRef iid,[iid_is(iid), retval] out nsQIResult result)
 Gets a property with a given name.
void set (in string prop, in nsISupports value)
 Sets a property with a given name to a given value.
boolean has (in string prop)
 Returns true if the property with the given name exists.
void undefine (in string prop)
 Undefines a property.
void getKeys (out PRUint32 count,[array, size_is(count), retval] out string keys)
 Returns an array of the keys.

Static Public Member Functions

static NS_METHOD Create (nsISupports *aOuter, REFNSIID aIID, void **aResult)

Protected Attributes

nsIUnicharInputStreammIn
PRUint32 mBufferPos
PRUint32 mBufferLength
nsIPersistentPropertiesmSubclass
PLArenaPool mArena

Private Member Functions

 ~nsPersistentProperties ()

Detailed Description

Definition at line 49 of file nsPersistentProperties.h.


Constructor & Destructor Documentation

Definition at line 100 of file nsPersistentProperties.cpp.

: mIn(nsnull)
{
  mSubclass = NS_STATIC_CAST(nsIPersistentProperties*, this);
  mTable.ops = nsnull;
  PL_INIT_ARENA_POOL(&mArena, "PersistentPropertyArena", 2048);
}

Here is the caller graph for this function:

Definition at line 108 of file nsPersistentProperties.cpp.

{
  PL_FinishArenaPool(&mArena);
  if (mTable.ops)
    PL_DHashTableFinish(&mTable);
}

Here is the call graph for this function:


Member Function Documentation

NS_METHOD nsPersistentProperties::Create ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 127 of file nsPersistentProperties.cpp.

{
  if (aOuter)
    return NS_ERROR_NO_AGGREGATION;
  nsPersistentProperties* props = new nsPersistentProperties();
  if (props == nsnull)
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(props);
  nsresult rv = props->Init();
  if (NS_SUCCEEDED(rv))
    rv = props->QueryInterface(aIID, aResult);

  NS_RELEASE(props);
  return rv;
}

Here is the call graph for this function:

get an enumeration of nsIPropertyElement objects, which are read-only (i.e.

setting properties on the element will not make changes back into the source nsIPersistentProperties

void nsIProperties::get ( in string  prop,
in nsIIDRef  iid,
[iid_is(iid), retval] out nsQIResult  result 
) [inherited]

Gets a property with a given name.

Returns:
NS_ERROR_FAILURE if a property with that name doesn't exist.
NS_ERROR_NO_INTERFACE if the found property fails to QI to the given iid.

Here is the caller graph for this function:

void nsIProperties::getKeys ( out PRUint32  count,
[array, size_is(count), retval] out string  keys 
) [inherited]

Returns an array of the keys.

Here is the caller graph for this function:

AString nsIPersistentProperties::getStringProperty ( in AUTF8String  key) [inherited]

shortcut to nsIProperty's get() which retrieves a string value directly (and thus faster)

boolean nsIProperties::has ( in string  prop) [inherited]

Returns true if the property with the given name exists.

Here is the caller graph for this function:

Definition at line 116 of file nsPersistentProperties.cpp.

{
  if (!PL_DHashTableInit(&mTable, &property_HashTableOps, nsnull,
                         sizeof(PropertyTableEntry), 20)) {
    mTable.ops = nsnull;
    return NS_ERROR_OUT_OF_MEMORY;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

load a set of name/value pairs from the input stream names and values should be in UTF8

Definition at line 367 of file nsPersistentProperties.cpp.

{
  PRUnichar  c;
  PRUint32  nRead;
  nsresult  ret;

  ret = mIn->Read(&c, 1, &nRead);
  if (ret == NS_OK && nRead == 1) {
    return c;
  }

  return -1;
}

Here is the caller graph for this function:

void nsIPersistentProperties::save ( in nsIOutputStream  output,
in AUTF8String  header 
) [inherited]

output the values to the stream - results will be in UTF8

void nsIProperties::set ( in string  prop,
in nsISupports  value 
) [inherited]

Sets a property with a given name to a given value.

Here is the caller graph for this function:

AString nsIPersistentProperties::setStringProperty ( in AUTF8String  key,
in AString  value 
) [inherited]

shortcut to nsIProperty's set() which sets a string value directly (and thus faster)

Definition at line 395 of file nsPersistentProperties.cpp.

{
  while ((c >= 0) && (c != '\r') && (c != '\n')) {
    c = Read();
  }
  if (c == '\r') {
    c = Read();
  }
  if (c == '\n') {
    c = Read();
  }

  return c;
}

Here is the call graph for this function:

Definition at line 385 of file nsPersistentProperties.cpp.

{
  while (IS_WHITE_SPACE(c)) {
    c = Read();
  }

  return c;
}

Here is the call graph for this function:

call subclass() to make future calls to load() set the properties in this "superclass" instead

void nsIProperties::undefine ( in string  prop) [inherited]

Undefines a property.

Returns:
NS_ERROR_FAILURE if a property with that name doesn't already exist.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 77 of file nsPersistentProperties.h.

Definition at line 74 of file nsPersistentProperties.h.

Definition at line 73 of file nsPersistentProperties.h.

Definition at line 72 of file nsPersistentProperties.h.

Definition at line 75 of file nsPersistentProperties.h.


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