Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MCDirEntry Class Reference

Representation of a directory entry. More...

#include <mcllib/MCDirEntry.h>

Inheritance diagram for MCDirEntry:

MCDir MCFile List of all members.

Public Types

enum  EType { ENTRYTYPE_FILE = 1, ENTRYTYPE_DIR = 2, ENTRYTYPE_OTHER = 3 }
 The type of directory entry. More...

Public Member Functions

bool exists ()
 Check to see if the entry exists in the filesystem.
mctime_t getCreateTime ()
 Get the create time of the filesystem entry.
mctime_t getModifyTime ()
 Get the modification time of the filesystem entry.
const MCStringgetName () const
 Get the name of the directory entry.
MCString getNormalizedName () const
 Get the name of the directory entry in a platform independent string.
EType getType () const
 Get the type of the entry.
MCString head () const
 Get the head of the directory entry (directory part).
bool isDir () const
 Test if the item is a directory.
bool isFile () const
 Test if the item is a file.
bool isReadable ()
 Check to see if the entry is readable in the filesystem.
bool isWriteable ()
 Check to see if the entry is writeable in the filesystem.
 MCDirEntry (const MCString &name, EType type)
 Construct a directory entry from a name and type.
 MCDirEntry (const MCString &name)
 Construct a directory entry from an item in the filesystem.
 MCDirEntry (EType type)
 Construct a directory entry of a particular type.
 MCDirEntry ()
 Default constructor.
void remove ()
 Remove the filesystem entry.
void rename (const MCString &to)
 Rename the filesystem entry.
mcint64 size ()
 Get the size of the filesystem entry.
MCString tail () const
 Get the tail of the directory entry (file part).
 ~MCDirEntry ()
 Destructor.

Detailed Description

Representation of a directory entry.

Directory entries do not need to exist in a filesystem. However some of the member functions obtain information from the filesystem. In this description, filesystem entry is used to refer to the physical object, whereas directory entry is used to refer to the logical object (whether it exists or not). Entry is used to refer to the object when it could be used in either context. When a directory entry is constructed, the name provided can be either a path using the operating system file separator or the normalized separator (/). If the path uses the normalized separator it is automatically converted to a path using the operating system file separator. The path also has adjacent seperators, . and .. eliminated (whether or not the path exists in the file system). Elimination of parent directory (..) relies on the path being an absolute path (starting with a leading path separator character).


Member Enumeration Documentation

enum EType
 

The type of directory entry.

Enumeration values:
ENTRYTYPE_FILE  Entry represents a file.
ENTRYTYPE_DIR  Entry represents a directory.
ENTRYTYPE_OTHER  Entry is something other than a file or directory.


Constructor & Destructor Documentation

MCDirEntry EType  type  )  [explicit]
 

Construct a directory entry of a particular type.

Parameters:
type the type of directory entry

MCDirEntry const MCString name  )  [explicit]
 

Construct a directory entry from an item in the filesystem.

Parameters:
name the name of the filesystem item to construct the entry for. If name does not exist in the filesystem an exception is thrown.

MCDirEntry const MCString name,
EType  type
 

Construct a directory entry from a name and type.

The filesystem is not accessed, so name need not exist.

Parameters:
name the name of the entry
type the type of the entry


Member Function Documentation

bool exists  ) 
 

Check to see if the entry exists in the filesystem.

Returns:
true if the filesystem entry exists.

mctime_t getCreateTime  ) 
 

Get the create time of the filesystem entry.

This call will access the filesystem and throw on error

Returns:
the creation time of the named item in the file system

mctime_t getModifyTime  ) 
 

Get the modification time of the filesystem entry.

This call will access the filesystem and throw on error

Returns:
the modification time of the named item in the file system

const MCString& getName  )  const
 

Get the name of the directory entry.

Returns:
the name of the directory entry

MCString getNormalizedName  )  const
 

Get the name of the directory entry in a platform independent string.

Returns:
the normalized name of the entry, with platform specific path separator replaced with /

EType getType  )  const
 

Get the type of the entry.

This will be the real type if the entry was constructed without a type, since the file system will have been checked and the real type obtained through the check. Otherwise it will simply be the type provided at construction.

Returns:
the type of the directory entry

MCString head  )  const
 

Get the head of the directory entry (directory part).

Returns:
the directory part of the directory entry

bool isDir  )  const
 

Test if the item is a directory.

Returns:
true if this entry is a directory

bool isFile  )  const
 

Test if the item is a file.

Returns:
true if this entry is a file

bool isReadable  ) 
 

Check to see if the entry is readable in the filesystem.

Returns:
true if the filesystem entry exists and is readable

bool isWriteable  ) 
 

Check to see if the entry is writeable in the filesystem.

Returns:
true if the filesystem entry exists and is writeable

void remove  ) 
 

Remove the filesystem entry.

This call will access the filesystem and throw on error. For directories, the directory will be removed (if empty).

void rename const MCString to  ) 
 

Rename the filesystem entry.

This call will access the filesystem and throw on error.

Parameters:
to the new name for the entry

mcint64 size  ) 
 

Get the size of the filesystem entry.

This call will access the filesystem and throw on error

Returns:
the size of the named item in the file system

MCString tail  )  const
 

Get the tail of the directory entry (file part).

Returns:
the file name part of the directory entry


Generated on Wed Jan 12 19:05:49 2005 for MCLLIB by  doxygen 1.3.9.1