Ceylan::System::LibfatFileSystemManager Class Reference

Allows to manage a libfat-based filesystem directly, with no OS support, on platforms that support it, i.e. More...

#include <CeylanLibfatFileSystemManager.h>

Inheritance diagram for Ceylan::System::LibfatFileSystemManager:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::System::LibfatFileSystemManager:

Collaboration graph
[legend]

List of all members.

Public Types

enum  SlotType { DefaultSlot, Slot1, Slot2, CustomSlot }
 Describes the various available card slots for data storage. More...
enum  FATType { FAT12, FAT16, FAT32, UnknownFAT }
 Describes the various known types for FAT filesystems. More...
typedef Ceylan::Uint8 PartitionNumber
 Stores the number of a partition in a card.

Public Member Functions

virtual bool existsAsEntry (const std::string &entryPath) const
 Tells whether the filesystem entry entryPath exists, be it a file, a symbolic link, a directory, a character or block device, a FIFO, a socket, etc.
virtual void createSymbolicLink (const std::string &linkTarget, const std::string &linkName)
 Creates a symbolic link on filesystem.
virtual time_t getEntryChangeTime (const std::string &entryPath)
 Returns the change time time of the entry entryPath, be it a file, a directory, etc.
virtual const std::string & getRootDirectoryPrefix () const
virtual Ceylan::Latin1Char getSeparator () const
virtual FilecreateFile (const std::string &filename, OpeningFlag createFlag=File::CreateToWriteBinary, PermissionFlag permissionFlag=File::OwnerReadWrite)
 Returns a LibfatFile reference on a newly created file.
virtual FileopenFile (const std::string &filename, OpeningFlag openFlag=File::OpenToReadBinary)
 Returns a File reference on specified already-existing file, which will be opened with specified settings.
virtual bool existsAsFileOrSymbolicLink (const std::string &filename) const
 Tells whether the regular file or symbolic link filename exists (and is not a directory).
virtual void removeFile (const std::string &filename)
 Removes the file or symbolic link from the filesystem.
virtual void moveFile (const std::string &sourceFilename, const std::string &targetFilename)
 Moves the file on filesystem.
virtual void copyFile (const std::string &sourceFilename, const std::string &targetFilename)
 Copies the file on filesystem.
virtual Size getSize (const std::string &filename)
 Returns the size, in bytes, of the specified file.
virtual time_t getLastChangeTimeFile (const std::string &filename)
 Returns the last change time of the specified file.
virtual void touch (const std::string &filename)
 Updates the last access and modification times of specified file.
virtual DirectorycreateDirectory (const std::string &newDirectoryName)
 Returns a Directory reference on a directory newly created on filesystem.
