File

This class captures the abstraction of a disk-based file. A File object can be directly constructed with the name of a file in the file system or it may be returned by a file dialogue such as FileQuery, FileChooser, or FileNavigator. The File class provides methods to query the name of the file, determine if the file actually exists, to search the file for a given text string, to view/edit the file in a window, to copy one file to another, and to delete the file from the file system.

[ Index | Source | Summary | Member Functions ]

Quick Index


Class Summary

class File
{

public:
File(char* fileName);
File();
char* Name();
int Exists();
void SearchFor(Query& query);
void View();
void Edit(char* editor);
void Delete();
void CopyTo(File& other);
void CopyFrom(File& other);
~File();
}; // File

Back to the top of File


File(char* fileName);

Construct a File object with a given name. No check is made that the file so named actually exists in the file system (see the Exists method).

       File(char* fileName);               

Back to the top of File


File();

Construct a File object that denotes an unnamed file.

       File();                             

Back to the top of File


char* Name();

Return the name of the file.

 char* Name();                             

Back to the top of File


int Exists();

Determine if a file with the name corresponding to the File object's name actually exists in the file system. Returns a 1 if the file exists and a 0 otherwise.

 int   Exists();                           

Back to the top of File


void SearchFor(Query& query);

Search the file using a supplied Query. The Query is passed by reference so that it can be changed as a result of the searching.

 void  SearchFor(Query& query);                

Back to the top of File


void View();

View the contents of the file in a window. The view is read-only, the window does not allow editing. This method assumes that the file is a text file or can otherwise be presented meaningfully in a window.

 void  View();                             

Back to the top of File


void Edit(char* editor);

Launch a given text editor to edit the contents of the file. The editor is identified by a pathname in the local file system of an executable file. This method assumes that the file is a text file or can otherwise be meaningfully handled by the given editing program.

 void  Edit(char* editor);                 

Back to the top of File


void Delete();

Remove the file from the local file system. This method is irreversible. The method deletes the file, but not the File object.

 void  Delete();                           

Back to the top of File


void CopyTo(File& other);

Copy the contents of this file to the file specified by the argument. The current file is unaffected by the operation.

 void  CopyTo(File& other);                

Back to the top of File


void CopyFrom(File& other);

Overwrite the contents of this file with the contents of the file denoted by the argument. The argument's file is unaffected by the operation.

 void  CopyFrom(File& other);              

Back to the top of File


~File();

Reclaim the resources associated with the File object. This does NOT delete the corresponding disk file (see Delete).

      ~File();                             

Back to the top of File


Member Functions

public:
char* Name();
int Exists();
void SearchFor(Query& query);
void View();
void Edit(char* editor);
void Delete();
void CopyTo(File& other);
void CopyFrom(File& other);

Back to the top of File


Generated from source by the Cocoon utilities on Thu Apr 02 12:40:32 1998 .

Report problems to jkotula@unimax.com