Back to index

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS FileSystemDataSource (void)
virtual ~FileSystemDataSource (void)
nsIRDFResource GetSource (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find an RDF resource that points to a given node over the specified arc & truth value.
nsISimpleEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find all RDF resources that point to a given node over the specified arc & truth value.
nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find a child of that is related to the source by the given arc arc and truth value.
nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find all children of that are related to the source by the given arc arc and truth value.
void Assert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Add an assertion to the graph.
void Unassert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 Remove an assertion from the graph.
void Change (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aOldTarget, in nsIRDFNode aNewTarget)
 Change an assertion from.
void Move (in nsIRDFResource aOldSource, in nsIRDFResource aNewSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 'Move' an assertion from
boolean HasAssertion (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Query whether an assertion exists in this graph.
void AddObserver (in nsIRDFObserver aObserver)
 Add an observer to this data source.
void RemoveObserver (in nsIRDFObserver aObserver)
 Remove an observer from this data source.
nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode)
 Get a cursor to iterate over all the arcs that point into a node.
nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource)
 Get a cursor to iterate over all the arcs that originate in a resource.
nsISimpleEnumerator GetAllResources ()
 Retrieve all of the resources that the data source currently refers to.
boolean IsCommandEnabled (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Returns whether a given command is enabled for a set of sources.
void DoCommand (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Perform the specified command on set of sources.
nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource)
 Returns the set of all commands defined for a given source.
boolean hasArcIn (in nsIRDFNode aNode, in nsIRDFResource aArc)
 Returns true if the specified node is pointed to by the specified arc.
boolean hasArcOut (in nsIRDFResource aSource, in nsIRDFResource aArc)
 Returns true if the specified node has the specified outward arc.
void beginUpdateBatch ()
 Notify observers that the datasource is about to send several notifications at once.
void endUpdateBatch ()
 Notify observers that the datasource has completed issuing a notification group.

Static Public Member Functions

static
NS_DECL_NSIRDFDATASOURCE
PRBool 
isFileURI (nsIRDFResource *aResource)
static PRBool isDirURI (nsIRDFResource *aSource)
static nsresult GetVolumeList (nsISimpleEnumerator **aResult)
static nsresult GetFolderList (nsIRDFResource *source, PRBool allowHidden, PRBool onlyFirst, nsISimpleEnumerator **aResult)
static nsresult GetName (nsIRDFResource *source, nsIRDFLiteral **aResult)
static nsresult GetURL (nsIRDFResource *source, PRBool *isFavorite, nsIRDFLiteral **aResult)
static nsresult GetFileSize (nsIRDFResource *source, nsIRDFInt **aResult)
static nsresult GetLastMod (nsIRDFResource *source, nsIRDFDate **aResult)

Public Attributes

readonly attribute string URI
 The "URI" of the data source.

Private Attributes

nsCOMPtr< nsISupportsArraymObservers

Static Private Attributes

static PRInt32 gRefCnt
static nsIRDFResourcekNC_FileSystemRoot
static nsIRDFResourcekNC_Child
static nsIRDFResourcekNC_Name
static nsIRDFResourcekNC_URL
static nsIRDFResourcekNC_Icon
static nsIRDFResourcekNC_Length
static nsIRDFResourcekNC_IsDirectory
static nsIRDFResourcekWEB_LastMod
static nsIRDFResourcekNC_FileSystemObject
static nsIRDFResourcekNC_pulse
static nsIRDFResourcekRDF_InstanceOf
static nsIRDFResourcekRDF_type
static nsIRDFLiteralkLiteralTrue
static nsIRDFLiteralkLiteralFalse

Detailed Description

Definition at line 107 of file nsFileSystemDataSource.cpp.


Constructor & Destructor Documentation

Definition at line 278 of file nsFileSystemDataSource.cpp.

{
    if (gRefCnt++ == 0)
    {
#ifdef DEBUG
        nsresult rv =
#endif
        CallGetService(kRDFServiceCID, &gRDFService);

        PR_ASSERT(NS_SUCCEEDED(rv));

#ifdef  XP_WIN
        nsCOMPtr<nsIFile> file;
        NS_GetSpecialDirectory(NS_WIN_FAVORITES_DIR, getter_AddRefs(file));
        if (file)
        {
            nsCOMPtr<nsIURI> furi;
            NS_NewFileURI(getter_AddRefs(furi), file); 
            nsCAutoString favoritesDir;
            file->GetNativePath(favoritesDir);
            ieFavoritesDir = ToNewCString(favoritesDir);

            gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavorite"),
                                     &kNC_IEFavoriteObject);
            gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavoriteFolder"),
                                     &kNC_IEFavoriteFolder);
        }

#endif

#ifdef XP_BEOS

        nsCOMPtr<nsIFile> file;
        NS_GetSpecialDirectory(NS_BEOS_SETTINGS_DIR, getter_AddRefs(file));

        file->AppendNative(NS_LITERAL_CSTRING("NetPositive"));
        file->AppendNative(NS_LITERAL_CSTRING("Bookmarks"));

        nsCOMPtr<nsIURI> furi;
        NS_NewFileURI(getter_AddRefs(furi), file); 
        nsCAutoString favoritesDir;
        file->GetNativePath(favoritesDir);
        netPositiveDir = ToNewCString(favoritesDir);

#endif

        gRDFService->GetResource(NS_LITERAL_CSTRING("NC:FilesRoot"),
                                 &kNC_FileSystemRoot);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "child"),
                                 &kNC_Child);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "Name"),
                                 &kNC_Name);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "URL"),
                                 &kNC_URL);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "Icon"),
                                 &kNC_Icon);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "Content-Length"),
                                 &kNC_Length);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "IsDirectory"),
                                 &kNC_IsDirectory);
        gRDFService->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastModifiedDate"),
                                 &kWEB_LastMod);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "FileSystemObject"),
                                 &kNC_FileSystemObject);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI  "pulse"),
                                 &kNC_pulse);

        gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
                                 &kRDF_InstanceOf);
        gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
                                 &kRDF_type);

