Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Types | Private Attributes
ParamAccumulator Class Reference
Collaboration diagram for ParamAccumulator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

PRUint16 GetCount () const
XPTParamDescriptorGetArray ()
void Clear ()
XPTParamDescriptorGetNextParam ()
 ParamAccumulator ()
 ~ParamAccumulator ()

Private Types

enum  { MAX_BUILTIN = 8, ALLOCATION_INCREMENT = 16, MAX_TOTAL = 255 }

Private Attributes

PRUint16 mCount
PRUint16 mAvailable
XPTParamDescriptormArray
XPTParamDescriptor mBuiltinSpace [MAX_BUILTIN]

Detailed Description

Definition at line 80 of file wspinfoservice.cpp.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
MAX_BUILTIN 
ALLOCATION_INCREMENT 
MAX_TOTAL 

Definition at line 83 of file wspinfoservice.cpp.

       {
    MAX_BUILTIN = 8,
    ALLOCATION_INCREMENT = 16,
    MAX_TOTAL = 255
  }; // The typelib format limits us to 255 params.

Constructor & Destructor Documentation

Definition at line 105 of file wspinfoservice.cpp.

Definition at line 110 of file wspinfoservice.cpp.

  {
    if(mArray != mBuiltinSpace)
      delete [] mArray;
  }

Member Function Documentation

Definition at line 98 of file wspinfoservice.cpp.

  {
    mCount = 0;
  }

Definition at line 94 of file wspinfoservice.cpp.

  {
    return mArray;
  }

Here is the caller graph for this function:

Definition at line 90 of file wspinfoservice.cpp.

  {
    return mCount;
  }

Here is the caller graph for this function:

Definition at line 123 of file wspinfoservice.cpp.

{
  if (mCount == MAX_TOTAL) {
    NS_WARNING("Too many params!");
    return nsnull;
  }
  if (mCount == mAvailable) {
    PRUint16 newAvailable = mAvailable + ALLOCATION_INCREMENT;
    XPTParamDescriptor* newArray = new XPTParamDescriptor[newAvailable];
    if (!newArray) {
      return nsnull;
    }

    memcpy(newArray, mArray, newAvailable * sizeof(XPTParamDescriptor));

    if (mArray != mBuiltinSpace) {
      // The old array was heap allocated, delete so that we don't
      // leak it.
      delete [] mArray;
    }

    mArray = newArray;
    mAvailable = newAvailable;
  }

  XPTParamDescriptor* p = &mArray[mCount++];
  memset(p, 0, sizeof(XPTParamDescriptor));
  return p; 
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 118 of file wspinfoservice.cpp.

Definition at line 117 of file wspinfoservice.cpp.

Definition at line 119 of file wspinfoservice.cpp.

Definition at line 116 of file wspinfoservice.cpp.


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