Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
RDFServiceImpl Class Reference
Inheritance diagram for RDFServiceImpl:
Inheritance graph
[legend]
Collaboration diagram for RDFServiceImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIRDFSERVICE nsresult 
RegisterLiteral (nsIRDFLiteral *aLiteral)
nsresult UnregisterLiteral (nsIRDFLiteral *aLiteral)
nsresult RegisterInt (nsIRDFInt *aInt)
nsresult UnregisterInt (nsIRDFInt *aInt)
nsresult RegisterDate (nsIRDFDate *aDate)
nsresult UnregisterDate (nsIRDFDate *aDate)
nsresult RegisterBlob (BlobImpl *aBlob)
nsresult UnregisterBlob (BlobImpl *aBlob)
nsresult GetDataSource (const char *aURI, PRBool aBlock, nsIRDFDataSource **aDataSource)
nsIRDFResource GetResource (in AUTF8String aURI)
nsIRDFResource GetUnicodeResource (in AString aURI)
nsIRDFResource GetAnonymousResource ()
nsIRDFLiteral GetLiteral (in wstring aValue)
nsIRDFDate GetDateLiteral (in long long aValue)
nsIRDFInt GetIntLiteral (in long aValue)
nsIRDFBlob getBlobLiteral (in const_octet_ptr aValue, in long aLength)
boolean IsAnonymousResource (in nsIRDFResource aResource)
void RegisterResource (in nsIRDFResource aResource, in boolean aReplace)
void UnregisterResource (in nsIRDFResource aResource)
void RegisterDataSource (in nsIRDFDataSource aDataSource, in boolean aReplace)
void UnregisterDataSource (in nsIRDFDataSource aDataSource)
nsIRDFDataSource GetDataSource (in string aURI)
nsIRDFDataSource GetDataSourceBlocking (in string aURI)

Static Public Member Functions

static nsresult GetRDFService (nsIRDFService **result)

Protected Member Functions

 RDFServiceImpl ()
nsresult Init ()
virtual ~RDFServiceImpl ()

Protected Attributes

PLHashTablemNamedDataSources
PLDHashTable mResources
PLDHashTable mLiterals
PLDHashTable mInts
PLDHashTable mDates
PLDHashTable mBlobs
nsCAutoString mLastURIPrefix
nsCOMPtr< nsIFactorymLastFactory
nsCOMPtr< nsIFactorymDefaultResourceFactory

Detailed Description

Definition at line 112 of file nsRDFService.cpp.


Constructor & Destructor Documentation

Definition at line 875 of file nsRDFService.cpp.

Here is the caller graph for this function:

RDFServiceImpl::~RDFServiceImpl ( ) [protected, virtual]

Member Function Documentation

Here is the caller graph for this function:

nsIRDFBlob nsIRDFService::getBlobLiteral ( in const_octet_ptr  aValue,
in long  aLength 
) [inherited]

Here is the caller graph for this function:

nsresult RDFServiceImpl::GetDataSource ( const char *  aURI,
PRBool  aBlock,
nsIRDFDataSource **  aDataSource 
)

Definition at line 1481 of file nsRDFService.cpp.

{
    // Use the other GetDataSource and ask for a non-blocking Refresh.
    // If you wanted it loaded synchronously, then you should've tried to do it
    // yourself, or used GetDataSourceBlocking.
    return GetDataSource( aURI, PR_FALSE, aDataSource );
}

Here is the caller graph for this function:

Here is the caller graph for this function:

nsIRDFInt nsIRDFService::GetIntLiteral ( in long  aValue) [inherited]

Here is the caller graph for this function:

nsIRDFLiteral nsIRDFService::GetLiteral ( in wstring  aValue) [inherited]

Definition at line 958 of file nsRDFService.cpp.