#ifdef USE_NC_EXTENSION
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "extension"),
                                 &kNC_extension);
#endif
        gRDFService->GetLiteral(NS_LITERAL_STRING("true").get(),       &kLiteralTrue);
        gRDFService->GetLiteral(NS_LITERAL_STRING("false").get(),      &kLiteralFalse);
        gFileSystemDataSource = this;
    }
}

Here is the call graph for this function:

Definition at line 362 of file nsFileSystemDataSource.cpp.

{
#ifdef DEBUG_REFS
    --gInstanceCount;
    fprintf(stdout, "%d - RDF: FileSystemDataSource\n", gInstanceCount);
#endif

    if (--gRefCnt == 0) {
        NS_RELEASE(kNC_FileSystemRoot);
        NS_RELEASE(kNC_Child);
        NS_RELEASE(kNC_Name);
        NS_RELEASE(kNC_URL);
        NS_RELEASE(kNC_Icon);
        NS_RELEASE(kNC_Length);
        NS_RELEASE(kNC_IsDirectory);
        NS_RELEASE(kWEB_LastMod);
        NS_RELEASE(kNC_FileSystemObject);
        NS_RELEASE(kNC_pulse);
        NS_RELEASE(kRDF_InstanceOf);
        NS_RELEASE(kRDF_type);

#ifdef  XP_WIN
        NS_IF_RELEASE(kNC_IEFavoriteObject);
        NS_IF_RELEASE(kNC_IEFavoriteFolder);

        if (ieFavoritesDir)
        {
            nsMemory::Free(ieFavoritesDir);
            ieFavoritesDir = nsnull;
        }
#endif

#ifdef BEOS

        if (netPositiveDir)
        {
            nsMemory::Free(netPositiveDir);
            netPositiveDir = nsnull;
        }
#endif
#ifdef USE_NC_EXTENSION
        NS_RELEASE(kNC_extension);
#endif

        NS_RELEASE(kLiteralTrue);
        NS_RELEASE(kLiteralFalse);

        gFileSystemDataSource = nsnull;
        NS_RELEASE(gRDFService);
    }
}

Here is the call graph for this function:


Member Function Documentation

Add an observer to this data source.

If the datasource supports observers, the datasource source should hold a strong reference to the observer.

Here is the caller graph for this function:

Get a cursor to iterate over all the arcs that point into a node.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that labels points to a valid (but possible empty) nsISimpleEnumerator object.

Here is the caller graph for this function:

Get a cursor to iterate over all the arcs that originate in a resource.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that labels points to a valid (but possible empty) nsISimpleEnumerator object.

Here is the caller graph for this function:

