Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Static Public Member Functions | List of all members
om::fs::Directory Class Reference

A class that represents a directory within the global file system. More...

#include <omDirectory.h>

Inheritance diagram for om::fs::Directory:
om::fs::FileSystemNode

Public Member Functions

 Directory ()
 Create a directory object representing the root directory. More...
 
 Directory (const Path &newPath)
 Create a directory object for the specified path. More...
 
virtual Bool isFile () const
 Return whether or not the file system node is a file. More...
 
virtual Bool isDirectory () const
 Return whether or not the file system node is a directory. More...
 
virtual Bool exists () const
 Return whether or not this directory exists. More...
 
virtual LargeSize getSize () const
 Get the total size of the directory. More...
 
virtual Bool setName (const UTF8String &newName)
 Set the name of the directory, the last component of its path. More...
 
virtual Bool create ()
 Create this directory if it doesn't exist. More...
 
virtual Bool remove ()
 Remove this directory and all children. More...
 
Size getChildCount () const
 Return the number of child file system nodes this Directory has. More...
 
const UTF8String & getChildName (Index index) const
 Return the name of the directory's child at the specified index. More...
 
Path getChildPath (Index index) const
 Return the path to the directory child at the specified index. More...
 
Bool childIsFile (Index index) const
 Return whether or not the directory's child at the specified index is a file. More...
 
Bool childIsDirectory (Index index) const
 Return whether or not the directory's child at the specified index is a directory. More...
 
Bool hasChild (const UTF8String &name) const
 Return whether or not the directory has a child with the specified name. More...
 
void refreshChildren ()
 Refresh the directory's cache of child file system nodes. More...
 
- Public Member Functions inherited from om::fs::FileSystemNode
virtual ~FileSystemNode ()
 Destroy a file system node object. More...
 
UTF8String getName () const
 Return the name of the file system node, the last component of its path. More...
 
UTF8String getExtension () const
 Return a string representing the extension of this node's file name. More...
 
const PathgetPath () const
 Return a path object representing the path to this file system node. More...
 
const UTF8String & getPathString () const
 Return a string representing the path to the file system node. More...
 
Bool isAtRoot () const
 Return whether or not the file system node is at the root level of the file system. More...
 
virtual time::Date getDateCreated () const
 Return the date when this file system node was created. More...
 
virtual time::Date getDateModified () const
 Return the date when this file system node was last modified. More...
 

Static Public Member Functions

static Path getCurrent ()
 Get the absolute path of the current working directory. More...
 
static Bool setCurrent (const Path &path)
 Set the path of the current working directory. More...
 
static Path getExecutable ()
 Return the path to the directory which contains this application's executable. More...
 
static Path getApplications ()
 Return the path to the system's applications directory. More...
 
static Path getUser ()
 Return the path to the current user's home folder. More...
 
static Path getDocuments ()
 Return the path to the current user's documents directory. More...
 
static Path getDesktop ()
 Return the path to the current user's desktop directory. More...
 
static Path getApplicationData ()
 Return the path to the shared application data directory for all users. More...
 
static Path getUserApplicationData ()
 Return the path to the current user's application data directory. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::fs::FileSystemNode
 FileSystemNode (const UTF8String &newPathString)
 Create a file system node that is represented by the specified path string. More...
 
 FileSystemNode (const Path &newPath)
 Create a file system node that is represented by the specified path. More...
 
- Protected Attributes inherited from om::fs::FileSystemNode
Path path
 The path to this file system node. More...
 

Detailed Description

A class that represents a directory within the global file system.

A directory is a collection of file system nodes (files or directories) that is also a file system node. The directory class allows the user to query a directory's size, name, path, and children, as well as create and destory directories.

Constructor & Destructor Documentation

om::fs::Directory::Directory ( )

Create a directory object representing the root directory.

om::fs::Directory::Directory ( const Path newPath)

Create a directory object for the specified path.

Member Function Documentation

virtual Bool om::fs::Directory::isFile ( ) const
virtual

Return whether or not the file system node is a file.

Implements om::fs::FileSystemNode.

virtual Bool om::fs::Directory::isDirectory ( ) const
virtual

Return whether or not the file system node is a directory.

Implements om::fs::FileSystemNode.

virtual Bool om::fs::Directory::exists ( ) const
virtual

Return whether or not this directory exists.

Implements om::fs::FileSystemNode.

virtual LargeSize om::fs::Directory::getSize ( ) const
virtual

Get the total size of the directory.

This is the total size of all child file system nodes.

Implements om::fs::FileSystemNode.

virtual Bool om::fs::Directory::setName ( const UTF8String &  newName)
virtual

Set the name of the directory, the last component of its path.

Implements om::fs::FileSystemNode.

virtual Bool om::fs::Directory::create ( )
virtual

Create this directory if it doesn't exist.

If the directory already exists, no operation is performed and TRUE is returned. If the creation operation was not successful, FALSE is returned. Otherwise, TRUE is returned and the node is created.

Implements om::fs::FileSystemNode.

virtual Bool om::fs::Directory::remove ( )
virtual

Remove this directory and all children.

Implements om::fs::FileSystemNode.

Size om::fs::Directory::getChildCount ( ) const
inline

Return the number of child file system nodes this Directory has.

const UTF8String& om::fs::Directory::getChildName ( Index  index) const

Return the name of the directory's child at the specified index.

Path om::fs::Directory::getChildPath ( Index  index) const

Return the path to the directory child at the specified index.

Bool om::fs::Directory::childIsFile ( Index  index) const

Return whether or not the directory's child at the specified index is a file.

Bool om::fs::Directory::childIsDirectory ( Index  index) const

Return whether or not the directory's child at the specified index is a directory.

Bool om::fs::Directory::hasChild ( const UTF8String &  name) const

Return whether or not the directory has a child with the specified name.

void om::fs::Directory::refreshChildren ( )

Refresh the directory's cache of child file system nodes.

static Path om::fs::Directory::getCurrent ( )
static

Get the absolute path of the current working directory.

static Bool om::fs::Directory::setCurrent ( const Path path)
static

Set the path of the current working directory.

If the attempt to set the current working directory to the specified path fails, FALSE is returned and the current working directory is not changed. Otherwise, if the attempt succeeds, TRUE is returned and the current working directory is set to the specified path.

static Path om::fs::Directory::getExecutable ( )
static

Return the path to the directory which contains this application's executable.

static Path om::fs::Directory::getApplications ( )
static

Return the path to the system's applications directory.

On Mac OS X, this is the "/Applications/" directory. On Windows this is the "C:/Program Files/" directory.

static Path om::fs::Directory::getUser ( )
static

Return the path to the current user's home folder.

static Path om::fs::Directory::getDocuments ( )
static

Return the path to the current user's documents directory.

static Path om::fs::Directory::getDesktop ( )
static

Return the path to the current user's desktop directory.

static Path om::fs::Directory::getApplicationData ( )
static

Return the path to the shared application data directory for all users.

static Path om::fs::Directory::getUserApplicationData ( )
static

Return the path to the current user's application data directory.


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