Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions | Public Attributes | Static Public Attributes
NativeSetMap::Entry Struct Reference

#include <xpcmaps.h>

Inheritance diagram for NativeSetMap::Entry:
Inheritance graph
Collaboration diagram for NativeSetMap::Entry:
Collaboration graph

List of all members.

Static Public Member Functions

static JSBool JS_DLL_CALLBACK Match (JSDHashTable *table, const JSDHashEntryHdr *entry, const void *key)

Public Attributes

JSDHashNumber keyHash

Static Public Attributes

static struct JSDHashTableOps

Detailed Description

Definition at line 449 of file xpcmaps.h.

Member Function Documentation

Definition at line 332 of file xpcmaps.cpp.

    XPCNativeSetKey* Key = (XPCNativeSetKey*) key;

    // See the comment in the XPCNativeSetKey declaration in xpcprivate.h.
        XPCNativeSet* Set1 = (XPCNativeSet*) key;
        XPCNativeSet* Set2 = ((Entry*)entry)->key_value;

        if(Set1 == Set2)
            return JS_TRUE;

        PRUint16 count = Set1->GetInterfaceCount();
        if(count != Set2->GetInterfaceCount())
            return JS_FALSE;

        XPCNativeInterface** Current1 = Set1->GetInterfaceArray();
        XPCNativeInterface** Current2 = Set2->GetInterfaceArray();
        for(PRUint16 i = 0; i < count; i++)
            if(*(Current1++) != *(Current2++))
                return JS_FALSE;

        return JS_TRUE;

    XPCNativeSet*       SetInTable = ((Entry*)entry)->key_value;
    XPCNativeSet*       Set        = Key->GetBaseSet();
    XPCNativeInterface* Addition   = Key->GetAddition();

        // This is a special case to deal with the invariant that says:
        // "All sets have exactly one nsISupports interface and it comes first."
        // See XPCNativeSet::NewInstance for details.
        // Though we might have a key that represents only one interface, we
        // know that if that one interface were contructed into a set then
        // it would end up really being a set with two interfaces (except for
        // the case where the one interface happened to be nsISupports).

        return ((SetInTable->GetInterfaceCount() == 1 &&
                 SetInTable->GetInterfaceAt(0) == Addition) ||
                (SetInTable->GetInterfaceCount() == 2 &&
                 SetInTable->GetInterfaceAt(1) == Addition));

    if(!Addition && Set == SetInTable)
        return JS_TRUE;

    PRUint16 count = Set->GetInterfaceCount() + (Addition ? 1 : 0);
    if(count != SetInTable->GetInterfaceCount())
        return JS_FALSE;

    PRUint16 Position = Key->GetPosition();
    XPCNativeInterface** CurrentInTable = SetInTable->GetInterfaceArray();
    XPCNativeInterface** Current = Set->GetInterfaceArray();
    for(PRUint16 i = 0; i < count; i++)
        if(Addition && i == Position)
            if(Addition != *(CurrentInTable++))
                return JS_FALSE;
            if(*(Current++) != *(CurrentInTable++))
                return JS_FALSE;

    return JS_TRUE;

Here is the call graph for this function:

Member Data Documentation

Definition at line 458 of file xpcmaps.h.

Definition at line 451 of file xpcmaps.h.

Definition at line 114 of file jsdhash.h.

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