Back to index

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

#include <txExecutionState.h>

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

List of all members.

Public Types

typedef
txLoadedDocumentEntry::KeyType 
KeyType
 KeyType is typedef'ed for ease of use.
typedef
txLoadedDocumentEntry::KeyTypePointer 
KeyTypePointer
 KeyTypePointer is typedef'ed for ease of use.
typedef PLDHashOperator(* PR_CALLBACK )(txLoadedDocumentEntry *aEntry, void *userArg)
 client must provide an Enumerator function for EnumerateEntries

Public Member Functions

 ~txLoadedDocumentsHash ()
nsresult init (txXPathNode *aSourceDocument)
PRBool Init (PRUint32 initSize=PL_DHASH_MIN_SIZE)
 Initialize the table.
PRBool IsInitialized () const
 Check whether the table has been initialized.
PRUint32 Count () const
 Return the number of entries in the table.
txLoadedDocumentEntryGetEntry (KeyType aKey) const
 Get the entry associated with a key.
txLoadedDocumentEntryPutEntry (KeyType aKey)
 Get the entry associated with a key, or create a new entry,.
void RemoveEntry (KeyType aKey)
 Remove the entry associated with a key.
void RawRemoveEntry (txLoadedDocumentEntry *aEntry)
 Remove the entry associated with a key, but don't resize the hashtable.
PRUint32 EnumerateEntries (Enumerator enumFunc, void *userArg)
 Enumerate all the entries of the function.
void Clear ()
 remove all entries, return hashtable to "pristine" state ;)

Static Protected Member Functions

static const void *PR_CALLBACK s_GetKey (PLDHashTable *table, PLDHashEntryHdr *entry)
static PLDHashNumber PR_CALLBACK s_HashKey (PLDHashTable *table, const void *key)
static PRBool PR_CALLBACK s_MatchEntry (PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key)
static void PR_CALLBACK s_CopyEntry (PLDHashTable *table, const PLDHashEntryHdr *from, PLDHashEntryHdr *to)
static void PR_CALLBACK s_ClearEntry (PLDHashTable *table, PLDHashEntryHdr *entry)
static PRBool PR_CALLBACK s_InitEntry (PLDHashTable *table, PLDHashEntryHdr *entry, const void *key)
static PLDHashOperator PR_CALLBACK s_EnumStub (PLDHashTable *table, PLDHashEntryHdr *entry, PRUint32 number, void *arg)

Protected Attributes

PLDHashTable mTable

Private Attributes

txXPathNodemSourceDocument

Friends

class txExecutionState

Detailed Description

Definition at line 80 of file txExecutionState.h.


Member Typedef Documentation

KeyType is typedef'ed for ease of use.

Definition at line 139 of file nsTHashtable.h.

KeyTypePointer is typedef'ed for ease of use.

Definition at line 144 of file nsTHashtable.h.

client must provide an Enumerator function for EnumerateEntries

Parameters:
aEntrythe entry being enumerated
userArgpassed unchanged from EnumerateEntries
Returns:
combination of flags PL_DHASH_NEXT , PL_DHASH_STOP , PL_DHASH_REMOVE

Definition at line 224 of file nsTHashtable.h.


Constructor & Destructor Documentation

Definition at line 72 of file txExecutionState.cpp.

{
    if (!IsInitialized()) {
        return;
    }

    nsAutoString baseURI;
    txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI);

    txLoadedDocumentEntry* entry = GetEntry(baseURI);
    if (entry) {
        delete entry->mDocument.forget();
    }
}

Here is the call graph for this function:


Member Function Documentation

void nsTHashtable< txLoadedDocumentEntry >::Clear ( void  ) [inline, inherited]

remove all entries, return hashtable to "pristine" state ;)

Definition at line 244 of file nsTHashtable.h.

  {
    NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");

    PL_DHashTableEnumerate(&mTable, PL_DHashStubEnumRemove, nsnull);
  }
PRUint32 nsTHashtable< txLoadedDocumentEntry >::Count ( void  ) const [inline, inherited]

Return the number of entries in the table.

Returns:
number of entries

Definition at line 150 of file nsTHashtable.h.

{ return mTable.entryCount; }
PRUint32 nsTHashtable< txLoadedDocumentEntry >::EnumerateEntries ( Enumerator  enumFunc,
void userArg 
) [inline, inherited]

Enumerate all the entries of the function.

Parameters:
enumFuncthe Enumerator function to call
userArga pointer to pass to the Enumerator function
Returns:
the number of entries actually enumerated

