namespace Akenti class File

A File object contains a filename and provides methods to return informataion about the name or directory

Public Methods

File (const string& filename)
Construct this object
string getName () const
Gets the name of the file
string getAbsolutePath () const
Gets the absolute path of the file
string getParent () const
Gets the Parent directory of the file
bool hasParent () const
Checks to see if the file has parent directory
bool isAbsolute () const
Checks to see if the filename is an absolute path form (i
bool exists () const
Checks to see if the file exists or not
bool isDirectory () const
Checks to see if the file exists and is a directory
bool isFile () const
Checks to see if the file exists and is not a directory
vector list () const
Returns a list of the contents of this directory
vector list (const Filter& filter) const
Returns a list of file names after being filtered
void mkdir () const
Create a directory
string paramString () const
Returns a string representation for File which is used for debugging purposes

Documentation

A File object contains a filename and provides methods to return informataion about the name or directory. The filename may be either an absolute pathname or relative to the current working directory. It may refer to either a plain file or a directory.
Usage:
eg 1). File("Makefile");    
eg 2). File("/usr/local/mrt/Certificates");    
File(const string& filename)
Construct this object. If filename starts with "/" it is an absolute pathname, otherwise it is relative to the current working directory.
Parameters:
filename - string name of the file,

string getName() const
Gets the name of the file.
Returns:
name of the file

string getAbsolutePath() const
Gets the absolute path of the file.
Throws:
Error if we cannot determine the working directory.
Returns:
string the absolute path

string getParent() const
Gets the Parent directory of the file. If the filename is a single "/" an empty string is returned. If the name is relative (contains no "/") an empty string is returned.
Returns:
string the parent name of the file

bool hasParent() const
Checks to see if the file has parent directory.
Returns:
bool an indication if the file has a parent or not

bool isAbsolute() const
Checks to see if the filename is an absolute path form (i.e. starts with a "/".
Returns:
bool true if the file is absolute, otherwise false.

bool exists() const
Checks to see if the file exists or not.
Returns:
bool true if the file exists, otherwise false.

bool isDirectory() const
Checks to see if the file exists and is a directory.
Returns:
bool true if the file is a directory, otherwise false.

bool isFile() const
Checks to see if the file exists and is not a directory
Returns:
bool true if the file is not a directory, other false.

vector list() const
Returns a list of the contents of this directory.
Throws:
Error : file does not exist
Error : file is not a directory
IOException : unable to open directory
Returns:
vector list of all the directory entries

vector list(const Filter& filter) const
Returns a list of file names after being filtered.
Throws:
Error if file does not exits or
Error file is not a directory
IOException if unable to open directory
Returns:
vector collection of filtered file name(s)
Parameters:
filter - a pattern that a name must match in order to be included in the returned list of names.

void mkdir() const
Create a directory.
Throws:
Error
IOException

string paramString() const
Returns a string representation for File which is used for debugging purposes.
Returns:
debugging info


This class has no child classes.
Author:
Srilekha Mudumbai Abdelilah Essiari
Version:
1.1 00/11/01
See Also:
Filter

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de