Classes | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends

Burger::FileManager Struct Reference

Global file system manager. More...

#include <fmfile.h>

Collaboration diagram for Burger::FileManager:
Collaboration graph
[legend]

List of all members.

Classes

struct  ExpandCache_t

Static Public Member Functions

static void BURGER_API Init (void)
 Initialize the global file system manager.
static void BURGER_API Shutdown (void)
 Shut down the global file system manager.
static Word BURGER_API GetVolumeName (Burger::Filename *pOutput, Word uVolumeNum)
 Return the name of a drive.
static Word BURGER_API GetVolumeNumber (const char *pInput)
 Given a volume name, return the volume number it's mounted on.
static void BURGER_API DefaultPrefixes (void)
 Set the initial default prefixs for a power up state.
static Word BURGER_API GetPrefix (Filename *pOutput, Word uPrefixNum)
 Return the contents of a prefix.
static Word BURGER_API SetPrefix (Word uPrefixNum, const char *pPrefixName)
static void BURGER_API PopPrefix (Word uPrefixNum)
 Remove the last entry of a prefix.
static Word BURGER_API GetModificationTime (const char *pFileName, Burger::TimeDate_t *pOutput)
static Word BURGER_API GetModificationTimeNative (const Burger::Filename *pFileName, Burger::TimeDate_t *pOutput)
static Word BURGER_API GetCreationTime (const char *pFileName, Burger::TimeDate_t *pOutput)
static Word BURGER_API GetCreationTimeNative (const Burger::Filename *pFileName, Burger::TimeDate_t *pOutput)
static Word BURGER_API DoesFileExist (const char *pFileName)
static Word BURGER_API DoesFileExistNative (const Burger::Filename *pFileName)
static Word BURGER_API AreLongFilenamesAllowed (void)
 Returns true if long filenames are allowed.

Static Public Attributes

static const Word FULLPATHSIZE = 2048
 Maximum pathname size for Burgerlib.
static const Word PREFIXCURRENT = 8
 8: Current working directory at application launch
static const Word PREFIXAPPLICATION = 9
 9: Directory where the application resides
static const Word PREFIXBOOT = 32
 "*:" Boot volume prefix number
static const Word PREFIXPREFS = 33
 "@:" User preferences folder prefix number
static const Word PREFIXSYSTEM = 34
 "$:" System volume folder prefix number
static const Word PREFIXMAX = 35
 Maximum number of pathname prefixes.
static FileManager g_FileManager
 Global instance of the file manager.

Private Member Functions

void ReleasePrefixes (void)
 Reset all file prefixes.

Static Private Member Functions

static void InitDirectoryCache (void)
static void PurgeDirectoryCache (void)

Private Attributes

const char * m_pPrefix [Burger::FileManager::PREFIXMAX]
 Array of Prefix strings.
Word8 m_bAllowed
 True if MS/DOS has long filename support (MSDOS Only).
Word m_uBootNameSize
 Length of the boot volume name (MACOSX Only).
Word8 m_bGotBootName
 TRUE if I tested for the boot volume name (MACOSX Only).
char m_BootName [256]
 Boot volume name in the format ":FooBar" (Not zero terminated) (MACOSX Only).
ExpandCache_t m_DirectoryCache [DIRCACHESIZE]
 Directory cache (MAC Classic/Carbon Only).

Static Private Attributes

static const Word DIRCACHESIZE = 8
 Number of cache entries.

Friends

class Filename

Detailed Description

Global file system manager.

Since file systems are all tied to a single device such as a hard drive or DVD Rom, all file calls are routed through a singleton class to enable Burgerlib to prioritize file streaming to reduce seeks and read/write operations for peak performance.


Member Function Documentation

Word BURGER_API Burger::FileManager::AreLongFilenamesAllowed ( void   )  [static]

Returns true if long filenames are allowed.

On some file systems, only 8.3 filenames are permitted. Test if support for longer than 8.3 filenames is present and if so, return TRUE, otherwise return FALSE.

This function returns TRUE on all target platforms except BURGER_MSDOS, the MS/DOS target performs a check to see if it's running under Windows 95 or higher and if so, Burgerlib will automatically support long filenames.

void BURGER_API Burger::FileManager::DefaultPrefixes ( void   )  [static]

Set the initial default prefixs for a power up state.

Sets these prefixes based on the current setup of the machine the application is running on.

: = Boot volume $: = System folder @: = Prefs folder 8: = Default directory 9: = Application directory