void nsIRDFDataSource::Assert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Add an assertion to the graph.

Here is the caller graph for this function:

Notify observers that the datasource is about to send several notifications at once.

This must be followed by calling endUpdateBatch(), otherwise viewers will get out of sync.

void nsIRDFDataSource::Change ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aOldTarget,
in nsIRDFNode  aNewTarget 
) [inherited]

Change an assertion from.

[aSource]--[aProperty]-->[aOldTarget]

to

[aSource]--[aProperty]-->[aNewTarget]

Here is the caller graph for this function:

void nsIRDFDataSource::DoCommand ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Perform the specified command on set of sources.

Here is the caller graph for this function:

Notify observers that the datasource has completed issuing a notification group.

Returns the set of all commands defined for a given source.

Here is the caller graph for this function:

Retrieve all of the resources that the data source currently refers to.

Here is the caller graph for this function:

nsresult FileSystemDataSource::GetFileSize ( nsIRDFResource source,
nsIRDFInt **  aResult 
) [static]

Definition at line 1475 of file nsFileSystemDataSource.cpp.

{
    *aResult = nsnull;

    nsresult        rv;
    const char      *uri = nsnull;

    rv = source->GetValueConst(&uri);
    if (NS_FAILED(rv))
        return(rv);
    if (!uri)
        return(NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsIURI>    aIURI;
    if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(uri))))
        return(rv);

    nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
    if (!fileURL)
        return(PR_FALSE);

    nsCOMPtr<nsIFile>   aFile;
    if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
        return(rv);
    if (!aFile)
        return(NS_ERROR_UNEXPECTED);

    // ensure that we DO NOT resolve aliases
    nsCOMPtr<nsILocalFile>  aFileLocal = do_QueryInterface(aFile);
    if (aFileLocal)
        aFileLocal->SetFollowLinks(PR_FALSE);

    // don't do anything with directories
    PRBool  isDir = PR_FALSE;
    if (NS_FAILED(rv = aFile->IsDirectory(&isDir)))
        return(rv);
    if (isDir == PR_TRUE)
        return(NS_RDF_NO_VALUE);

    PRInt64     aFileSize64;
#ifdef  XP_MAC
    // on Mac, get total file size (data + resource fork)
    nsCOMPtr<nsILocalFileMac>   aMacFile = do_QueryInterface(aFile);
    if (!aMacFile)
        return(NS_ERROR_UNEXPECTED);
    if (NS_FAILED(rv = aMacFile->GetFileSizeWithResFork(&aFileSize64)))
        return(rv);
#else
    if (NS_FAILED(rv = aFile->GetFileSize(&aFileSize64)))
        return(rv);
#endif

    // convert 64bits to 32bits
    PRInt32     aFileSize32 = 0;
    LL_L2I(aFileSize32, aFileSize64);

    gRDFService->GetIntLiteral(aFileSize32, aResult);

    return(NS_OK);
}

Here is the call graph for this function:

nsresult FileSystemDataSource::GetFolderList ( nsIRDFResource source,
PRBool  allowHidden,
PRBool  onlyFirst,
nsISimpleEnumerator **  aResult 
) [static]

Definition at line 1300 of file nsFileSystemDataSource.cpp.

