xflminterface IF_FileSystem : public XF_RefCount


This class represents the file system interface. It extends XF_RefCount and provides a variety of general purpose file operations.


Method Summary

RCODE Create - Creates a new file
RCODE CreateBlockFile - Create a block-oriented file
RCODE CreateUnique - Create a file, ensuring it has a unique name
RCODE Open - Open a file
RCODE OpenBlockFile - Open a block-oriented file
RCODE OpenDir - Returns a handle to a specific directory
RCODE CreateDir - Creates a new directory
RCODE RemoveDir - Remove a directory and, potentially, it's contents
RCODE Exists - Determine if a file or directory exists
FLMBOOL IsDir - Determine if a particular name is a directory
RCODE GetTimeStamp - Return the timestamp of the last modification made to a file
RCODE Delete - Delete a file
RCODE Copy - Copy a file, potentially overwriting an existing file
RCODE Rename - Rename a file
RCODE GetSectorSize - Returns the sector size of the filesystem
void pathParse - Breaks up a pathname into server, volume, directory and file
RCODE pathReduce - Strips the last path component from a pathname
RCODE pathAppend - Appends a component to a path, inserting a directory seperator char if necessary
RCODE pathToStorageString - ????
void pathCreateUniqueName - Generates a unique filename given a seed and some modifiers
FLMBOOL doesFileMatch - Compares a filename against a pattern template

 

Method Detail

Create

    RCODE Create(

        char *                    pszFileName,

        FLMUINT            uiIoFlags,

        IF_FileHdl **        ppFileHdl);

Create a new file.

    Parameters In:

char * pszFileName

 
FLMUINT uiIoFlags  

    Parameters Out:

IF_FileHdl ** ppFileHdl

 

    See Also:

[Back to Top]


CreateBlockFile

    RCODE CreateBlockFile(

        char *                pszFileName,

        FLMUINT        uiIoFlags,

        FLMUINT        uiBlockSize,

        IF_FileHdl **    ppFileHdl);

Create a new block-oriented file.  Block files are used on Windows platforms for direct I/O.

    Parameters In:

char * pszFileName  

FLMUINT uiIoFlags

 
FLMUINT uiBlockSize  

    Parameters Out:

IF_FileHdl ** ppFileHdl

 

    See Also:

[Back to Top]


CreateUnique

    RCODE CreateUnique(  

        char *                pszDirName,

        char *                pszFileExtension,

        FLMUINT        uiIoFlags,

        IF_FileHdl **    ppFileHdl);

Automatically generates a name guaranteed to be unique and creates a file with this name in the specified directory.

    Parameters In:

char * pszFileName  

char * pszFileExtension

 
FLMUINT uiIoFlags  

    Parameters Out:

IF_FileHdl ** ppFileHdl

 

    See Also:

[Back to Top]


Open

    RCODE Open(

        char *                pszFileName,

        FLMUINT        uiIoFlags,

        IF_FileHdl **    ppFileHdl);

Opens the specified file.

    Parameters In:

char * pszFileName  
FLMUINT uiIoFlags  

    Parameters Out:

IF_FileHdl ** ppFileHdl

 

    See Also:

[Back to Top]


OpenBlockFile

    RCODE OpenBlockFile(

        char *                pszFileName,

        FLMUINT        uiIoFlags,

        IF_FileHdl **    ppFileHdl);

Opens the specified block file.

    Parameters In:

char *                pszFileName  
FLMUINT        uiIoFlags  
FLMUINT        uiBlockSize  

    Parameters Out:

IF_FileHdl **        ppFileHdl

 

    See Also:

[Back to Top]


OpenDir

    RCODE OpenDir(

        char *                pszDirName,

        char *                pszPattern,

        IF_DirHdl **    ppDirHdl);

Returns a handle to the specified directory.

    Parameters In:

char * pszDirName  
char * pszPattern  

    Parameters Out:

IF_DirHdl ** ppDirHdl

 

    See Also:

[Back to Top]


