|
BurgerLib
|
Directory contents iteration class. More...
#include <fmfile.h>

Public Member Functions | |
| DirectorySearch () | |
| Initialize a Burger::DirectorySearch class. | |
| ~DirectorySearch () | |
| Closes any open directory. | |
| Word | Open (const char *pDirName) |
| Open a directory for scanning. | |
| Word | GetNextEntry (void) |
| Iterate on a directory and return the next found filename. | |
| Word | GetNextEntryExtension (const char *pExt) |
| Iterate on a directory and return the next found filename.that matches a specific file extension. | |
| void | Close (void) |
| Closes any open directory. | |
Public Attributes | |
| WordPtr | m_uFileSize |
| Size of the file in bytes (64 bits on 64 bit CPU platforms) | |
| Burger::TimeDate_t | m_CreationDate |
| File creation time. | |
| Burger::TimeDate_t | m_ModificatonDate |
| File last modification time. | |
| Word8 | m_bDir |
| True if this is a directory. | |
| Word8 | m_bSystem |
| True if this is a system file. | |
| Word8 | m_bHidden |
| True if this file is hidden. | |
| Word8 | m_bLocked |
| True if this file is read only. | |
| char | m_Name [256] |
| Filename. | |
| Word32 | m_uFileType |
| File's type (MacOS Only) | |
| Word32 | m_uAuxType |
| File's creator code (MacOS Only) | |
Private Attributes | |
| OpaqueFSIterator * | m_pIterator |
| Directory iterator (MacOS Carbon Only) | |
| void * | m_pEnumerator |
| Filename enumerator (MacOSX Only) | |
| char * | m_pPathPrefix |
| Pathname buffer (MacOSX Only) | |
| char * | m_pPathEnd |
| Pathname ending (MacOSX Only) | |
| Word | m_bHandleOk |
| Handle is valid (MSDOS Only) | |
| short | m_sFileHandle |
| Handle to the open directory (MSDOS Only) | |
| char | m_MyFindT [44] |
| Dos FindT structure (MSDOS Only) | |
| void * | m_hDirHandle |
| Win95 file handle (Windows Only) | |
| char | m_MyFindW [592] |
| Win95 WIN32_FIND_DATAW structure (Windows Only) | |
Directory contents iteration class.
To open and traverse a directory is this classes' main purpose. Given a BurgerLib formatted pathname, open the directory and iterate over it until all the names of the files contained are presented to the application for use.
Using it is very simple...
Burger::DirectorySearch MyDir; // Open the directory for traversal Word uError = MyDir.Open("9:Directory"); if (!uError) { // No error? while (!MyDir.GetNextEntry()) { printf("Found \"%s\"!\n",MyDir.m_Name); } MyDir.Close(); }
Initialize a Burger::DirectorySearch class.
Simple initialization function.
Closes any open directory.
Closes any open directory.
Iterate on a directory and return the next found filename.
Reads the current directory opened previously by a call to Burger::DirectorySearch::Open(const char *) and initializes all of the internal public variables with information of the file that was found.
| Word Burger::DirectorySearch::GetNextEntryExtension | ( | const char * | pExt | ) |
Iterate on a directory and return the next found filename.that matches a specific file extension.
Reads the current directory opened previously by a call to Burger::DirectorySearch::Open(const char *) and initializes all of the internal public variables with information of the file that was found.
This differs from Burger::DirectorySearch::GetNextEntry(void) in that only files that end with a specific file extension are returned. This is a case insensitive search.
while (!MyDir.GetNextEntryExtension("txt")) { printf("Found text file \"%s\"!\n",MyDir.m_Name); }
| pExt | Pointer to a "C" string of the file extension being scanned for. |
| Word Burger::DirectorySearch::Open | ( | const char * | pDirName | ) |
Open a directory for scanning.
| pDirName | Pointer to the "C" string filename in BurgerLib format. |
True if this is a directory.
Word Burger::DirectorySearch::m_bHandleOk [private] |
Handle is valid (MSDOS Only)
True if this file is hidden.
True if this file is read only.
True if this is a system file.
File creation time.
void* Burger::DirectorySearch::m_hDirHandle [private] |
Win95 file handle (Windows Only)
File last modification time.
char Burger::DirectorySearch::m_MyFindT[44] [private] |
Dos FindT structure (MSDOS Only)
char Burger::DirectorySearch::m_MyFindW[592] [private] |
Win95 WIN32_FIND_DATAW structure (Windows Only)
| char Burger::DirectorySearch::m_Name[256] |
void* Burger::DirectorySearch::m_pEnumerator [private] |
Filename enumerator (MacOSX Only)
OpaqueFSIterator* Burger::DirectorySearch::m_pIterator [private] |
Directory iterator (MacOS Carbon Only)
char* Burger::DirectorySearch::m_pPathEnd [private] |
Pathname ending (MacOSX Only)
char* Burger::DirectorySearch::m_pPathPrefix [private] |
Pathname buffer (MacOSX Only)
short Burger::DirectorySearch::m_sFileHandle [private] |
Handle to the open directory (MSDOS Only)
File's creator code (MacOS Only)
Size of the file in bytes (64 bits on 64 bit CPU platforms)
File's type (MacOS Only)
1.8.0