{
    if (!isDirURI(source))
        return(NS_RDF_NO_VALUE);

    nsresult                    rv;
    nsCOMPtr<nsISupportsArray>  nameArray;

    rv = NS_NewISupportsArray(getter_AddRefs(nameArray));
    if (NS_FAILED(rv))
        return(rv);

    const char      *parentURI = nsnull;
    rv = source->GetValueConst(&parentURI);
    if (NS_FAILED(rv))
        return(rv);
    if (!parentURI)
        return(NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsIURI>    aIURI;
    if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(parentURI))))
        return(rv);

    nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
    if (!fileURL)
        return(PR_FALSE);

    nsCOMPtr<nsIFile>   aDir;
    if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aDir))))
        return(rv);

    // ensure that we DO NOT resolve aliases
    nsCOMPtr<nsILocalFile>  aDirLocal = do_QueryInterface(aDir);
    if (aDirLocal)
        aDirLocal->SetFollowLinks(PR_FALSE);

    nsCOMPtr<nsISimpleEnumerator>   dirContents;
    if (NS_FAILED(rv = aDir->GetDirectoryEntries(getter_AddRefs(dirContents))))
        return(rv);
    if (!dirContents)
        return(NS_ERROR_UNEXPECTED);

    PRBool          hasMore;
    while(NS_SUCCEEDED(rv = dirContents->HasMoreElements(&hasMore)) &&
        (hasMore == PR_TRUE))
    {
        nsCOMPtr<nsISupports>   isupports;
        if (NS_FAILED(rv = dirContents->GetNext(getter_AddRefs(isupports))))
            break;

        nsCOMPtr<nsIFile>   aFile = do_QueryInterface(isupports);
        if (!aFile)
            break;

        if (allowHidden == PR_FALSE)
        {
            PRBool          hiddenFlag = PR_FALSE;
            if (NS_FAILED(rv = aFile->IsHidden(&hiddenFlag)))
                break;
            if (hiddenFlag == PR_TRUE)
                continue;
        }

        nsAutoString leafStr;
        if (NS_FAILED(rv = aFile->GetLeafName(leafStr)))
            break;
        if (leafStr.IsEmpty())
            continue;
  
        nsCAutoString           fullURI;
        fullURI.Assign(parentURI);
        if (fullURI.Last() != '/')
        {
            fullURI.Append('/');
        }

        char    *escLeafStr = nsEscape(NS_ConvertUCS2toUTF8(leafStr).get(), url_Path);
        leafStr.Truncate();

        if (!escLeafStr)
            continue;
  
        nsCAutoString           leaf(escLeafStr);
        Recycle(escLeafStr);
        escLeafStr = nsnull;

        // using nsEscape() [above] doesn't escape slashes, so do that by hand
        PRInt32         aOffset;
        while ((aOffset = leaf.FindChar('/')) >= 0)
        {
            leaf.Cut((PRUint32)aOffset, 1);
            leaf.Insert("%2F", (PRUint32)aOffset);
        }

        // append the encoded name
        fullURI.Append(leaf);

        PRBool          dirFlag = PR_FALSE;
        rv = aFile->IsDirectory(&dirFlag);
        if (NS_SUCCEEDED(rv) && (dirFlag == PR_TRUE))
        {
            fullURI.Append('/');
        }

        nsCOMPtr<nsIRDFResource>    fileRes;
        gRDFService->GetResource(fullURI, getter_AddRefs(fileRes));

        nameArray->AppendElement(fileRes);

        if (onlyFirst == PR_TRUE)
            break;
    }

    nsISimpleEnumerator* result = new nsArrayEnumerator(nameArray);
    if (! result)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(result);
    *aResult = result;

    return NS_OK;
}

Here is the call graph for this function:

nsresult FileSystemDataSource::GetLastMod ( nsIRDFResource source,
nsIRDFDate **  aResult 
) [static]

Definition at line 1427 of file nsFileSystemDataSource.cpp.

{
    *aResult = nsnull;

    nsresult        rv;
    const char      *uri = nsnull;

    rv = source->GetValueConst(&uri);
    if (NS_FAILED(rv)) return(rv);
    if (!uri)
        return(NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsIURI>    aIURI;
    if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(uri))))
        return(rv);

    nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
    if (!fileURL)
        return(PR_FALSE);

    nsCOMPtr<nsIFile>   aFile;
    if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
        return(rv);
    if (!aFile)
        return(NS_ERROR_UNEXPECTED);

    // ensure that we DO NOT resolve aliases
    nsCOMPtr<nsILocalFile>  aFileLocal = do_QueryInterface(aFile);
    if (aFileLocal)
        aFileLocal->SetFollowLinks(PR_FALSE);

    PRInt64 lastModDate;
    if (NS_FAILED(rv = aFile->GetLastModifiedTime(&lastModDate)))
        return(rv);

    // convert from milliseconds to seconds
    PRTime      temp64, thousand;
    LL_I2L(thousand, PR_MSEC_PER_SEC);
    LL_MUL(temp64, lastModDate, thousand);

    gRDFService->GetDateLiteral(temp64, aResult);

    return(NS_OK);
}

Here is the call graph for this function:

nsresult FileSystemDataSource::GetName ( nsIRDFResource source,
nsIRDFLiteral **  aResult 
) [static]

Definition at line 1539 of file nsFileSystemDataSource.cpp.