{
    if (! gRDFService) {
        RDFServiceImpl* serv = new RDFServiceImpl();
        if (! serv)
            return NS_ERROR_OUT_OF_MEMORY;

        nsresult rv;
        rv = serv->Init();
        if (NS_FAILED(rv)) {
            delete serv;
            return rv;
        }

        gRDFService = serv;
    }

    NS_ADDREF(gRDFService);
    *mgr = gRDFService;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIRDFResource nsIRDFService::GetResource ( in AUTF8String  aURI) [inherited]
nsIRDFResource nsIRDFService::GetUnicodeResource ( in AString  aURI) [inherited]

Here is the caller graph for this function:

nsresult RDFServiceImpl::Init ( void  ) [protected]

Definition at line 886 of file nsRDFService.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1748 of file nsRDFService.cpp.

{
    NS_ASSERTION(PL_DHASH_ENTRY_IS_FREE(PL_DHashTableOperate(&mBlobs,
                                                             &aBlob->mData,
                                                             PL_DHASH_LOOKUP)),
                 "blob already registered");

    PLDHashEntryHdr *hdr = 
        PL_DHashTableOperate(&mBlobs, &aBlob->mData, PL_DHASH_ADD);

    if (! hdr)
        return NS_ERROR_OUT_OF_MEMORY;

    BlobHashEntry *entry = NS_STATIC_CAST(BlobHashEntry *, hdr);

    // N.B., we only hold a weak reference to the literal: that
    // way, the literal can be destroyed when the last refcount
    // goes away. The single addref that the CreateInt() call
    // made will be owned by the callee.
    entry->mBlob = aBlob;

    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv   register-blob [%p] %s",
            aBlob, aBlob->mData.mBytes));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRDFService::RegisterDataSource ( in nsIRDFDataSource  aDataSource,
in boolean  aReplace 
) [inherited]

Here is the caller graph for this function:

Definition at line 1692 of file nsRDFService.cpp.

{
    PRTime value;
    aDate->GetValue(&value);

    NS_ASSERTION(PL_DHASH_ENTRY_IS_FREE(PL_DHashTableOperate(&mDates,
                                                             &value,
                                                             PL_DHASH_LOOKUP)),
                 "date already registered");

    PLDHashEntryHdr *hdr =
        PL_DHashTableOperate(&mDates, &value, PL_DHASH_ADD);

    if (! hdr)
        return NS_ERROR_OUT_OF_MEMORY;

    DateHashEntry *entry = NS_STATIC_CAST(DateHashEntry *, hdr);

    // N.B., we only hold a weak reference to the literal: that
    // way, the literal can be destroyed when the last refcount
    // goes away. The single addref that the CreateDate() call
    // made will be owned by the callee.
    entry->mDate = aDate;
    entry->mKey = value;

    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv   register-date [%p] %ld",
            aDate, value));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1634 of file nsRDFService.cpp.

{
    PRInt32 value;
    aInt->GetValue(&value);

    NS_ASSERTION(PL_DHASH_ENTRY_IS_FREE(PL_DHashTableOperate(&mInts,
                                                             &value,
                                                             PL_DHASH_LOOKUP)),
                 "int already registered");

    PLDHashEntryHdr *hdr =
        PL_DHashTableOperate(&mInts, &value, PL_DHASH_ADD);

    if (! hdr)
        return NS_ERROR_OUT_OF_MEMORY;

    IntHashEntry *entry = NS_STATIC_CAST(IntHashEntry *, hdr);

    // N.B., we only hold a weak reference to the literal: that
    // way, the literal can be destroyed when the last refcount
    // goes away. The single addref that the CreateInt() call
    // made will be owned by the callee.
    entry->mInt = aInt;
    entry->mKey = value;

    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv   register-int [%p] %d",
            aInt, value));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1576 of file nsRDFService.cpp.