Word BURGER_API Burger::FileManager::DoesFileExist ( const char *  pFileName  )  [static]
Word BURGER_API Burger::FileManager::DoesFileExistNative ( const Burger::Filename pFileName  )  [static]
Word BURGER_API Burger::FileManager::GetCreationTime ( const char *  pFileName,
Burger::TimeDate_t pOutput 
) [static]
Word BURGER_API Burger::FileManager::GetCreationTimeNative ( const Burger::Filename pFileName,
Burger::TimeDate_t pOutput 
) [static]
Word BURGER_API Burger::FileManager::GetModificationTime ( const char *  pFileName,
Burger::TimeDate_t pOutput 
) [static]
Word BURGER_API Burger::FileManager::GetModificationTimeNative ( const Burger::Filename pFileName,
Burger::TimeDate_t pOutput 
) [static]
Word BURGER_API Burger::FileManager::GetPrefix ( Burger::Filename pOutput,
Word  uPrefixNum 
) [static]

Return the contents of a prefix.

Given a prefix number, fill in a Burger::Filename structure with a copy of the prefix pathname. The string could be an empty string in the case of an unused or NULL prefix.

Parameters:
pOutput Pointer to a Burger::Filename class to store the string
uPrefixNum Index to the requested prefix to obtain
Returns:
Zero if no error, non-zero if error
Word BURGER_API Burger::FileManager::GetVolumeName ( Burger::Filename pOutput,
Word  uVolumeNum 
) [static]

Return the name of a drive.

Given a drive number (0-??), return the name of the volume in the format of ":Volume name:". The function will guarantee the existance of the colons.

Note:
This function should be used with caution. Only mounted drives would return immdiately and if the drive has ejectable media may take a while for it to respond to a volume name query.
Parameters:
pOutput A Burger::Filename structure to contain the filename (Can be NULL)
uDriveNum A valid drive number from 0-?? with ?? being the maximum number of drives in the system
Returns:
0 if no error, non-zero if an error occured
Word BURGER_API Burger::FileManager::GetVolumeNumber ( const char *  pVolumeName  )  [static]

Given a volume name, return the volume number it's mounted on.

Scanning all the dos volumes, I will search for a drive that is labeled by the input name. The input is in the form of ":home:". The search is case insensitive.

Parameters:
pVolumeName Valid pointer to "C" string in the form of ":name:"
Returns:
Volume number from 0-max drives and -1 in case of the volume was not found.
Note:
I do NOT search floppy drives A: and B: on MSDOS and Windows platforms. This is to prevent an annoying error for bad media.
void BURGER_API Burger::FileManager::Init ( void   )  [static]

Initialize the global file system manager.

Call this function once on startup to start up the burgerlib file manager. This function's primary purpose is to initialize the default prefixes.

static void Burger::FileManager::InitDirectoryCache ( void   )  [static, private]
void BURGER_API Burger::FileManager::PopPrefix ( Word  uPrefixNum  )  [static]

Remove the last entry of a prefix.

Given a prefix number, pop off the last entry so that it effectively goes up one entry in a directory hiearchy. Imagine performing the operation "cd .." on the prefix.

This can force the prefix to become an empty string if the prefix is pointing to a root folder.

Parameters:
uPrefixNum Index to the prefix to modify.
static void Burger::FileManager::PurgeDirectoryCache ( void   )  [static, private]
void Burger::FileManager::ReleasePrefixes ( void   )  [private]

Reset all file prefixes.

Clear all file prefixes and release any memory allocated for them

Word BURGER_API Burger::FileManager::SetPrefix ( Word  uPrefixNum,
const char *  pPrefixName 
) [static]
void BURGER_API Burger::FileManager::Shutdown ( void   )  [static]

Shut down the global file system manager.

Call this function once on shutdown to the burgerlib file manager. This function's primary purpose is to release all allocated memory and send out a report in case any files are still open on debug builds. The application is responsible for shutting down file usage before application shutdown.


Friends And Related Function Documentation

friend class Filename [friend]

Member Data Documentation

const Word Burger::FileManager::DIRCACHESIZE = 8 [static, private]

Number of cache entries.

const Word Burger::FileManager::FULLPATHSIZE = 2048 [static]

Maximum pathname size for Burgerlib.

Global instance of the file manager.

True if MS/DOS has long filename support (MSDOS Only).

TRUE if I tested for the boot volume name (MACOSX Only).

char Burger::FileManager::m_BootName[256] [private]

Boot volume name in the format ":FooBar" (Not zero terminated) (MACOSX Only).

Directory cache (MAC Classic/Carbon Only).

Array of Prefix strings.

Length of the boot volume name (MACOSX Only).

9: Directory where the application resides

"*:" Boot volume prefix number

8: Current working directory at application launch

const Word Burger::FileManager::PREFIXMAX = 35 [static]

Maximum number of pathname prefixes.

"@:" User preferences folder prefix number

"$:" System volume folder prefix number