Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Protected Member Functions | Protected Attributes
nsTemplateMap Class Reference

#include <nsTemplateMap.h>

List of all members.

Classes

struct  Entry

Public Member Functions

 nsTemplateMap ()
 ~nsTemplateMap ()
void Put (nsIContent *aContent, nsIContent *aTemplate)
void Remove (nsIContent *aContent)
void GetTemplateFor (nsIContent *aContent, nsIContent **aResult)
void Clear ()

Protected Member Functions

void Init ()
void Finish ()

Protected Attributes

PLDHashTable mTable

Detailed Description

Definition at line 45 of file nsTemplateMap.h.


Class Documentation

struct nsTemplateMap::Entry

Definition at line 47 of file nsTemplateMap.h.

Collaboration diagram for nsTemplateMap::Entry:
Class Members
nsIContent * mContent
PLDHashEntryHdr mHdr
nsIContent * mTemplate

Constructor & Destructor Documentation

Definition at line 62 of file nsTemplateMap.h.

{ Init(); }

Here is the call graph for this function:

Definition at line 64 of file nsTemplateMap.h.

{ Finish(); }

Here is the call graph for this function:


Member Function Documentation

void nsTemplateMap::Clear ( ) [inline]

Definition at line 119 of file nsTemplateMap.h.

{ Finish(); Init(); }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTemplateMap::Finish ( ) [inline, protected]

Definition at line 59 of file nsTemplateMap.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTemplateMap::GetTemplateFor ( nsIContent aContent,
nsIContent **  aResult 
) [inline]

Definition at line 108 of file nsTemplateMap.h.

                                                               {
        Entry* entry =
            NS_REINTERPRET_CAST(Entry*, PL_DHashTableOperate(&mTable, aContent, PL_DHASH_LOOKUP));

        if (PL_DHASH_ENTRY_IS_BUSY(&entry->mHdr))
            NS_IF_ADDREF(*aResult = entry->mTemplate);
        else
            *aResult = nsnull;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTemplateMap::Init ( void  ) [inline, protected]

Definition at line 56 of file nsTemplateMap.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTemplateMap::Put ( nsIContent aContent,
nsIContent aTemplate 
) [inline]

Definition at line 67 of file nsTemplateMap.h.

                                                     {
        NS_ASSERTION(PL_DHASH_ENTRY_IS_FREE(PL_DHashTableOperate(&mTable, aContent, PL_DHASH_LOOKUP)),
                     "aContent already in map");

        Entry* entry =
            NS_REINTERPRET_CAST(Entry*, PL_DHashTableOperate(&mTable, aContent, PL_DHASH_ADD));

        if (entry) {
            entry->mContent = aContent;
            entry->mTemplate = aTemplate;
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsTemplateMap::Remove ( nsIContent aContent) [inline]

Definition at line 81 of file nsTemplateMap.h.

                                 {
        NS_ASSERTION(PL_DHASH_ENTRY_IS_BUSY(PL_DHashTableOperate(&mTable, aContent, PL_DHASH_LOOKUP)),
                     "aContent not in map");

        PL_DHashTableOperate(&mTable, aContent, PL_DHASH_REMOVE);

        PRUint32 count;

        // If possible, use the special nsXULElement interface to
        // "peek" at the child count without accidentally creating
        // children as a side effect, since we're about to rip 'em
        // outta the map anyway.
        nsXULElement *xulcontent = nsXULElement::FromContent(aContent);
        if (xulcontent) {
            count = xulcontent->PeekChildCount();
        }
        else {
            count = aContent->GetChildCount();
        }

        for (PRUint32 i = 0; i < count; ++i) {
            Remove(aContent->GetChildAt(i));
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 53 of file nsTemplateMap.h.


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