virtual DirectoryopenDirectory (const std::string &directoryName="")
 Returns a Directory reference on specified already-existing directory, which will be "opened" (i.e.
virtual bool existsAsDirectory (const std::string &directoryPath) const
 Tells whether the directory directoryPath exists and is a directory indeed.
virtual void removeDirectory (const std::string &directoryPath, bool recursive=false)
 Removes the directory from filesystem.
virtual void moveDirectory (const std::string &sourceDirectoryPath, const std::string &targetDirectoryPath)
 Moves the directory on filesystem.
virtual void copyDirectory (const std::string &sourceDirectoryPath, const std::string &targetDirectoryPath)
 Copies the file on filesystem.
virtual time_t getLastChangeTimeDirectory (const std::string &directoryPath)
 Returns the last change time of the specified directory.
virtual bool isAValidDirectoryPath (const std::string &directoryString)
 Returns whether specified string is a valid directory path (i.e.
virtual bool isAbsolutePath (const std::string &path)
 Tells whether specified path is an absolute path.
virtual std::string getCurrentWorkingDirectoryPath ()
 Returns the current working directory path.
virtual void changeWorkingDirectory (const std::string &newWorkingDirectory)
 Changes current working directory to newWorkingDirectory.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns a user-friendly description of the state of this object.
 LibfatFileSystemManager ()
 Constructs a reference to a libfat filesystem, initializes accordingly any needed subsystem.
virtual ~LibfatFileSystemManager () throw ()
 Destroys the Ceylan libfat filesystem reference, not the filesystem itself.
virtual std::string getSeparatorAsString () const
virtual const std::string & getAliasForCurrentDirectory () const
virtual const std::string & getAliasForParentDirectory () const
virtual std::string transformIntoValidFilename (const std::string &rawFilename)
 Takes specified rawFilename and tries to transform it so that the result should be a valid name, from the filesystem's point of view.
virtual bool diff (const std::string &firstFilename, const std::string &secondFilename)
 Tells whether the two specified files have exactly the same content (byte-wise).
virtual void removeLeadingSeparator (std::string &path)
 Removes the leading separator, if any, in specified directory's path.
virtual std::list< std::string > splitPath (const std::string &path)
virtual std::string joinPath (const std::list< std::string > &pathElements)
virtual std::string joinPath (const std::string &firstPath, const std::string &secondPath)
virtual void stripFilename (const std::string &path, std::string *base, std::string *file=0)
 Separates the full pathname path into a basename base and file name file.

Static Public Member Functions

static LibfatFileSystemManagerGetLibfatFileSystemManager ()
 Returns a reference to the unique libfat filesystem manager.
static void SecureLibfatFileSystemManager ()
 Ensures that the libfat filesystem manager is actually available, by instanciating it if necessary.
static void RemoveLibfatFileSystemManager ()
 Removes the current libfat filesystem manager, if any.
static FileDescriptor Duplicate (FileDescriptor fd)
 Duplicates the file descriptor.
static bool ExistsAsEntry (const std::string &entryPath)
 Tells whether the filesystem entry entryPath exists, be it a file, a symbolic link, a directory, a character or block device, a FIFO, a socket, etc.
static void CreateSymbolicLink (const std::string &linkTarget, const std::string &linkName)
 Creates a symbolic link on filesystem.
static time_t GetEntryChangeTime (const std::string &entryPath)
 Returns the change time time of the entry entryPath, be it a file, a directory, etc.
static const std::string & GetRootDirectoryPrefix ()
static Ceylan::Latin1Char GetSeparator ()
static std::string GetSeparatorAsString ()
static const std::string & GetAliasForCurrentDirectory ()
static const std::string & GetAliasForParentDirectory ()
static bool IsDefaultFileSystemManagerSet ()
 Returns whether the default filesystem manager is set.
static void SetDefaultFileSystemManager (FileSystemManager &newDefaultFileSystemManager, bool deallocatePreviousIfAny=true)
 Sets the default filesystem manager, the one that will be used if no filesystem manager is specified otherwise.
static void SetDefaultFileSystemManagerToPlatformDefault ()
 Sets the default filesystem manager to the platform default, i.e.
static FileSystemManagerGetExistingDefaultFileSystemManager ()
 Returns a reference to the unique default filesystem manager, that is expected to exist already.
static FileSystemManagerGetAnyDefaultFileSystemManager ()
 Returns a reference to the unique default filesystem manager, that is created from platform defaults if needed.
static void RemoveDefaultFileSystemManager ()
 Removes the current default filesystem manager, if any.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Attributes

std::string _currentWorkingDirectory
 Used to emulate lacking libfat feature.

Static Protected Attributes

static FileSystemManager_CurrentDefaultFileSystemManager = 0
 Pointer to the default filesystem manager (if any).
static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 LibfatFileSystemManager (const LibfatFileSystemManager &source)
 Copy constructor made private to ensure that it will be never called.
LibfatFileSystemManageroperator= (const LibfatFileSystemManager &source)
 Assignment operator made private to ensure that it will be never called.

Static Private Attributes

static const std::string RootDirectoryPrefix = ""
static const Ceylan::Latin1Char Separator = '/'
static LibfatFileSystemManager_LibfatFileSystemManager = 0
 Pointer to the current libfat filesystem manager (if any).


Detailed Description

Allows to manage a libfat-based filesystem directly, with no OS support, on platforms that support it, i.e.

notably the Nintendo DS.

Allows to manage simultaneously, with only one libfat filesystem instance, several actual libfat filesystems (ex: on different slots).

First, with the Nintendo DS, there are two slots:

In each slot, there may be an actual card.

Each card has a MBR/a boot sector, and may have different partitions. Only first active partition, or, if none is found, first valid one will be used (limitation due to the libfat backend).

Each partition may be formatted according on filesystem convention. This includes the FAT (File Allocation Table) filesystem family, i.e. here either FAT12, FAT16 or FAT32.

Note:
Only available on the Nintendo DS.
See also:
http://chishm.drunkencoders.com/libfat/

http://dldi.drunkencoders.com

Relevant files are:

See also:
http://osdl.sourceforge.net/main/documentation/ misc/nintendo-DS/HomebrewForDS.htmlcartridges

Definition at line 103 of file CeylanLibfatFileSystemManager.h.


Member Typedef Documentation

Stores the number of a partition in a card.

This information is currently not taken into account (limitation due to the libfat backend).

The partition zero means: autoselect the first relevant partition, i.e. the (first) active, if none the first valid.

Definition at line 141 of file CeylanLibfatFileSystemManager.h.


Member Enumeration Documentation

Describes the various known types for FAT filesystems.

Enumerator:
FAT12 
FAT16 
FAT32 
UnknownFAT 

Definition at line 146 of file CeylanLibfatFileSystemManager.h.

Describes the various available card slots for data storage.

Enumerator:
DefaultSlot  The default slot, one of the following slots:.
Slot1  The DS slot:.
Slot2 
CustomSlot 

Definition at line 112 of file CeylanLibfatFileSystemManager.h.

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

LibfatFileSystemManager::LibfatFileSystemManager (  ) 

Constructs a reference to a libfat filesystem, initializes accordingly any needed subsystem.

Cannot be private, as has to be subclassed. Cannot be protected, as has to be instanciated by factories from the mother class.

Note:
Not to be called by the user.
See also:
GetLibfatFileSystemManager instead.
Exceptions:
LibfatFileSystemManagerException if the operation failed.

Definition at line 853 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::atomicSleep().

Referenced by GetLibfatFileSystemManager(), and SecureLibfatFileSystemManager().

LibfatFileSystemManager::~LibfatFileSystemManager (  )  throw () [virtual]

Destroys the Ceylan libfat filesystem reference, not the filesystem itself.

Cannot be private as has to be subclassed.

Definition at line 891 of file CeylanLibfatFileSystemManager.cc.

References _LibfatFileSystemManager.

Ceylan::System::LibfatFileSystemManager::LibfatFileSystemManager ( const LibfatFileSystemManager source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void LibfatFileSystemManager::changeWorkingDirectory ( const std::string &  newWorkingDirectory  )  [virtual]

Changes current working directory to newWorkingDirectory.

Parameters:
newWorkingDirectory the target working directory.
Exceptions:
DirectoryChangeFailed if the operation failed or is not supported on the target platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 752 of file CeylanLibfatFileSystemManager.cc.

References _currentWorkingDirectory, and Ceylan::System::explainError().

void LibfatFileSystemManager::copyDirectory ( const std::string &  sourceDirectoryPath,
const std::string &  targetDirectoryPath 
) [virtual]

Copies the file on filesystem.

Parameters:
sourceDirectoryPath the path of the directory to be copied.
targetDirectoryPath the path of the target directory.
Exceptions:
DirectoryCopyFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 673 of file CeylanLibfatFileSystemManager.cc.

Referenced by moveDirectory().

void LibfatFileSystemManager::copyFile ( const std::string &  sourceFilename,
const std::string &  targetFilename 
) [virtual]

Copies the file on filesystem.

Parameters:
sourceFilename the filename of the file to be copied.
targetFilename the new filename of the copied file.
Exceptions:
FileCopyFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 333 of file CeylanLibfatFileSystemManager.cc.

References dataUtils::e, Ceylan::System::LibfatFile::Open(), and Ceylan::Exception::toString().

Directory & LibfatFileSystemManager::createDirectory ( const std::string &  newDirectoryName  )  [virtual]

Returns a Directory reference on a directory newly created on filesystem.

Parameters:
newDirectoryName the name of the directory to create.
Note:
LibfatDirectory helper factory, has to be public but the user should not use it: Directory::Create is expected to be used instead, as it is the cross-platform factory intended for use.
Exceptions:
DirectoryException,including DirectoryCreationFailed if the directory creation failed.

Implements Ceylan::System::FileSystemManager.

Definition at line 470 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::LibfatDirectory::Create().

File & LibfatFileSystemManager::createFile ( const std::string &  filename,
OpeningFlag  createFlag = File::CreateToWriteBinary,
PermissionFlag  permissionFlag = File::OwnerReadWrite 
) [virtual]

Returns a LibfatFile reference on a newly created file.

By default, it creates a new file on disk. If the name corresponds to an already-existing file, it will be truncated and overwritten.

Parameters:
filename the name of the file.
createFlag the flag describing the creation mode.
permissionFlag the flag describing the requested permissions. On platforms that do not manage permissions, this parameter will be ignored.
See also:
OpeningFlag, PermissionFlag
Note:
LibfatFile helper factory, has to be public but the user should not use it: File::Create is expected to be used instead, as it is the cross-platform factory intended for use.
Exceptions:
FileException,including FileCreationFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 207 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::LibfatFile::Create().

void FileSystemManager::CreateSymbolicLink ( const std::string &  linkTarget,
const std::string &  linkName 
) [static, inherited]

Creates a symbolic link on filesystem.

Note:
Uses the default filesystem manager.
Parameters:
linkTarget the full path of the entry the new link should point to.
linkName the filename of the link to create.
Exceptions:
FileSystemManagerException,which includes SymlinkFailed if the creation failed or is not supported, and FileSystemManagerDelegatingException if the underlying specialized FileSystemManager instance could not be retrieved.

Definition at line 111 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::createSymbolicLink(), and Ceylan::System::FileSystemManager::GetAnyDefaultFileSystemManager().

void LibfatFileSystemManager::createSymbolicLink ( const std::string &  linkTarget,
const std::string &  linkName 
) [virtual]

Creates a symbolic link on filesystem.

Parameters:
linkTarget the full path of the entry the new link should point to.
linkName the filename of the link to create.
Exceptions:
SymlinkFailed if the creation failed, or if the symbolic link feature is not supported.

Implements Ceylan::System::FileSystemManager.

Definition at line 131 of file CeylanLibfatFileSystemManager.cc.

bool FileSystemManager::diff ( const std::string &  firstFilename,
const std::string &  secondFilename 
) [virtual, inherited]

Tells whether the two specified files have exactly the same content (byte-wise).

Parameters:
firstFilename the filename of the first file to compare.
secondFilename the filename of the second file to compare.
Returns:
true iff these files exists and have exactly the same content.
Exceptions:
FileDiffFailed if the operation failed or is not supported on this platform.

Definition at line 294 of file CeylanFileSystemManager.cc.

References dataUtils::e, Ceylan::System::FileSystemManager::existsAsFileOrSymbolicLink(), generalUtils::false, first, Ceylan::System::FileSystemManager::getSize(), Ceylan::System::FileSystemManager::openFile(), Ceylan::System::InputStream::readUint8(), Ceylan::Exception::toString(), and generalUtils::true.

Referenced by Ceylan::System::File::Diff().

static FileDescriptor Ceylan::System::LibfatFileSystemManager::Duplicate ( FileDescriptor  fd  )  [static]

Duplicates the file descriptor.

Parameters:
fd the file descriptor to duplicate.
Exceptions:
DuplicateFailed if the operation failed or if the file descriptor feature is not available.

bool LibfatFileSystemManager::existsAsDirectory ( const std::string &  directoryPath  )  const [virtual]

Tells whether the directory directoryPath exists and is a directory indeed.

Parameters:
directoryPath the directory path to look-up.
Note:
On Windows, files and directories are case-insensitive, and 'c:' is not a directory (it is seen as a drive), whereas 'c:\' is a directory.
Exceptions:
DirectoryLookupFailed if the operation failed (existence test failed with no answer) or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 490 of file CeylanLibfatFileSystemManager.cc.

bool FileSystemManager::ExistsAsEntry ( const std::string &  entryPath  )  [static, inherited]

Tells whether the filesystem entry entryPath exists, be it a file, a symbolic link, a directory, a character or block device, a FIFO, a socket, etc.

Note:
Uses the default filesystem manager.
Parameters:
entryPath the path of the entry to look-up.
Exceptions:
FileSystemManagerException,which includes EntryLookupFailed if the operation failed or is not supported, and FileSystemManagerDelegatingException if the underlying specialized FileSystemManager instance could not be retrieved.

Definition at line 101 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::existsAsEntry(), and Ceylan::System::FileSystemManager::GetAnyDefaultFileSystemManager().

bool LibfatFileSystemManager::existsAsEntry ( const std::string &  entryPath  )  const [virtual]

Tells whether the filesystem entry entryPath exists, be it a file, a symbolic link, a directory, a character or block device, a FIFO, a socket, etc.

Parameters:
entryPath the path of the entry to look-up.
Exceptions:
EntryLookupFailed if the operation failed (existence test failed with no answer) or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 101 of file CeylanLibfatFileSystemManager.cc.

bool LibfatFileSystemManager::existsAsFileOrSymbolicLink ( const std::string &  filename  )  const [virtual]

Tells whether the regular file or symbolic link filename exists (and is not a directory).

Parameters:
filename the filename to look-up.
This method will work as expected whether the symbolic link feature is enabled or not.

Exceptions:
FileLookupFailed if the operation failed (existence test failed with no answer) or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 228 of file CeylanLibfatFileSystemManager.cc.

const std::string & FileSystemManager::getAliasForCurrentDirectory (  )  const [virtual, inherited]

const string & FileSystemManager::GetAliasForCurrentDirectory (  )  [static, inherited]

const std::string & FileSystemManager::getAliasForParentDirectory (  )  const [virtual, inherited]

const string & FileSystemManager::GetAliasForParentDirectory (  )  [static, inherited]

FileSystemManager & FileSystemManager::GetAnyDefaultFileSystemManager (  )  [static, inherited]

Returns a reference to the unique default filesystem manager, that is created from platform defaults if needed.

Ensures that the unique default filesystem manager is set, creates it if needed, ensures it remains a singleton.

If a manager is already available, returns it. Otherwise, it means the user did not wanted to specify a specific one, hence one is created from platform defaults.

Returns:
the current default filesystem manager, either already existing or created from platform defaults.
Exceptions:
FileSystemManagerException if the operation failed.
Note:
This is a helper method to ensure that File and Directory static method can rely in all cases on a filesystem manager.
See also:
GetExistingDefaultFileSystemManager

Definition at line 620 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::_CurrentDefaultFileSystemManager, and Ceylan::System::FileSystemManager::SetDefaultFileSystemManagerToPlatformDefault().

Referenced by Ceylan::System::FileSystemManager::CreateSymbolicLink(), Ceylan::System::FileSystemManager::ExistsAsEntry(), Ceylan::System::FileSystemManager::GetAliasForCurrentDirectory(), Ceylan::System::FileSystemManager::GetAliasForParentDirectory(), Ceylan::System::File::GetCorrespondingFileSystemManager(), Ceylan::System::Directory::GetCorrespondingFileSystemManager(), Ceylan::System::FileSystemManager::GetEntryChangeTime(), Ceylan::System::FileSystemManager::GetRootDirectoryPrefix(), Ceylan::System::FileSystemManager::GetSeparator(), and Ceylan::System::FileSystemManager::GetSeparatorAsString().

std::string LibfatFileSystemManager::getCurrentWorkingDirectoryPath (  )  [virtual]

Returns the current working directory path.

Exceptions:
DirectoryGetCurrentFailed if the operation failed or is not supported on the target platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 743 of file CeylanLibfatFileSystemManager.cc.

References _currentWorkingDirectory.

time_t FileSystemManager::GetEntryChangeTime ( const std::string &  entryPath  )  [static, inherited]

Returns the change time time of the entry entryPath, be it a file, a directory, etc.

Note:
Uses the default filesystem manager.
Parameters:
entryPath the path of the entry.
Exceptions:
FileSystemManagerException,which includes GetChangeTimeFailed if the operation failed or is not supported, and FileSystemManagerDelegatingException if the underlying specialized FileSystemManager instance could not be retrieved.

Definition at line 123 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::GetAnyDefaultFileSystemManager(), and Ceylan::System::FileSystemManager::getEntryChangeTime().

time_t LibfatFileSystemManager::getEntryChangeTime ( const std::string &  entryPath  )  [virtual]

Returns the change time time of the entry entryPath, be it a file, a directory, etc.

Parameters:
entryPath the path of the entry.
Exceptions:
GetChangeTimeFailed if the operation failed or is not supported.

Implements Ceylan::System::FileSystemManager.

Definition at line 142 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::explainError().

FileSystemManager & FileSystemManager::GetExistingDefaultFileSystemManager (  )  [static, inherited]

Returns a reference to the unique default filesystem manager, that is expected to exist already.

Exceptions:
FileSystemManagerException if the operation failed, including if there is no manager available.
See also:
GetAnyDefaultFileSystemManager

Definition at line 606 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::_CurrentDefaultFileSystemManager.

time_t LibfatFileSystemManager::getLastChangeTimeDirectory ( const std::string &  directoryPath  )  [virtual]

Returns the last change time of the specified directory.

Parameters:
directoryPath the path of the directory whose last change time is searched.
Exceptions:
DirectoryLastChangeTimeRequestFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 684 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::explainError().

time_t LibfatFileSystemManager::getLastChangeTimeFile ( const std::string &  filename  )  [virtual]

Returns the last change time of the specified file.

Parameters:
filename the filename whose last change time is searched.
Exceptions:
FileLastChangeTimeRequestFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 414 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::explainError().

LibfatFileSystemManager & LibfatFileSystemManager::GetLibfatFileSystemManager (  )  [static]

Returns a reference to the unique libfat filesystem manager.

Does not set this filesystem manager as the default one.

Creates it if needed: this method ensures it remains a singleton.

Must be public, as ancestor has to be able to call it.

Exceptions:
LibfatFileSystemManagerException if the operation failed.

Definition at line 810 of file CeylanLibfatFileSystemManager.cc.

References _LibfatFileSystemManager, and LibfatFileSystemManager().

Referenced by Ceylan::System::LibfatFile::getCorrespondingFileSystemManager(), Ceylan::System::LibfatDirectory::getCorrespondingFileSystemManager(), and Ceylan::System::FileSystemManager::SetDefaultFileSystemManagerToPlatformDefault().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

const string & FileSystemManager::GetRootDirectoryPrefix (  )  [static, inherited]

const string & LibfatFileSystemManager::getRootDirectoryPrefix (  )  const [virtual]

Ceylan::Latin1Char FileSystemManager::GetSeparator (  )  [static, inherited]

Ceylan::Latin1Char LibfatFileSystemManager::getSeparator (  )  const [virtual]

Implements Ceylan::System::FileSystemManager.

Definition at line 192 of file CeylanLibfatFileSystemManager.cc.

References Separator.

std::string FileSystemManager::getSeparatorAsString (  )  const [virtual, inherited]

string FileSystemManager::GetSeparatorAsString (  )  [static, inherited]

Size LibfatFileSystemManager::getSize ( const std::string &  filename  )  [virtual]

Returns the size, in bytes, of the specified file.

Parameters:
filename the filename whose size is searched.
Exceptions:
FileSizeRequestFailed if the operation failed (ex: file not found) or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 380 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::explainError().

bool LibfatFileSystemManager::isAbsolutePath ( const std::string &  path  )  [virtual]

Tells whether specified path is an absolute path.

Parameters:
path the path that may be absolute.

Implements Ceylan::System::FileSystemManager.

Definition at line 734 of file CeylanLibfatFileSystemManager.cc.

References Separator.

bool LibfatFileSystemManager::isAValidDirectoryPath ( const std::string &  directoryString  )  [virtual]

Returns whether specified string is a valid directory path (i.e.

checks the name can be used, does not look-up any real filesystem entry).

Parameters:
directoryString the directory string to examine.
Note:
For libfat-based filesystems, the path will be deemed always correct.

Implements Ceylan::System::FileSystemManager.

Definition at line 723 of file CeylanLibfatFileSystemManager.cc.

References generalUtils::true.

bool FileSystemManager::IsDefaultFileSystemManagerSet (  )  [static, inherited]

Returns whether the default filesystem manager is set.

Returns:
true iff a default filesystem manager is currently available.

Definition at line 527 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::_CurrentDefaultFileSystemManager.

string FileSystemManager::joinPath ( const std::string &  firstPath,
const std::string &  secondPath 
) [virtual, inherited]

string FileSystemManager::joinPath ( const std::list< std::string > &  pathElements  )  [virtual, inherited]

void LibfatFileSystemManager::moveDirectory ( const std::string &  sourceDirectoryPath,
const std::string &  targetDirectoryPath 
) [virtual]

Moves the directory on filesystem.

A special case of directory moving is directory renaming.

Parameters:
sourceDirectoryPath the path of the directory to be moved.
targetDirectoryPath the path of the target directory.
Exceptions:
DirectoryMoveFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 628 of file CeylanLibfatFileSystemManager.cc.

References copyDirectory(), dataUtils::e, removeDirectory(), and Ceylan::Exception::toString().

void LibfatFileSystemManager::moveFile ( const std::string &  sourceFilename,
const std::string &  targetFilename 
) [virtual]

Moves the file on filesystem.

A special case of file moving is file renaming.

Parameters:
sourceFilename the filename of the file to be moved.
targetFilename the target filename of the moved file.
Exceptions:
FileMoveFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 298 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::explainError().

Directory & LibfatFileSystemManager::openDirectory ( const std::string &  directoryName = ""  )  [virtual]

Returns a Directory reference on specified already-existing directory, which will be "opened" (i.e.

referred to).

Parameters:
directoryName the name of the directory. If not specified (the string is empty), returns a reference to the current working directory.
Note:
LibfatDirectory helper factory, has to be public but the user should not use it: Directory::Open is expected to be used instead, as it is the cross-platform factory intended for use.
Exceptions:
DirectoryException,including DirectoryOpeningFailed if the directory opening failed.

Implements Ceylan::System::FileSystemManager.

Definition at line 480 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::LibfatDirectory::Open().

File & LibfatFileSystemManager::openFile ( const std::string &  filename,
OpeningFlag  openFlag = File::OpenToReadBinary 
) [virtual]

Returns a File reference on specified already-existing file, which will be opened with specified settings.

Parameters:
filename the name of the file.
openFlag the flag describing the opening mode.
See also:
OpeningFlag
Note:
LibfatFile helper factory, has to be public but the user should not use it: File::Open is expected to be used instead, as it is the cross-platform factory intended for use.
Exceptions:
FileException,including FileOpeningFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 218 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::LibfatFile::Open().

LibfatFileSystemManager& Ceylan::System::LibfatFileSystemManager::operator= ( const LibfatFileSystemManager source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void FileSystemManager::RemoveDefaultFileSystemManager (  )  [static, inherited]

Removes the current default filesystem manager, if any.

Definition at line 632 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::_CurrentDefaultFileSystemManager.

void LibfatFileSystemManager::removeDirectory ( const std::string &  directoryPath,
bool  recursive = false 
) [virtual]

Removes the directory from filesystem.

Parameters:
directoryPath the path of the target directory.
recursive if false, the specified directory is expected to be empty, and it will be removed. If true, then the full directory content (including all files and possible subdirectories) and this directory itself will be removed.
Exceptions:
DirectoryRemoveFailed if the operation failed or is not supported.

Implements Ceylan::System::FileSystemManager.

Definition at line 524 of file CeylanLibfatFileSystemManager.cc.

References dataUtils::d, Ceylan::System::explainError(), Ceylan::System::LibfatDirectory::getEntries(), Ceylan::System::FileSystemManager::joinPath(), Ceylan::System::LibfatDirectory::Open(), and Ceylan::System::FileSystemManager::removeLeadingSeparator().

Referenced by moveDirectory().

void LibfatFileSystemManager::removeFile ( const std::string &  filename  )  [virtual]

Removes the file or symbolic link from the filesystem.

Parameters:
filename the filename to remove.
Exceptions:
FileRemoveFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 265 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::explainError().

void FileSystemManager::removeLeadingSeparator ( std::string &  path  )  [virtual, inherited]

Removes the leading separator, if any, in specified directory's path.

Parameters:
path the path that will be modified.

Definition at line 377 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::getSeparator().

Referenced by Ceylan::System::StandardFileSystemManager::removeDirectory(), removeDirectory(), Ceylan::System::Directory::removeLeadingSeparator(), and Ceylan::System::Directory::RemoveLeadingSeparator().

void LibfatFileSystemManager::RemoveLibfatFileSystemManager (  )  [static]

Removes the current libfat filesystem manager, if any.

Must be public, as ancestor has to be able to call it.

Note:
Removing such manager, if it was set as the default one, will remove it as well.

Definition at line 832 of file CeylanLibfatFileSystemManager.cc.

References Ceylan::System::FileSystemManager::_CurrentDefaultFileSystemManager, and _LibfatFileSystemManager.

void LibfatFileSystemManager::SecureLibfatFileSystemManager (  )  [static]

Ensures that the libfat filesystem manager is actually available, by instanciating it if necessary.

Does not set this filesystem manager as the default one.

Creates it if needed: this method ensures it remains a singleton.

Useful to ensure a static operation can rely on a preexisting manager.

Exceptions:
LibfatFileSystemManagerException if the operation failed.

Definition at line 822 of file CeylanLibfatFileSystemManager.cc.

References _LibfatFileSystemManager, and LibfatFileSystemManager().

Referenced by Ceylan::System::LibfatFile::FromFDtoFD(), Ceylan::System::LibfatFile::LibfatFile(), and Ceylan::System::LibfatDirectory::secureCorrespondingFileSystemManager().

void FileSystemManager::SetDefaultFileSystemManager ( FileSystemManager newDefaultFileSystemManager,
bool  deallocatePreviousIfAny = true 
) [static, inherited]

Sets the default filesystem manager, the one that will be used if no filesystem manager is specified otherwise.

Parameters:
deallocatePreviousIfAny if true, any previously existing manager will be deallocated. If false, it would be replaced by not deleted.

Definition at line 536 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::_CurrentDefaultFileSystemManager.

void FileSystemManager::SetDefaultFileSystemManagerToPlatformDefault (  )  [static, inherited]

Sets the default filesystem manager to the platform default, i.e.

to the manager that is the more natural for the target platform.

On computers (be they UNIX or Windows), the default manager is by default the standard one (StandardFileSystemManager).

On the Nintendo DS, it is the libfat one (LibfatFileSystemManager).

Any previously existing manager will be deallocated first.

Exceptions:
FileSystemManagerException if the operation failed or is not supported.

Definition at line 562 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::_CurrentDefaultFileSystemManager, GetLibfatFileSystemManager(), and Ceylan::System::StandardFileSystemManager::GetStandardFileSystemManager().

Referenced by Ceylan::System::FileSystemManager::GetAnyDefaultFileSystemManager().

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

list< string > FileSystemManager::splitPath ( const std::string &  path  )  [virtual, inherited]

void FileSystemManager::stripFilename ( const std::string &  path,
std::string *  base,
std::string *  file = 0 
) [virtual, inherited]

Separates the full pathname path into a basename base and file name file.

For example, this method applied to "/mnt/raid/md0/LOANI-0.3" returns respectively "/mnt/raid/md0" and "LOANI-0.3", when the separator is '/'.

Parameters:
path the path which is to be stripped.
base if non null, must be a pointer to an already allocated string where the basename will be stored. If not interested in the basename, specify a null (0) pointer instead: this method will act as UNIX "basename".
file if non null, must be a pointer to an already allocated string where the filename will be stored. If not interested in the filename, specify a null (0) pointer instead: this method will act as UNIX "dirname".

Definition at line 471 of file CeylanFileSystemManager.cc.

References Ceylan::System::FileSystemManager::getSeparator().

Referenced by Ceylan::System::Directory::StripFilename().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string LibfatFileSystemManager::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Reimplemented from Ceylan::System::FileSystemManager.

Definition at line 794 of file CeylanLibfatFileSystemManager.cc.

References _currentWorkingDirectory.

void LibfatFileSystemManager::touch ( const std::string &  filename  )  [virtual]

Updates the last access and modification times of specified file.

This is not expected to work for directories.

Parameters:
filename the filename of the file whose times must be updated.
Note:
On contrary to the UNIX command touch, if the specified file does not exist, it will not be created. A FileTouchFailed exception would be raised instead.
See also:
File::Create to create empty files.
Exceptions:
FileTouchFailed if the operation failed or is not supported on this platform.

Implements Ceylan::System::FileSystemManager.

Definition at line 451 of file CeylanLibfatFileSystemManager.cc.

std::string FileSystemManager::transformIntoValidFilename ( const std::string &  rawFilename  )  [virtual, inherited]

Takes specified rawFilename and tries to transform it so that the result should be a valid name, from the filesystem's point of view.

Parameters:
rawFilename the filename to convert
Returns:
the converted filename

Definition at line 233 of file CeylanFileSystemManager.cc.

Referenced by Ceylan::System::File::TransformIntoValidFilename().


Member Data Documentation

Pointer to the default filesystem manager (if any).

This default manager is, unless specified otherwise, the one that is deemed the most natural for the target running platform: standard one for computers (either UNIX or Windows), libfat-based one for the Nintendo DS.

Note:
It means it will be the filesystem manager that will be used by default (should no specific manager be specified), which is not necessarily the most usual one for the target platform.
Must be static to allow child classes to unsubscribe their manager if needed.

Definition at line 1146 of file CeylanFileSystemManager.h.

Referenced by Ceylan::System::FileSystemManager::GetAnyDefaultFileSystemManager(), Ceylan::System::FileSystemManager::GetExistingDefaultFileSystemManager(), Ceylan::System::FileSystemManager::IsDefaultFileSystemManagerSet(), Ceylan::System::FileSystemManager::RemoveDefaultFileSystemManager(), RemoveLibfatFileSystemManager(), Ceylan::System::StandardFileSystemManager::RemoveStandardFileSystemManager(), Ceylan::System::FileSystemManager::SetDefaultFileSystemManager(), and Ceylan::System::FileSystemManager::SetDefaultFileSystemManagerToPlatformDefault().

Used to emulate lacking libfat feature.

Definition at line 782 of file CeylanLibfatFileSystemManager.h.

Referenced by changeWorkingDirectory(), getCurrentWorkingDirectoryPath(), and toString().

Pointer to the current libfat filesystem manager (if any).

Definition at line 838 of file CeylanLibfatFileSystemManager.h.

Referenced by GetLibfatFileSystemManager(), RemoveLibfatFileSystemManager(), SecureLibfatFileSystemManager(), and ~LibfatFileSystemManager().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

const string LibfatFileSystemManager::RootDirectoryPrefix = "" [static, private]

Definition at line 798 of file CeylanLibfatFileSystemManager.h.

Referenced by getRootDirectoryPrefix().

Definition at line 807 of file CeylanLibfatFileSystemManager.h.

Referenced by getSeparator(), and isAbsolutePath().


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

Generated on Thu Jun 4 20:41:01 2009 for Ceylan by  doxygen 1.5.8