{
    const PRUnichar* value;
    aLiteral->GetValueConst(&value);

    NS_ASSERTION(PL_DHASH_ENTRY_IS_FREE(PL_DHashTableOperate(&mLiterals,
                                                             value,
                                                             PL_DHASH_LOOKUP)),
                 "literal already registered");

    PLDHashEntryHdr *hdr =
        PL_DHashTableOperate(&mLiterals, value, PL_DHASH_ADD);

    if (! hdr)
        return NS_ERROR_OUT_OF_MEMORY;

    LiteralHashEntry *entry = NS_STATIC_CAST(LiteralHashEntry *, hdr);

    // N.B., we only hold a weak reference to the literal: that
    // way, the literal can be destroyed when the last refcount
    // goes away. The single addref that the CreateLiteral() call
    // made will be owned by the callee.
    entry->mLiteral = aLiteral;
    entry->mKey = value;

    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv   register-literal [%p] %s",
            aLiteral, (const PRUnichar*) value));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRDFService::RegisterResource ( in nsIRDFResource  aResource,
in boolean  aReplace 
) [inherited]

Here is the caller graph for this function:

Definition at line 1777 of file nsRDFService.cpp.

{
    NS_ASSERTION(PL_DHASH_ENTRY_IS_BUSY(PL_DHashTableOperate(&mBlobs,
                                                             &aBlob->mData,
                                                             PL_DHASH_LOOKUP)),
                 "blob was never registered");

    PL_DHashTableOperate(&mBlobs, &aBlob->mData, PL_DHASH_REMOVE);
 
     // N.B. that we _don't_ release the literal: we only held a weak
     // reference to it in the hashtable.
    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv unregister-blob [%p] %s",
            aBlob, aBlob->mData.mBytes));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Definition at line 1726 of file nsRDFService.cpp.

{
    PRTime value;
    aDate->GetValue(&value);

    NS_ASSERTION(PL_DHASH_ENTRY_IS_BUSY(PL_DHashTableOperate(&mDates,
                                                             &value,
                                                             PL_DHASH_LOOKUP)),
                 "date was never registered");

    PL_DHashTableOperate(&mDates, &value, PL_DHASH_REMOVE);

    // N.B. that we _don't_ release the literal: we only held a weak
    // reference to it in the hashtable.
    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv unregister-date [%p] %ld",
            aDate, value));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1668 of file nsRDFService.cpp.

{
    PRInt32 value;
    aInt->GetValue(&value);

    NS_ASSERTION(PL_DHASH_ENTRY_IS_BUSY(PL_DHashTableOperate(&mInts,
                                                             &value,
                                                             PL_DHASH_LOOKUP)),
                 "int was never registered");

    PL_DHashTableOperate(&mInts, &value, PL_DHASH_REMOVE);

    // N.B. that we _don't_ release the literal: we only held a weak
    // reference to it in the hashtable.
    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv unregister-int [%p] %d",
            aInt, value));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1610 of file nsRDFService.cpp.

{
    const PRUnichar* value;
    aLiteral->GetValueConst(&value);

    NS_ASSERTION(PL_DHASH_ENTRY_IS_BUSY(PL_DHashTableOperate(&mLiterals,
                                                             value,
                                                             PL_DHASH_LOOKUP)),
                 "literal was never registered");

    PL_DHashTableOperate(&mLiterals, value, PL_DHASH_REMOVE);

    // N.B. that we _don't_ release the literal: we only held a weak
    // reference to it in the hashtable.
    PR_LOG(gLog, PR_LOG_DEBUG,
           ("rdfserv unregister-literal [%p] %s",
            aLiteral, (const PRUnichar*) value));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 121 of file nsRDFService.cpp.

Definition at line 120 of file nsRDFService.cpp.

Definition at line 125 of file nsRDFService.cpp.

Definition at line 119 of file nsRDFService.cpp.

Definition at line 124 of file nsRDFService.cpp.

Definition at line 123 of file nsRDFService.cpp.

Definition at line 118 of file nsRDFService.cpp.

Definition at line 116 of file nsRDFService.cpp.

Definition at line 117 of file nsRDFService.cpp.


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