home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.2 KB | 132 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLFilPar.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef SLFILPAR_H
- #define SLFILPAR_H
-
- #ifndef SLSTRREP_H
- #include "SLStrRep.h"
- #endif
-
- #ifndef FWFILESY_H
- #include "FWFileSy.h"
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__TYPES__)
- #include <Types.h>
- #endif
-
- //========================================================================================
- // Forward class declarations
- //========================================================================================
- class FW_ODirectorySpecification;
-
-
- //========================================================================================
- // Parsing Constants
- //========================================================================================
- const FW_Char FW_kExtensionDelimiter = (FW_Char)('.');
-
- #ifdef FW_BUILD_WIN
- const FW_Char FW_kPathDelimiter = (FW_Char)('\\');
- const FW_Char FW_kDriveDelimiter = (FW_Char)(':');
- #endif
-
- #ifdef FW_BUILD_MAC
- const FW_Char FW_kPathDelimiter = (FW_Char)(':');
- const FW_Char FW_kDriveDelimiter = (FW_Char)(':');
- #endif
-
-
- //========================================================================================
- // This is a helper for FW_PFileSpecification and FW_ODirectorySpecification.
- // It provides functions to parse file names and extract different parts.
- // The methods *can throw*, so do not export them.
- //========================================================================================
-
- FW_EXTERN_C_BEGIN
-
- extern FW_Boolean FW_PrivFileSystemParser_IsPartialPath(FW_HString pathName);
- // Returns TRUE if pathName specifies a partial pathName. This routine is
- // an implementation routine, but may be used by subclasses.
-
- extern void FW_PrivFileSystemParser_AddDelimiter(FW_HString* pathName);
- // Adds a trailing delimiter character to the pathName if one belongs
- // there.
-
- extern FW_Boolean FW_PrivFileSystemParser_HasExtension(FW_HString fileName,
- FW_CharacterPosition& dotPosition);
- // Returns TRUE if the fileName has a dot-extension. Returns the position of
- // the dot as an index into fileName.
-
- extern void FW_PrivFileSystemParser_ChangeExtension(FW_HString pathName,
- FW_HString extension,
- FW_HString* returnName);
- // Changes the Windows file extension for the file specified by pathName.
- // The new pathName is returned in returnName. If no extension existed, then
- // the new extension is just added.
-
- extern FW_Boolean FW_PrivFileSystemParser_GetExtension(FW_HString pathName,
- FW_HString* extension);
- // Gets the Windows file extension of the file specified by pathName and returns
- // it in extension. Returns TRUE if there was an extension to return.
-
- extern FW_Boolean FW_PrivFileSystemParser_GetFileName(FW_HString pathName,
- FW_HString* fileName);
- // Determines the file name and extension of pathName and returns it in fileName.
- // Returns TRUE if there was a filename to return, or FALSE if there was none.
- // Note that this doesn't throw exceptions because it can be used for directories
- // as well as files.
-
- extern FW_Boolean FW_PrivFileSystemParser_GetJustFileName(FW_HString pathName,
- FW_HString* fileName);
- // Returns the file name without extension of pathName. Returns TRUE if there
- // was a file name portion to return.
-
- extern FW_PlatformError FW_PrivFileSystemParser_PrivGetWorkingDirectory(FW_HString* pathName);
- // Return the current working directory as a text string.
-
-
- #ifdef FW_BUILD_WIN
- extern FW_Boolean FW_PrivFileSystemParser_WinGetPathName(FW_HString fullPathName,
- FW_HString* pathName);
- // Returns the path portion of fullPathName. This works for both files and
- // directories. Returns TRUE if there was a path portion to return.
-
- extern FW_Boolean FW_PrivFileSystemParser_WinGetDrivePath(FW_HString pathName,
- FW_HString* drivePath);
- // Returns the drive letter and colon character portion of pathName. Returns
- // TRUE if there was a drive letter to return.
-
- extern void FW_PrivFileSystemParser_WinExpandPartialPath(FW_HString* pathName);
- // Takes a partial pathName and expands it to a fully qualified path.
- // pathName contains the partial path on entry and the full path on exit.
- // Since the old contents of pathName get overwritten, the user may want
- // to store a copy of them somewhere.
- #endif
-
-
- #ifdef FW_BUILD_MAC
- extern OSErr FW_PrivFileSystemParser_MacGenerateFullPathName(short vRefNum,
- long dirID,
- FW_HString* pathName);
- // Generates a full Macintosh pathname based on vRefNum and dirID. Returns
- // TRUE if the path was successfully generated, otherwise returns FALSE.
-
- extern OSErr FW_PrivFileSystemParser_MacGenerateDirectory(short vRefNum,
- long dirID,
- FW_ODirectorySpecification* directory);
- // Generates a directory spec based on vRefNum and dirID. This routine can
- // be used recursively to generate a full directory pathname.
- #endif
-
- FW_EXTERN_C_END
-
- #endif
-