CreateDir

    RCODE CreateDir(

        char *                pszDirName);

Creates the specified directory.

    Parameters In:

char * pszDirName  

    Parameters Out: none.

    See Also:

[Back to Top]


RemoveDir

    RCODE RemoveDir(

        char *             pszDirName

        FLMBOOL    bClear = FALSE);

Deletes the specified directory.

    Parameters In:

char * pszDirName Name of directory to be deleted.
FLMBOOL bClear If bClear is TRUE, will delete the contents of the directory.  If it is FALSE, and the directory is not empty, an error will be returned and the directory will not be changed.

    Parameters Out: none.

    See Also:

[Back to Top]


Exists

    RCODE Exists(

        char *             pszFileName);

Returns NE_XFLM_OK if the specified file or directory exists.

    Parameters In:

char * pszFileName Name of file or directory to be tested.

    Parameters Out: none.

    See Also:

[Back to Top]


IsDir

    FLMBOOL IsDir(

        char *             pszFileName);

Returns TRUE if the name is that of a directory.

    Parameters In:

char * pszFileName Name to be tested.

    Parameters Out: none.

    See Also:

[Back to Top]


GetTimeStamp

    RCODE RemoveDir(

        char *               pszFileName,

        FLMUINT *    puiTimeStamp);

Stores the time of the most recent modification to the specified file in puiTimeStamp.

    Parameters In:

char * pszFileName  

    Parameters Out:

FLMUINT * puiTimeStamp  

    See Also:

[Back to Top]


Delete

    RCODE Delete(

        char *               pszFileName);

Deletes the specified file.

    Parameters In:

char * pszFileName Name of file to be deleted.

    Parameters Out: none.

    See Also:

[Back to Top]


Copy

    RCODE Copy(

        char *                pszSrcFileName,

        char *                pszDestFileName,

        FLMBOOL       bOverwrite,

        FLMUINT *     puiBytesCopied);

Copies the source file to the destination file, overwriting an existing file only if bOverwrite is TRUE.  The number of bytes that were copied is returned in puiBytesCopied.

    Parameters In:

char * pszSrcFileName Name of file to be copied.
char * pszDestFileName Name of destination file is to be copied to.
FLMBOOL bOverwrite If TRUE, destination file will be overwritten if it exists.  If FALSE, and destination file exists, an error will be returned.

    Parameters Out:

FLMUINT * puiBytesCopied Returns number of bytes copied.

    See Also:

[Back to Top]


Rename

    RCODE Rename(

        char *                pszFileName,

        char *                pszNewFileName);

Renames a file.  Fails if the new file already exists.

    Parameters In:

char * pszFileName File that is to be renamed.
char * pszNewFileName Name to be given to the file being renamed.

    Parameters Out: none.

    See Also:

[Back to Top]


GetSectorSize

    RCODE GetSectorSize(

        char *                pszFileName,

        FLMUINT *     puiSectorSize);

Returns the sector size associated with the specified file.

    Parameters In:

char * pszFileName Name of file whose sector size is to be retrieved.

    Parameters Out:

FLMUINT * puiSectorSize Sector size is returned here.

    See Also:

[Back to Top]


pathParse

    void pathParse(

        char *                pszPath,

        char *                pszServer,

        char *                pszVolume,

        char *                pszDirPath,

        char *                pszFileName);

Parses the specified path up into its individual parts: Server, Volume, Directories and Filename.  Note that the output parameters are all optional.

    Parameters In:

char * pszPath File name or directory name that is to be parsed.

    Parameters Out:

char * pszServer Server name component of pszPath.
char * pszVolume Volume name component of pszPath.
char * pszDirPath Directory name component of pszPath.
char * pszFileName Short name component of pszPath.

    See Also:

[Back to Top]


pathReduce

    RCODE pathReduce(

        char *                pszPath,

        char *                pszDir,

        char *                pszPathComponent);

Strips off the last component (filename or directory) in pszPath and stores it in pszPathComponent.  The remainder of pszPath is stored in pszDir.  This function is designed to be called repeatedly to break up a full pathname into discrete components.

    Parameters In:

