Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
InMemoryAssertionEnumeratorImpl Class Reference

InMemoryAssertionEnumeratorImpl. More...

Inheritance diagram for InMemoryAssertionEnumeratorImpl:
Inheritance graph
[legend]
Collaboration diagram for InMemoryAssertionEnumeratorImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

boolean hasMoreElements ()
 Called to determine whether or not the enumerator has any elements that can be returned via getNext().
nsISupports getNext ()
 Called to retrieve the next element in the enumerator.

Static Public Member Functions

static
InMemoryAssertionEnumeratorImpl
Create (InMemoryDataSource *aDataSource, nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue)
static void Destroy (InMemoryAssertionEnumeratorImpl *aEnumerator)

Private Member Functions

 InMemoryAssertionEnumeratorImpl (InMemoryDataSource *aDataSource, nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue)
virtual ~InMemoryAssertionEnumeratorImpl ()

Static Private Member Functions

static voidoperator new (size_t) CPP_THROW_NEW
static void operator delete (void *, size_t)

Private Attributes

InMemoryDataSourcemDataSource
nsIRDFResourcemSource
nsIRDFResourcemProperty
nsIRDFNodemTarget
nsIRDFNodemValue
PRInt32 mCount
PRBool mTruthValue
AssertionmNextAssertion
nsCOMPtr< nsISupportsArraymHashArcs

Detailed Description

InMemoryAssertionEnumeratorImpl.

Definition at line 440 of file nsInMemoryDataSource.cpp.


Constructor & Destructor Documentation

InMemoryAssertionEnumeratorImpl::InMemoryAssertionEnumeratorImpl ( InMemoryDataSource aDataSource,
nsIRDFResource aSource,
nsIRDFResource aProperty,
nsIRDFNode aTarget,
PRBool  aTruthValue 
) [private]

Definition at line 502 of file nsInMemoryDataSource.cpp.

    : mDataSource(aDataSource),
      mSource(aSource),
      mProperty(aProperty),
      mTarget(aTarget),
      mValue(nsnull),
      mCount(0),
      mTruthValue(aTruthValue),
      mNextAssertion(nsnull)
{
    NS_ADDREF(mDataSource);
    NS_IF_ADDREF(mSource);
    NS_ADDREF(mProperty);
    NS_IF_ADDREF(mTarget);

    if (mSource) {
        mNextAssertion = mDataSource->GetForwardArcs(mSource);

        if (mNextAssertion && mNextAssertion->mHashEntry) {
            // its our magical HASH_ENTRY forward hash for assertions
            PLDHashEntryHdr* hdr = PL_DHashTableOperate(mNextAssertion->u.hash.mPropertyHash,
                aProperty, PL_DHASH_LOOKUP);
            mNextAssertion = PL_DHASH_ENTRY_IS_BUSY(hdr)
                ? NS_REINTERPRET_CAST(Entry*, hdr)->mAssertions
                : nsnull;
        }
    }
    else {
        mNextAssertion = mDataSource->GetReverseArcs(mTarget);
    }

    // Add an owning reference from the enumerator
    if (mNextAssertion)
        mNextAssertion->AddRef();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 543 of file nsInMemoryDataSource.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

static InMemoryAssertionEnumeratorImpl* InMemoryAssertionEnumeratorImpl::Create ( InMemoryDataSource aDataSource,
nsIRDFResource aSource,
nsIRDFResource aProperty,
nsIRDFNode aTarget,
PRBool  aTruthValue 
) [inline, static]

Definition at line 468 of file nsInMemoryDataSource.cpp.

                               {
        void* place = aDataSource->mAllocator.Alloc(sizeof(InMemoryAssertionEnumeratorImpl));
        return place
            ? ::new (place) InMemoryAssertionEnumeratorImpl(aDataSource,
                                                            aSource, aProperty, aTarget,
                                                            aTruthValue)
            : nsnull; }

Here is the call graph for this function:

Definition at line 481 of file nsInMemoryDataSource.cpp.

                                                          {
        // Keep the datasource alive for the duration of the stack
        // frame so its allocator stays valid.
        nsCOMPtr<nsIRDFDataSource> kungFuDeathGrip = aEnumerator->mDataSource;

        // Grab the pool from the datasource; since we keep the
        // datasource alive, this has to be safe.
        nsFixedSizeAllocator& pool = aEnumerator->mDataSource->mAllocator;
        aEnumerator->~InMemoryAssertionEnumeratorImpl();
        pool.Free(aEnumerator, sizeof(*aEnumerator)); }

Here is the call graph for this function:

nsISupports nsISimpleEnumerator::getNext ( ) [inherited]

Called to retrieve the next element in the enumerator.

The "next" element is the first element upon the first call. Must be pre-ceeded by a call to hasMoreElements() which returns PR_TRUE. This method is generally called within a loop to iterate over the elements in the enumerator.

See also:
hasMoreElements()
Returns:
NS_OK if the call succeeded in returning a non-null value through the out parameter. NS_ERROR_FAILURE if there are no more elements to enumerate.
the next element in the enumeration.

Here is the caller graph for this function:

Called to determine whether or not the enumerator has any elements that can be returned via getNext().

This method is generally used to determine whether or not to initiate or continue iteration over the enumerator, though it can be called without subsequent getNext() calls. Does not affect internal state of enumerator.

See also:
getNext()
Returns:
PR_TRUE if there are remaining elements in the enumerator. PR_FALSE if there are no more elements in the enumerator.

Here is the caller graph for this function:

static void InMemoryAssertionEnumeratorImpl::operator delete ( void ,
size_t   
) [inline, static, private]

Definition at line 456 of file nsInMemoryDataSource.cpp.

{}
static void* InMemoryAssertionEnumeratorImpl::operator new ( size_t  ) [inline, static, private]

Definition at line 455 of file nsInMemoryDataSource.cpp.

{ return 0; }

Member Data Documentation

Definition at line 448 of file nsInMemoryDataSource.cpp.

Definition at line 443 of file nsInMemoryDataSource.cpp.

Definition at line 451 of file nsInMemoryDataSource.cpp.

Definition at line 450 of file nsInMemoryDataSource.cpp.

Definition at line 445 of file nsInMemoryDataSource.cpp.

Definition at line 444 of file nsInMemoryDataSource.cpp.

Definition at line 446 of file nsInMemoryDataSource.cpp.

Definition at line 449 of file nsInMemoryDataSource.cpp.

Definition at line 447 of file nsInMemoryDataSource.cpp.


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