Back to index

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

List of all members.

Public Member Functions

boolean IsOrdinalProperty (in nsIRDFResource aProperty)
 Returns 'true' if the property is an RDF ordinal property.
nsIRDFResource IndexToOrdinalResource (in long aIndex)
 Convert the specified index to an ordinal property.
long OrdinalResourceToIndex (in nsIRDFResource aOrdinal)
 Convert the specified ordinal property into an index.
boolean IsContainer (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Return 'true' if the specified resource is a container.
boolean IsEmpty (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Return 'true' if the specified resource is a container and it is empty.
boolean IsBag (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Return 'true' if the specified resource is a bag.
boolean IsSeq (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Return 'true' if the specified resource is a sequence.
boolean IsAlt (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Return 'true' if the specified resource is an alternation.
nsIRDFContainer MakeBag (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Decorates the specified resource appropriately to make it usable as an empty bag in the specified data source.
nsIRDFContainer MakeSeq (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Decorates the specified resource appropriately to make it usable as an empty sequence in the specified data source.
nsIRDFContainer MakeAlt (in nsIRDFDataSource aDataSource, in nsIRDFResource aResource)
 Decorates the specified resource appropriately to make it usable as an empty alternation in the specified data source.
long indexOf (in nsIRDFDataSource aDataSource, in nsIRDFResource aContainer, in nsIRDFNode aElement)
 Retrieve the index of element in the container.

Private Member Functions

 RDFContainerUtilsImpl ()
virtual ~RDFContainerUtilsImpl ()
nsresult MakeContainer (nsIRDFDataSource *aDataSource, nsIRDFResource *aResource, nsIRDFResource *aType, nsIRDFContainer **aResult)
PRBool IsA (nsIRDFDataSource *aDataSource, nsIRDFResource *aResource, nsIRDFResource *aType)

Static Private Attributes

static PRInt32 gRefCnt = 0
static nsIRDFServicegRDFService
static nsIRDFResourcekRDF_instanceOf
static nsIRDFResourcekRDF_nextVal
static nsIRDFResourcekRDF_Bag
static nsIRDFResourcekRDF_Seq
static nsIRDFResourcekRDF_Alt
static nsIRDFLiteralkOne

Friends

nsresult NS_NewRDFContainerUtils (nsIRDFContainerUtils **aResult)

Detailed Description

Definition at line 62 of file nsRDFContainerUtils.cpp.


Constructor & Destructor Documentation

Definition at line 381 of file nsRDFContainerUtils.cpp.

Here is the call graph for this function:


Member Function Documentation

long nsIRDFContainerUtils::indexOf ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aContainer,
in nsIRDFNode  aElement 
) [inherited]

Retrieve the index of element in the container.

Returns -1 if the element is not in the container.

Convert the specified index to an ordinal property.

Here is the caller graph for this function:

PRBool RDFContainerUtilsImpl::IsA ( nsIRDFDataSource aDataSource,
nsIRDFResource aResource,
nsIRDFResource aType 
) [private]

Definition at line 463 of file nsRDFContainerUtils.cpp.

{
    if (!aDataSource || !aResource || !aType)
        return NS_ERROR_NULL_POINTER;

    nsresult rv;

    PRBool result;
    rv = aDataSource->HasAssertion(aResource, kRDF_instanceOf, aType, PR_TRUE, &result);
    if (NS_FAILED(rv)) return PR_FALSE;

    return result;
}

Here is the call graph for this function:

boolean nsIRDFContainerUtils::IsAlt ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Return 'true' if the specified resource is an alternation.

Here is the caller graph for this function:

boolean nsIRDFContainerUtils::IsBag ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Return 'true' if the specified resource is a bag.

Here is the caller graph for this function:

boolean nsIRDFContainerUtils::IsContainer ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Return 'true' if the specified resource is a container.

Here is the caller graph for this function:

boolean nsIRDFContainerUtils::IsEmpty ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Return 'true' if the specified resource is a container and it is empty.

Here is the caller graph for this function:

Returns 'true' if the property is an RDF ordinal property.

Here is the caller graph for this function:

boolean nsIRDFContainerUtils::IsSeq ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Return 'true' if the specified resource is a sequence.

Here is the caller graph for this function:

nsIRDFContainer nsIRDFContainerUtils::MakeAlt ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Decorates the specified resource appropriately to make it usable as an empty alternation in the specified data source.

Here is the caller graph for this function:

nsIRDFContainer nsIRDFContainerUtils::MakeBag ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Decorates the specified resource appropriately to make it usable as an empty bag in the specified data source.

Here is the caller graph for this function:

nsresult RDFContainerUtilsImpl::MakeContainer ( nsIRDFDataSource aDataSource,
nsIRDFResource aResource,
nsIRDFResource aType,
nsIRDFContainer **  aResult 
) [private]

Definition at line 421 of file nsRDFContainerUtils.cpp.

{
    NS_PRECONDITION(aDataSource != nsnull, "null ptr");
    if (! aDataSource)      return NS_ERROR_NULL_POINTER;

    NS_PRECONDITION(aResource != nsnull, "null ptr");
    if (! aResource) return NS_ERROR_NULL_POINTER;

    NS_PRECONDITION(aType != nsnull, "null ptr");
    if (! aType)     return NS_ERROR_NULL_POINTER;

    if (aResult)     *aResult = nsnull;

    nsresult rv;

    // Check to see if somebody has already turned it into a container; if so
    // don't try to do it again.
    PRBool isContainer;
    rv = IsContainer(aDataSource, aResource, &isContainer);
    if (NS_FAILED(rv)) return rv;

    if (isContainer == PR_FALSE)
    {
       rv = aDataSource->Assert(aResource, kRDF_instanceOf, aType, PR_TRUE);
       if (NS_FAILED(rv)) return rv;

       rv = aDataSource->Assert(aResource, kRDF_nextVal, kOne, PR_TRUE);
       if (NS_FAILED(rv)) return rv;
    }

    if (aResult) {
        rv = NS_NewRDFContainer(aResult);
        if (NS_FAILED(rv)) return rv;

        rv = (*aResult)->Init(aDataSource, aResource);
        if (NS_FAILED(rv)) return rv;
    }

    return NS_OK;
}

Here is the call graph for this function:

nsIRDFContainer nsIRDFContainerUtils::MakeSeq ( in nsIRDFDataSource  aDataSource,
in nsIRDFResource  aResource 
) [inherited]

Decorates the specified resource appropriately to make it usable as an empty sequence in the specified data source.

Here is the caller graph for this function:

Convert the specified ordinal property into an index.


Friends And Related Function Documentation

Definition at line 402 of file nsRDFContainerUtils.cpp.

{
    NS_PRECONDITION(aResult != nsnull, "null ptr");
    if (! aResult)
        return NS_ERROR_NULL_POINTER;

    RDFContainerUtilsImpl* result =
        new RDFContainerUtilsImpl();

    if (! result)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(result);
    *aResult = result;
    return NS_OK;
}

Member Data Documentation

Definition at line 86 of file nsRDFContainerUtils.cpp.

PRInt32 RDFContainerUtilsImpl::gRefCnt = 0 [static, private]

Definition at line 85 of file nsRDFContainerUtils.cpp.

Definition at line 92 of file nsRDFContainerUtils.cpp.

Definition at line 91 of file nsRDFContainerUtils.cpp.

Definition at line 89 of file nsRDFContainerUtils.cpp.

Definition at line 87 of file nsRDFContainerUtils.cpp.

Definition at line 88 of file nsRDFContainerUtils.cpp.

Definition at line 90 of file nsRDFContainerUtils.cpp.


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