{
    nsresult        rv;
    const char      *uri = nsnull;

    rv = source->GetValueConst(&uri);
    if (NS_FAILED(rv))
        return(rv);
    if (!uri)
        return(NS_ERROR_UNEXPECTED);

    nsCOMPtr<nsIURI>    aIURI;
    if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(uri))))
        return(rv);

    nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
    if (!fileURL)
        return(PR_FALSE);

    nsCOMPtr<nsIFile>   aFile;
    if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
        return(rv);
    if (!aFile)
        return(NS_ERROR_UNEXPECTED);

    // ensure that we DO NOT resolve aliases
    nsCOMPtr<nsILocalFile>  aFileLocal = do_QueryInterface(aFile);
    if (aFileLocal)
        aFileLocal->SetFollowLinks(PR_FALSE);

    nsAutoString name;
    if (NS_FAILED(rv = aFile->GetLeafName(name)))
        return(rv);
    if (name.IsEmpty())
        return(NS_ERROR_UNEXPECTED);

#ifdef  XP_MAC
    nsCOMPtr<nsILocalFileMac>   aMacFile = do_QueryInterface(aFile);
    if (aMacFile)
    {
        PRBool isPackageFlag = PR_FALSE;
        rv = aMacFile->IsPackage(&isPackageFlag);
        if (NS_SUCCEEDED(rv) && (isPackageFlag == PR_TRUE))
        {
            // mungle package names under Mac OS 9/X
            PRUint32 len = name.Length();
            if (name.RFind(".app", PR_TRUE) == len - 4)
            {
                name.SetLength(len-4);
            }
        }
    }
#endif

#ifdef  XP_WIN
    // special hack for IE favorites under Windows; strip off the
    // trailing ".url" or ".lnk" at the end of IE favorites names
    PRInt32 nameLen = name.Length();
    if ((strncmp(uri, ieFavoritesDir, strlen(ieFavoritesDir)) == 0) && (nameLen > 4))
    {
        nsAutoString extension;
        name.Right(extension, 4);
        if (extension.LowerCaseEqualsLiteral(".url") ||
            extension.LowerCaseEqualsLiteral(".lnk"))
        {
            name.Truncate(nameLen - 4);
        }
    }
#endif

#ifdef  XP_BEOS
    // under BEOS, try and get the "META:title" attribute (if its a file)
    if (strstr(uri, netPositiveDir) != 0)
    {
        PRBool value;
        if ((NS_SUCCEEDED(aFileLocal->IsFile(&value) && value)) ||
            (NS_SUCCEEDED(aFileLocal->IsDirectory(&value) && value)))
        {
            nsXPIDLCString nativePath;
            aFileLocal->GetNativePath(nativePath);

            rv = NS_ERROR_FAILURE;
            if (nativePath) 
            {
                BFile   bf(nativePath.get(), B_READ_ONLY);
                if (bf.InitCheck() == B_OK)
                {
                    char        beNameAttr[4096];
                    ssize_t     len;

                    if ((len = bf.ReadAttr("META:title", B_STRING_TYPE,
                        0, beNameAttr, sizeof(beNameAttr)-1)) > 0)
                    {
                        beNameAttr[len] = '\0';
                        CopyUTF8toUTF16(beNameAttr, name);
                        rv = NS_OK;
                    }
                }
            }
            if (NS_OK != rv)
            {
                nsCAutoString leafName;
                rv = aFileLocal->GetNativeLeafName(leafName);
                if (NS_SUCCEEDED(rv)) {
                    CopyUTF8toUTF16(leafName, name);
                    rv = NS_OK;
                }
            }
        }
    }
#endif

    gRDFService->GetLiteral(name.get(), aResult);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIRDFResource nsIRDFDataSource::GetSource ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find an RDF resource that points to a given node over the specified arc & truth value.

Returns:
NS_RDF_NO_VALUE if there is no source that leads to the target with the specified property.

Here is the caller graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetSources ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find all RDF resources that point to a given node over the specified arc & truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

nsIRDFNode nsIRDFDataSource::GetTarget ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find a child of that is related to the source by the given arc arc and truth value.

Returns:
NS_RDF_NO_VALUE if there is no target accessable from the source via the specified property.

Here is the caller graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetTargets ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find all children of that are related to the source by the given arc arc and truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

nsresult FileSystemDataSource::GetURL ( nsIRDFResource source,
PRBool isFavorite,
nsIRDFLiteral **  aResult 
) [static]

