An object to scan through the files of a folder (and optionally subfolders) More...
import"sbIFileScan.idl";
Public Member Functions | |
| void | setDirectory (in AString strDirectory) |
| Set the directory to scan. More... | |
| AString | getDirectory () |
| Get the directory to scan. More... | |
| void | setRecurse (in PRBool bRecurse) |
| Set the scan to run recursively under the given directory. More... | |
| PRBool | getRecurse () |
| Whether or not the scan will run recursively. More... | |
| void | addFileExtension (in AString strExtension) |
| void | addFlaggedFileExtension (in AString strExtension) |
| Add an extension that will not be added to the final discovered paths but will set the |flaggedExtensionsFound| attribute to true if a file with the specified extension is found during the scan. More... | |
| void | setCallback (in sbIFileScanCallback pCallback) |
| Set the callback object for the scan. More... | |
| sbIFileScanCallback | getCallback () |
| Get the callback object for the scan. More... | |
| PRUint32 | getFileCount () |
| Get the number of files found. More... | |
| PRUint32 | getFlaggedFileCount () |
| Get the number of flagged files found. More... | |
| void | addFilePath (in AString strFilePath) |
| USER CODE SHOULD NOT REFERENCE THIS METHOD. More... | |
| AString | getFilePath (in PRUint32 nIndex) |
| Get the N'th file from the results of the scan. More... | |
| AString | getFlaggedFilePath (in PRUint32 nIndex) |
| Get the N'th flagged file from the results of the scan. More... | |
| PRBool | isScanning () |
| Whether or not the scan operation is executing. More... | |
| void | setIsScanning (in PRBool bIsScanning) |
| USER CODE SHOULD NOT REFERENCE THIS METHOD. More... | |
| AString | getLastFileFound () |
| Returns the most recent file found by the scan. More... | |
| AString | getCurrentScanPath () |
| Returns the most recent directory scanned. More... | |
| void | setCurrentScanPath (in AString strScanPath) |
| USER CODE SHOULD NOT REFERENCE THIS METHOD. More... | |
| void | cancel () |
| Cancel the current scanning loop. More... | |
| nsIArray | getResultRangeAsURIStrings (in unsigned long aStartIndex, in unsigned long aEndIndex) |
| PRBool | isCancelled () |
| USER CODE SHOULD NOT REFERENCE THIS METHOD. More... | |
Public Attributes | |
| attribute boolean | searchHidden |
| readonly attribute boolean | flaggedExtensionsFound |
| Returns true if a flagged file extension set in |addFlaggedFileExtension()| was found during the file scan. More... | |
| attribute boolean | wantLibraryContentURIs |
An object to scan through the files of a folder (and optionally subfolders)
This object is used to rapidly gather a list of all the files found under a given directory path. It runs from a separate thread.
User code may call getCurrentScanPath() and getLastFileFound() from the main thread to get a periodic snapshot of the current progress of the scan.
Execute a scan by creating a scan query, filling it out, and passing it to the sbIFileScan interface for processing:
function ScanBeneathADirectory(aPath) {
// Create the objects
var aFileScan = Components.classes["@songbirdnest.com/Songbird/FileScan;1"]
.createInstance(Components.interfaces.sbIFileScan);
var aFileScanQuery = Components.classes["@songbirdnest.com/Songbird/FileScanQuery;1"]
.createInstance(Components.interfaces.sbIFileScanQuery);
// Setup the query
aFileScanQuery.setDirectory(aPath);
aFileScanQuery.setRecurse(true);
// Execute the query
aFileScan.submitQuery(aFileScanQuery);
return aFileScanQuery;
}
Definition at line 117 of file sbIFileScan.idl.
| void sbIFileScanQuery::addFileExtension | ( | in AString | strExtension | ) |
| void sbIFileScanQuery::addFilePath | ( | in AString | strFilePath | ) |
USER CODE SHOULD NOT REFERENCE THIS METHOD.
| void sbIFileScanQuery::addFlaggedFileExtension | ( | in AString | strExtension | ) |
Add an extension that will not be added to the final discovered paths but will set the |flaggedExtensionsFound| attribute to true if a file with the specified extension is found during the scan.
| void sbIFileScanQuery::cancel | ( | ) |
Cancel the current scanning loop.
| sbIFileScanCallback sbIFileScanQuery::getCallback | ( | ) |
Get the callback object for the scan.
| AString sbIFileScanQuery::getCurrentScanPath | ( | ) |
Returns the most recent directory scanned.
This method may be called while the scan is executing to provide a periodic snapshot of the scan results.
| AString sbIFileScanQuery::getDirectory | ( | ) |
Get the directory to scan.
| PRUint32 sbIFileScanQuery::getFileCount | ( | ) |
| AString sbIFileScanQuery::getFilePath | ( | in PRUint32 | nIndex | ) |
Get the N'th file from the results of the scan.
Don't call this while isScanning() is true.
| nIndex | The index of the files array to retrieve |
| PRUint32 sbIFileScanQuery::getFlaggedFileCount | ( | ) |
Get the number of flagged files found.
| AString sbIFileScanQuery::getFlaggedFilePath | ( | in PRUint32 | nIndex | ) |
Get the N'th flagged file from the results of the scan.
NOTE: Don't call this while |isScanning()| is true.
| nIndex | the Index of the files array to retrieve |
| AString sbIFileScanQuery::getLastFileFound | ( | ) |
Returns the most recent file found by the scan.
This method may be called while the scan is executing to provide a periodic snapshot of the scan results.
| PRBool sbIFileScanQuery::getRecurse | ( | ) |
Whether or not the scan will run recursively.
| nsIArray sbIFileScanQuery::getResultRangeAsURIStrings | ( | in unsigned long | aStartIndex, |
| in unsigned long | aEndIndex | ||
| ) |
| PRBool sbIFileScanQuery::isCancelled | ( | ) |
USER CODE SHOULD NOT REFERENCE THIS METHOD.
| PRBool sbIFileScanQuery::isScanning | ( | ) |
Whether or not the scan operation is executing.
| void sbIFileScanQuery::setCallback | ( | in sbIFileScanCallback | pCallback | ) |
Set the callback object for the scan.
| pCallback | The callback object |
| void sbIFileScanQuery::setCurrentScanPath | ( | in AString | strScanPath | ) |
USER CODE SHOULD NOT REFERENCE THIS METHOD.
| void sbIFileScanQuery::setDirectory | ( | in AString | strDirectory | ) |
Set the directory to scan.
| strDirectory | The directory to scan |
| void sbIFileScanQuery::setIsScanning | ( | in PRBool | bIsScanning | ) |
USER CODE SHOULD NOT REFERENCE THIS METHOD.
| void sbIFileScanQuery::setRecurse | ( | in PRBool | bRecurse | ) |
Set the scan to run recursively under the given directory.
| bRecurse | If true, scan subdirectories |
| readonly attribute boolean sbIFileScanQuery::flaggedExtensionsFound |
Returns true if a flagged file extension set in |addFlaggedFileExtension()| was found during the file scan.
Definition at line 166 of file sbIFileScan.idl.
| attribute boolean sbIFileScanQuery::searchHidden |
Definition at line 119 of file sbIFileScan.idl.
| attribute boolean sbIFileScanQuery::wantLibraryContentURIs |
If true, URLs are preprocessed to become library content URIs (ie, lowercase on win32). Default is TRUE.
Definition at line 282 of file sbIFileScan.idl.