sbMediaFileManager Class Reference

#include <sbMediaFileManager.h>

Inheritance diagram for sbMediaFileManager:
[legend]
Collaboration diagram for sbMediaFileManager:
[legend]

Public Member Functions

 sbMediaFileManager ()
 Constructor of the sbMediaFileManager component. More...
 
NS_METHOD Init ()
 Initialize the sbMediaFileManager component. More...
 
- Public Member Functions inherited from sbIMediaFileManager
void init ([optional] in nsIPropertyBag2 aProperties)
 
boolean organizeItem (in sbIMediaItem aMediaItem, in unsigned short aManageType, [optional] in nsIFile aForceTargetFile)
 
nsIFile getManagedPath (in sbIMediaItem aItem, in unsigned short aManageType)
 

Protected Member Functions

virtual ~sbMediaFileManager ()
 Destructor of the sbMediaFileManager component. More...
 
nsresult GetNewPath (sbIMediaItem *aMediaItem, nsString &aPath, PRBool *aRetVal)
 Construct the new path based on user settings. More...
 
nsresult GetNewFilename (sbIMediaItem *aMediaItem, nsIURI *aItemUri, nsString &aFilename, PRBool *aRetVal)
 Construct the new filename based on user settings. More...
 
nsresult CopyRename (sbIMediaItem *aMediaItem, nsIFile *aItemFile, nsIFile *aNewFile, PRBool *aRetVal)
 Copys a file from the old location to the new location, ensures that the destination is in the managed folder and that unique filenames are used if the destination file already exists. More...
 
nsresult Delete (nsIFile *aItemFile, PRBool *aRetVal)
 Deletes a file associated with an item if it is located in the managed folder. More...
 
nsresult CheckDirectoryForDeletion (nsIFile *aItemFile)
 Checks whether a directory and its parent directories need to be deleted. More...
 
nsresult NormalizeDir (nsString &aDir)
 Makes sure that a directory ends with the path separator if it can. More...
 
nsresult ZeroPadTrackNumber (const nsAString &aTrackNumStr, const nsAString &aTotalTrackCountStr, nsString &aOutString)
 Format a track number to pad for zeros against the total track count. More...
 

Additional Inherited Members

- Public Attributes inherited from sbIMediaFileManager
const unsigned short MANAGE_RENAME = 1
 
const unsigned short MANAGE_DELETE = 2
 
const unsigned short MANAGE_COPY = 4
 
const unsigned short MANAGE_MOVE = 8
 

Detailed Description

Definition at line 64 of file sbMediaFileManager.h.

Constructor & Destructor Documentation

sbMediaFileManager::sbMediaFileManager ( )

Constructor of the sbMediaFileManager component.

Definition at line 100 of file sbMediaFileManager.cpp.

sbMediaFileManager::~sbMediaFileManager ( )
protectedvirtual

Destructor of the sbMediaFileManager component.

Definition at line 114 of file sbMediaFileManager.cpp.

Member Function Documentation

nsresult sbMediaFileManager::CheckDirectoryForDeletion ( nsIFile *  aItemFile)
protected

Checks whether a directory and its parent directories need to be deleted.

Parameters
aItemFile- The file we check the directories for.

Definition at line 1426 of file sbMediaFileManager.cpp.

Here is the caller graph for this function:

nsresult sbMediaFileManager::CopyRename ( sbIMediaItem aMediaItem,
nsIFile *  aSrcFile,
nsIFile *  aDestFile,
PRBool *  aRetVal 
)
protected

Copys a file from the old location to the new location, ensures that the destination is in the managed folder and that unique filenames are used if the destination file already exists.

Parameters
aMediaItem- The media item we are organizing.
aSrcFile- Original file for item.
aDestFile- New file for item.
aRetVal- True if successful.

Definition at line 1285 of file sbMediaFileManager.cpp.

Here is the call graph for this function:

nsresult sbMediaFileManager::Delete ( nsIFile *  aItemFile,
PRBool *  aRetVal 
)
protected

Deletes a file associated with an item if it is located in the managed folder.

Parameters
aItemFile- Items file to delete.
aRetVal- True if successful.

Definition at line 1501 of file sbMediaFileManager.cpp.

Here is the call graph for this function:

nsresult sbMediaFileManager::GetNewFilename ( sbIMediaItem aMediaItem,
nsIURI *  aItemUri,
nsString &  aFilename,
PRBool *  aRetVal 
)
protected

Construct the new filename based on user settings.

Parameters
aMediaItem- The media item we are organizing.
aItemUri- Original file path
aFilename- Newly generated filename from the items metadata. This function will replace aFilename with new contents.
aRetVal- True if successful.

Definition at line 854 of file sbMediaFileManager.cpp.

Here is the call graph for this function:

nsresult sbMediaFileManager::GetNewPath ( sbIMediaItem aMediaItem,
nsString &  aPath,
PRBool *  aRetVal 
)
protected

Construct the new path based on user settings.

Parameters
aMediaItem- The media item we are organizing.
aPath- Newly generated path from the items metadata.
aRetVal- True if successful.

Definition at line 928 of file sbMediaFileManager.cpp.

Here is the call graph for this function:

NS_IMETHODIMP sbMediaFileManager::Init ( )

Initialize the sbMediaFileManager component.

Definition at line 122 of file sbMediaFileManager.cpp.

Here is the call graph for this function:

nsresult sbMediaFileManager::NormalizeDir ( nsString &  aDir)
protected

Makes sure that a directory ends with the path separator if it can.

Parameters
aDir- The string version of the directory to ensure has a trailing directory separator.

Definition at line 1223 of file sbMediaFileManager.cpp.

Here is the caller graph for this function:

nsresult sbMediaFileManager::ZeroPadTrackNumber ( const nsAString &  aTrackNumStr,
const nsAString &  aTotalTrackCountStr,
nsString &  aOutString 
)
protected

Format a track number to pad for zeros against the total track count.

Parameters
aTrackNumStrThe track number property as a string.
aTotalTrackCountStrThe total tracks property as a string
aOutStringThe out-param for the formatted string.

Example: 2 of 10 tracks will return "02" 2 of 100 tracks will return "002"

Definition at line 1246 of file sbMediaFileManager.cpp.


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