Definition at line 1756 of file nsFileSystemDataSource.cpp.

{
    if (isFavorite) *isFavorite = PR_FALSE;

    nsresult        rv;
    nsCString       uri;
       
    rv = source->GetValueUTF8(uri);
    if (NS_FAILED(rv))
        return(rv);

    NS_ConvertUTF8toUTF16 url(uri);

#ifdef  XP_WIN
    // under Windows, if its an IE favorite, munge the URL
    if (ieFavoritesDir)
    {
        if (url.Find(ieFavoritesDir) == 0)
        {
            if (isFavorite) *isFavorite = PR_TRUE;
            rv = getIEFavoriteURL(source, url, aResult);
            return(rv);
        }
    }
#endif

#ifdef  XP_BEOS
    // under BEOS, try and get the "META:url" attribute
    if (netPositiveDir)
    {
        if (strstr(uri.get(), netPositiveDir) != 0)
        {
            if (isFavorite) *isFavorite = PR_TRUE;
            rv = getNetPositiveURL(source, url, aResult);
            return(rv);
        }
    }
#endif

    // if we fall through to here, its not any type of bookmark
    // stored in the platform native file system, so just set the URL

    gRDFService->GetLiteral(url.get(), aResult);

    return(NS_OK);
}

Here is the call graph for this function:

Definition at line 1135 of file nsFileSystemDataSource.cpp.