char * pszPath File name or directory name that is to be reduced.

    Parameters Out:

char * pszDir Directory name part of pszPath.
char * pszPathComponent Base file name of pszPath.

    See Also:

[Back to Top]


pathAppend

    RCODE pathAppend(

        char *                pszPath,

        char *                pszPathComponent);

Appends pszPathComponent to pszPath, inserting the appropriate directory separator if necessary.

    Parameters In:

char * pszPath File path that pszPathComponent is to be appended to.
char * pszPathComponent Component to be appended to pszPath.

    Parameters Out:

char * pszPath Resulting path name is returned here.

    See Also:

[Back to Top]


pathToStorageString

    RCODE pathToStorageString(

        char *                pszPath,

        char *                pszStorageString);

Convert a file path to its full path name.  The full path name is a fully qualified normalized name.  The purpose of this method is to allow two path names which may have been specified as relative paths to be converted to a full path name so they can be compared to see if they are the same file.

    Parameters In:

char * pszPath File path to be converted.

    Parameters Out:

char * pszStorageString Resulting full path name.

    See Also:

[Back to Top]


pathCreateUniqueName

    void pathCreateUniqueName(

        FLMUINT *        puiTime,

        char *                   pszFileName,

        char *                   pszFileExt,

        FLMBYTE *        pHighChars,

        FLMBOOL          bModext);

Generates a unique file name based on some parameters.  Note: Does not actually create the file itself.

In: bModext -> if TRUE then we will use the extension for collisions.
In\Out: puiTime -> a modified time stamp which is used as the base
filename. To properly set up this value, make sure
the puiTime points to a 0 the first time this routine
is called and it will be set up for you. Thereafter,
do not change it between calls.
pHighChars-> these are the 8 bits that were shifted off the top of
the time struct. It will be set up for you the first
time you call this routine if puiTime points to a 0
the first time this routine is called. Do not change
this value between calls.
pszFileName -> should be pointing to a null string on the way in.
going out it will be the complete filename.
pszFileExt -> the last char of the ext will be used for collisions,
depending on the bModext flag. If null then
the extension will be .00x where x is the collision
counter.
Notes: The counter on the collision is 0-9, a-z.

    Parameters In:

FLMUINT * puiTime A modified time stamp which is used as the base file name.  To properly set up this value, make sure it points to a FLMUINT that has a zero in it the first time this routine is called.  Thereafter, do not modify it between calls.
char * pszFileName Should be pointing to a character buffer that is empty (0 in zeroeth byte) coming in.
char * pszFileExt The last character of this will be used for collisions, depending on the bModext flag.  If NULL, the extension will be .00x where x is the collision counter.  NOTE: The counter on collisions is 0-9, a-z.
FLMBYTE * pHighChars These are the 8 bits that were shifted off the top of the time struct.  It will be set up the first time this method is called if puiTime points to a zero value.  Do not change this value between calls.
FLMBOOL bModext If TRUE, the file extension will be used to get a unique file name.

    Parameters Out:

FLMUINT * puiTime The FLMUINT pointed to by this parameter will be modified by the method.  This is so that multiple calls may be made in succession to this method and a unique file name will be generated for each time it is called.
char * pszFileName The full unique file name is returned here.
char * pszFileExt The file extension that was ultimately used will be returned here.
FLMBYTE * pHighChars The FLMBYTE pointed to by this parameter will be modified by the method.  This is so that multiple calls may be made in succession to this method and a unique file name will be generated for each time it is called.

    See Also:

[Back to Top]


doesFileMatch

    FLMBOOL doesFileMatch(

        char *                   pszFileName,

        char *                   pszTemplate);

Compares the specified file name against a template (which may contain wildcard characters).  Returns TRUE if the file name matches.

    Parameters In:

char * pszFileName File name to be compared.
char * pszTemplate Template (pattern) that pszFileName is to be compared against.

    Parameters Out: none.

    See Also:

[Back to Top]