Classes | Public Member Functions | Static Protected Member Functions | Protected Attributes

mozilla::FramePropertyTable Class Reference

The FramePropertyTable is optimized for storing 0 or 1 properties on a given frame. More...

#include <FramePropertyTable.h>

Collaboration diagram for mozilla::FramePropertyTable:

List of all members.

Classes

class  Entry
 Our hashtable entry. More...
class  PropertyComparator
 Used with an array of PropertyValues to allow lookups that compare only on the FramePropertyDescriptor. More...
struct  PropertyValue
 Stores a property descriptor/value pair. More...

Public Member Functions

 FramePropertyTable ()
 ~FramePropertyTable ()
void Set (nsIFrame *aFrame, const FramePropertyDescriptor *aProperty, void *aValue)
 Set a property value on a frame.
void * Get (const nsIFrame *aFrame, const FramePropertyDescriptor *aProperty, PRBool *aFoundResult=0L)
 Get a property value for a frame.
void * Remove (nsIFrame *aFrame, const FramePropertyDescriptor *aProperty, PRBool *aFoundResult=0L)
 Remove a property value for a frame.
void Delete (nsIFrame *aFrame, const FramePropertyDescriptor *aProperty)
 Remove and destroy a property value for a frame.
void DeleteAllFor (nsIFrame *aFrame)
 Remove and destroy all property values for a frame.
void DeleteAll ()
 Remove and destroy all property values for all frames.

Static Protected Member Functions

static void DeleteAllForEntry (Entry *aEntry)
static PLDHashOperator DeleteEnumerator (Entry *aEntry, void *aArg)

Protected Attributes

nsTHashtable< EntrymEntries
nsIFrame * mLastFrame
EntrymLastEntry

Detailed Description

The FramePropertyTable is optimized for storing 0 or 1 properties on a given frame.

Storing very large numbers of properties on a single frame will not be efficient.

Property values are passed as void* but do not actually have to be valid pointers. You can use NS_INT32_TO_PTR/NS_PTR_TO_INT32 to store PRInt32 values. Null/zero values can be stored and retrieved. Of course, the destructor function (if any) must handle such values correctly.


Constructor & Destructor Documentation

mozilla::FramePropertyTable::FramePropertyTable (  )  [inline]
mozilla::FramePropertyTable::~FramePropertyTable (  )  [inline]

Member Function Documentation

void mozilla::FramePropertyTable::Delete ( nsIFrame *  aFrame,
const FramePropertyDescriptor aProperty 
)

Remove and destroy a property value for a frame.

This requires one hashtable lookup (using the frame as the key) and a linear search through the properties of that frame. If the frame has no such property, nothing happens.

void mozilla::FramePropertyTable::DeleteAll (  ) 

Remove and destroy all property values for all frames.

void mozilla::FramePropertyTable::DeleteAllFor ( nsIFrame *  aFrame  ) 

Remove and destroy all property values for a frame.

This requires one hashtable lookup (using the frame as the key).

static void mozilla::FramePropertyTable::DeleteAllForEntry ( Entry aEntry  )  [static, protected]
static PLDHashOperator mozilla::FramePropertyTable::DeleteEnumerator ( Entry aEntry,
void *  aArg 
) [static, protected]
void* mozilla::FramePropertyTable::Get ( const nsIFrame *  aFrame,
const FramePropertyDescriptor aProperty,
PRBool aFoundResult = 0L 
)

Get a property value for a frame.

This requires one hashtable lookup (using the frame as the key) and a linear search through the properties of that frame. If the frame has no such property, returns null.

Parameters:
aFoundResult if non-null, receives a value 'true' iff the frame has a value for the property. This lets callers disambiguate a null result, which can mean 'no such property' or 'property value is null'.
void* mozilla::FramePropertyTable::Remove ( nsIFrame *  aFrame,
const FramePropertyDescriptor aProperty,
PRBool aFoundResult = 0L 
)

Remove a property value for a frame.

This requires one hashtable lookup (using the frame as the key) and a linear search through the properties of that frame. The old property value is returned (and not destroyed). If the frame has no such property, returns null.

Parameters:
aFoundResult if non-null, receives a value 'true' iff the frame had a value for the property. This lets callers disambiguate a null result, which can mean 'no such property' or 'property value is null'.
void mozilla::FramePropertyTable::Set ( nsIFrame *  aFrame,
const FramePropertyDescriptor aProperty,
void *  aValue 
)

Set a property value on a frame.

This requires one hashtable lookup (using the frame as the key) and a linear search through the properties of that frame. Any existing value for the property is destroyed.


Member Data Documentation


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