{
    nsresult rv;
    nsCOMPtr<nsISupportsArray> volumes;

    rv = NS_NewISupportsArray(getter_AddRefs(volumes));
    if (NS_FAILED(rv)) return rv;

    nsCOMPtr<nsIRDFResource> vol;

#ifdef  XP_MAC
    StrFileName     fname;
    HParamBlockRec  pb;
    for (int16 volNum = 1; ; volNum++)
    {
        pb.volumeParam.ioCompletion = NULL;
        pb.volumeParam.ioVolIndex = volNum;
        pb.volumeParam.ioNamePtr = (StringPtr)fname;
        if (PBHGetVInfo(&pb,FALSE) != noErr)
            break;
        FSSpec fss(pb.volumeParam.ioVRefNum, fsRtParID, fname);
        nsCOMPtr<nsILocalFileMac> lf;
        NS_NewLocalFileWithFSSpec(fss, true, getter_AddRefs(lf));

        nsCOMPtr<nsIURI> furi;
        NS_NewFileURI(getter_AddRefs(furi), lf); 

        nsXPIDLCString spec;
        furi->GetSpec(getter_Copies(spec);

        rv = gRDFService->GetResource(spec, getter_AddRefs(vol));
        if (NS_FAILED(rv)) return rv;

        volumes->AppendElement(vol);
    }
#endif

#if defined (XP_WIN) && !defined (WINCE)

    PRInt32         driveType;
    char            drive[32];
    PRInt32         volNum;
    char            *url;

    for (volNum = 0; volNum < 26; volNum++)
    {
        sprintf(drive, "%c:\\", volNum + 'A');
        driveType = GetDriveType(drive);
        if (driveType != DRIVE_UNKNOWN && driveType != DRIVE_NO_ROOT_DIR)
        {
            if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A')))
            {
                rv = gRDFService->GetResource(nsDependentCString(url),
                                              getter_AddRefs(vol));
                PR_Free(url);

                if (NS_FAILED(rv)) return rv;
                volumes->AppendElement(vol);
            }
        }
    }
#endif

#if defined(XP_UNIX) || defined(XP_BEOS)
    gRDFService->GetResource(NS_LITERAL_CSTRING("file:///"), getter_AddRefs(vol));
    volumes->AppendElement(vol);
#endif

#ifdef XP_OS2
    ULONG ulDriveNo = 0;
    ULONG ulDriveMap = 0;
    char *url;

    rv = DosQueryCurrentDisk(&ulDriveNo, &ulDriveMap);
    if (NS_FAILED(rv))
        return rv;

    for (int volNum = 0; volNum < 26; volNum++)
    {
        if (((ulDriveMap << (31 - volNum)) >> 31))
        {
            if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A')))
            {
                rv = gRDFService->GetResource(nsDependentCString(url), getter_AddRefs(vol));
                PR_Free(url);

                if (NS_FAILED(rv)) return rv;
                volumes->AppendElement(vol);
            }
        }

    }
#endif

    nsISimpleEnumerator* result = new nsArrayEnumerator(volumes);
    if (! result)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(result);
    *aResult = result;

    return NS_OK;
}

Here is the call graph for this function:

boolean nsIRDFDataSource::hasArcIn ( in nsIRDFNode  aNode,
in nsIRDFResource  aArc 
) [inherited]

Returns true if the specified node is pointed to by the specified arc.

Equivalent to enumerating ArcLabelsIn and comparing for the specified arc.

Returns true if the specified node has the specified outward arc.

Equivalent to enumerating ArcLabelsOut and comparing for the specified arc.

boolean nsIRDFDataSource::HasAssertion ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Query whether an assertion exists in this graph.

Here is the caller graph for this function:

boolean nsIRDFDataSource::IsCommandEnabled ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Returns whether a given command is enabled for a set of sources.

Here is the caller graph for this function:

Definition at line 241 of file nsFileSystemDataSource.cpp.

{
    nsresult    rv;
    const char  *uri = nsnull;

    rv = source->GetValueConst(&uri);
    if (NS_FAILED(rv)) return(PR_FALSE);

    nsCOMPtr<nsIFile> aDir;

    rv = NS_GetFileFromURLSpec(nsDependentCString(uri), getter_AddRefs(aDir));
    if (NS_FAILED(rv)) return(PR_FALSE);

    PRBool isDirFlag = PR_FALSE;

    rv = aDir->IsDirectory(&isDirFlag);
    if (NS_FAILED(rv)) return(PR_FALSE);

#ifdef  XP_MAC
    // Hide directory structure of packages under Mac OS 9/X
    nsCOMPtr<nsILocalFileMac>   aMacFile = do_QueryInterface(aDir);
    if (aMacFile)
    {
        PRBool isPackageFlag = PR_FALSE;
        rv = aMacFile->IsPackage(&isPackageFlag);
        if (NS_SUCCEEDED(rv) && (isPackageFlag == PR_TRUE))
        {
            isDirFlag = PR_FALSE;
        }
    }
#endif

    return(isDirFlag);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 221 of file nsFileSystemDataSource.cpp.

{
    PRBool      isFileURIFlag = PR_FALSE;
    const char  *uri = nsnull;
    
    r->GetValueConst(&uri);
    if ((uri) && (!strncmp(uri, kFileProtocol, sizeof(kFileProtocol) - 1)))
    {
        // XXX HACK HACK HACK
        if (!strchr(uri, '#'))
        {
            isFileURIFlag = PR_TRUE;
        }
    }
    return(isFileURIFlag);
}

Here is the call graph for this function:

void nsIRDFDataSource::Move ( in nsIRDFResource  aOldSource,
in nsIRDFResource  aNewSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

'Move' an assertion from

[aOldSource]--[aProperty]-->[aTarget]

to

[aNewSource]--[aProperty]-->[aTarget]

Here is the caller graph for this function:

Remove an observer from this data source.

Here is the caller graph for this function:

void nsIRDFDataSource::Unassert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

Remove an assertion from the graph.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 112 of file nsFileSystemDataSource.cpp.

Definition at line 144 of file nsFileSystemDataSource.cpp.

Definition at line 143 of file nsFileSystemDataSource.cpp.

Definition at line 116 of file nsFileSystemDataSource.cpp.

Definition at line 123 of file nsFileSystemDataSource.cpp.

Definition at line 115 of file nsFileSystemDataSource.cpp.

Definition at line 119 of file nsFileSystemDataSource.cpp.

Definition at line 121 of file nsFileSystemDataSource.cpp.

Definition at line 120 of file nsFileSystemDataSource.cpp.

Definition at line 117 of file nsFileSystemDataSource.cpp.

Definition at line 124 of file nsFileSystemDataSource.cpp.

Definition at line 118 of file nsFileSystemDataSource.cpp.

Definition at line 125 of file nsFileSystemDataSource.cpp.

Definition at line 126 of file nsFileSystemDataSource.cpp.

Definition at line 122 of file nsFileSystemDataSource.cpp.

Definition at line 110 of file nsFileSystemDataSource.cpp.

readonly attribute string nsIRDFDataSource::URI [inherited]

The "URI" of the data source.

This used by the RDF service's |GetDataSource()| method to cache datasources.

Definition at line 56 of file nsIRDFDataSource.idl.


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