Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsVoidArray.cpp File Reference
#include "nsVoidArray.h"
#include "nsQuickSort.h"
#include "prmem.h"
#include "nsCRT.h"
#include "nsString.h"
#include "prbit.h"

Go to the source code of this file.

Classes

struct  VoidArrayComparatorContext

Defines

#define SIZEOF_IMPL(n_)   (sizeof(Impl) + sizeof(void *) * ((n_) - 1))
 Compute the number of bytes requires for the mImpl struct that will hold |n| elements.
#define CAPACITYOF_IMPL(n_)   ((((n_) - sizeof(Impl)) / sizeof(void *)) + 1)
 Compute the number of elements that an mImpl struct of |n| bytes will hold.

Functions

 VoidArrayComparator (const void *aElement1, const void *aElement2, void *aData)
 CompareString (const nsString *aString1, const nsString *aString2, void *)
 CompareCString (const nsCString *aCString1, const nsCString *aCString2, void *)
 CompareCStringIgnoreCase (const nsCString *aCString1, const nsCString *aCString2, void *)

Variables

static const PRInt32 kMinGrowArrayBy = 8
 Grow the array by at least this many elements at a time.
static const PRInt32 kMaxGrowArrayBy = 1024
static const PRInt32 kLinearThreshold = 24 * sizeof(void *)
 This is the threshold (in bytes) of the mImpl struct, past which we'll force the array to grow geometrically.

Class Documentation

struct VoidArrayComparatorContext

Definition at line 615 of file nsVoidArray.cpp.

Class Members
nsVoidArrayComparatorFunc mComparatorFunc
void * mData

Define Documentation

#define CAPACITYOF_IMPL (   n_)    ((((n_) - sizeof(Impl)) / sizeof(void *)) + 1)

Compute the number of elements that an mImpl struct of |n| bytes will hold.

Definition at line 67 of file nsVoidArray.cpp.

#define SIZEOF_IMPL (   n_)    (sizeof(Impl) + sizeof(void *) * ((n_) - 1))

Compute the number of bytes requires for the mImpl struct that will hold |n| elements.

Definition at line 60 of file nsVoidArray.cpp.


Function Documentation

CompareCString ( const nsCString aCString1,
const nsCString aCString2,
void  
)

Definition at line 1086 of file nsVoidArray.cpp.

{
  return Compare(*aCString1, *aCString2);
}

Here is the call graph for this function:

CompareCStringIgnoreCase ( const nsCString aCString1,
const nsCString aCString2,
void  
)

Definition at line 1092 of file nsVoidArray.cpp.

{
  return Compare(*aCString1, *aCString2, nsCaseInsensitiveCStringComparator());
}

Here is the call graph for this function:

CompareString ( const nsString aString1,
const nsString aString2,
void  
)

Definition at line 851 of file nsVoidArray.cpp.

{
  return Compare(*aString1, *aString2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

VoidArrayComparator ( const void aElement1,
const void aElement2,
void aData 
)

Definition at line 621 of file nsVoidArray.cpp.

{
  VoidArrayComparatorContext* ctx = NS_STATIC_CAST(VoidArrayComparatorContext*, aData);
  return (*ctx->mComparatorFunc)(*NS_STATIC_CAST(void* const*, aElement1),
                                 *NS_STATIC_CAST(void* const*, aElement2),
                                  ctx->mData);
}

Variable Documentation

const PRInt32 kLinearThreshold = 24 * sizeof(void *) [static]

This is the threshold (in bytes) of the mImpl struct, past which we'll force the array to grow geometrically.

Definition at line 54 of file nsVoidArray.cpp.

const PRInt32 kMaxGrowArrayBy = 1024 [static]

Definition at line 48 of file nsVoidArray.cpp.

Grow the array by at least this many elements at a time.

Definition at line 47 of file nsVoidArray.cpp.