Definition at line 233 of file nsTHashtable.h.

  {
    NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
    
    s_EnumArgs args = { enumFunc, userArg };
    return PL_DHashTableEnumerate(&mTable, s_EnumStub, &args);
  }
txLoadedDocumentEntry * nsTHashtable< txLoadedDocumentEntry >::GetEntry ( KeyType  aKey) const [inline, inherited]

Get the entry associated with a key.

Parameters:
aKeythe key to retrieve
Returns:
pointer to the entry class, if the key exists; nsnull if the key doesn't exist

Definition at line 158 of file nsTHashtable.h.

  {
    NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
  
    EntryType* entry =
      NS_REINTERPRET_CAST(EntryType*,
                          PL_DHashTableOperate(
                            NS_CONST_CAST(PLDHashTable*,&mTable),
                            EntryType::KeyToPointer(aKey),
                            PL_DHASH_LOOKUP));
    return PL_DHASH_ENTRY_IS_BUSY(entry) ? entry : nsnull;
  }

Here is the caller graph for this function:

Definition at line 52 of file txExecutionState.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Initialize the table.

This function must be called before any other class operations. This can fail due to OOM conditions.

Parameters:
initSizethe initial number of buckets in the hashtable, default 16
Returns:
PR_TRUE if the class was initialized properly.

Here is the caller graph for this function:

PRBool nsTHashtable< txLoadedDocumentEntry >::IsInitialized ( ) const [inline, inherited]

Check whether the table has been initialized.

This can be useful for static hashtables.

Returns:
the initialization state of the class.

Definition at line 134 of file nsTHashtable.h.

{ return mTable.entrySize; }

Here is the caller graph for this function:

Get the entry associated with a key, or create a new entry,.

Parameters:
aKeythe key to retrieve
Returns:
pointer to the entry class retreived; nsnull only if memory can't be allocated

Definition at line 177 of file nsTHashtable.h.

  {
    NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
    
    return NS_STATIC_CAST(EntryType*,
                          PL_DHashTableOperate(
                            &mTable,
                            EntryType::KeyToPointer(aKey),
                            PL_DHASH_ADD));
  }

Here is the caller graph for this function:

Remove the entry associated with a key, but don't resize the hashtable.

This is a low-level method, and is not recommended unless you know what you're doing and you need the extra performance. This method can be used during enumeration, while RemoveEntry() cannot.

Parameters:
aEntrythe entry-pointer to remove (obtained from GetEntry or the enumerator

Definition at line 209 of file nsTHashtable.h.

void nsTHashtable< txLoadedDocumentEntry >::RemoveEntry ( KeyType  aKey) [inline, inherited]

Remove the entry associated with a key.

Parameters:
aKeyof the entry to remove

Definition at line 192 of file nsTHashtable.h.

  {
    NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");

    PL_DHashTableOperate(&mTable,
                         EntryType::KeyToPointer(aKey),
                         PL_DHASH_REMOVE);
  }
static void PR_CALLBACK nsTHashtable< txLoadedDocumentEntry >::s_ClearEntry ( PLDHashTable table,
PLDHashEntryHdr entry 
) [static, protected, inherited]
static void PR_CALLBACK nsTHashtable< txLoadedDocumentEntry >::s_CopyEntry ( PLDHashTable table,
const PLDHashEntryHdr from,
PLDHashEntryHdr to 
) [static, protected, inherited]
static PLDHashOperator PR_CALLBACK nsTHashtable< txLoadedDocumentEntry >::s_EnumStub ( PLDHashTable table,
PLDHashEntryHdr entry,
PRUint32  number,
void arg 
) [static, protected, inherited]
static const void* PR_CALLBACK nsTHashtable< txLoadedDocumentEntry >::s_GetKey ( PLDHashTable table,
PLDHashEntryHdr entry 
) [static, protected, inherited]
static PLDHashNumber PR_CALLBACK nsTHashtable< txLoadedDocumentEntry >::s_HashKey ( PLDHashTable table,
const void key 
) [static, protected, inherited]
static PRBool PR_CALLBACK nsTHashtable< txLoadedDocumentEntry >::s_InitEntry ( PLDHashTable table,
PLDHashEntryHdr entry,
const void key 
) [static, protected, inherited]
static PRBool PR_CALLBACK nsTHashtable< txLoadedDocumentEntry >::s_MatchEntry ( PLDHashTable table,
const PLDHashEntryHdr entry,
const void key 
) [static, protected, inherited]

Friends And Related Function Documentation

friend class txExecutionState [friend]

Definition at line 87 of file txExecutionState.h.


Member Data Documentation

Definition at line 88 of file txExecutionState.h.

Definition at line 252 of file nsTHashtable.h.


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