/* * WILDCARD.H * * Header file for ArchiveLib 1.0 * * Copyright (c) 1994 Greenleaf Software, Inc. * All Rights Reserved * * DESCRIPTION * * This file contains the class declaration for ALWildCardExpander, * the class used to expand wildcard file specifications under * DOS and Win32s. * * CLASS DEFINITIONS: * * ALWildCardExpander * * ENUMERATED TYPES: * * ALExpanderState (embedded in ALWildCardExpander) * * REVISION HISTORY * * May 26, 1994 1.0A : First release * */ #ifndef _WILDCARD_H #define _WILDCARD_H // #include #include "arclib.h" #if defined( __cplusplus ) /* * class ALOpenInputFile * * DESCRIPTION * * This class is used to expand wild card specifications on a DOS * or NT file system. Note that you can do exciting things with this, like * traversing through subdirectories, and separate various specs using * commas or white space. * * DATA MEMBERS * * mState : The current state of the expander. This is a value * from ALExpander state that lets use keep track * of where we are between calls to the expander. * * mpNextExpander : If we are traversing subdirectories, we will * open a new expander for each subdirectory. This * is a pointer to any subdirectory we might already * have open for a search in progress. * * mInputLine : The list of wildcard filespecs passed in as an * argument. This gets whittled away, and will be * smaller and smaller as all the names are parsed out. * * mFullWildName : The current wild card file spec that is being * expanded. * * mWildNameOnly : The current wild name that is being expanded, * stripped of its drive and path information. * * mWildPathOnly : The current drive and path being expanded, stripped * of its filename and extension. * * mResultFileName : The file name that is returned to the calling * program. * * mFindFileData : Under Win32s, this holds data about the file we * found. * * mFindFileHandle : Under Win32s, this is a handle used during the * wildcard expansion. * * mpFfblk : Under MS-DOS, this structure holds the state of * the wildcard expansion in progress. * * miTraverseFlag : This flag indicates whether the search should traverse * traverse through subdirectories or just search * in the current directory. * * mCase : Indicates whether file names should always be forced * to upper case, forced to lower case, or left mixed. * * MEMBER FUNCTIONS * * ALWildCardExpander() : Constructor, everything we need to know to * perform the search is defined here. * ~ALWildCardExpander() : Destructor. * operator new() : Memory allocation function, used when the * library is in a DLL. * GetNextWildName() : Protected routine to get the next wild name * from the input line. * GetNextFile() : The function to get the next expanded file * name. It keeps chunking out names until * the search is complete. * * REVISION HISTORY * * May 26, 1994 1.0A : First release * */ class AL_CLASS_TYPE ALWildCardExpander { /* * Constructors, destructors, assignment operators, declarations */ protected : enum ALExpanderState { GET_NEXT_WILD_NAME, GET_FIRST_FILE_NAME, GET_NEXT_FILE_NAME, GET_FIRST_DIRECTORY, GET_NEXT_DIRECTORY, }; public : AL_PROTO ALWildCardExpander( const char AL_DLL_FAR *file_list, int traverse_flag = 0, ALCase name_case = AL_LOWER ); AL_PROTO ~ALWildCardExpander(); #if defined( AL_USING_DLL ) || defined( AL_BUILDING_DLL ) void AL_DLL_FAR * AL_PROTO operator new( size_t size ); #endif /* * Disable copy constructor and assignment operator */ protected : ALWildCardExpander AL_DLL_FAR & AL_PROTO operator=( ALWildCardExpander AL_DLL_FAR & ); AL_PROTO ALWildCardExpander( ALWildCardExpander AL_DLL_FAR & ); /* * Member functions */ protected : int AL_PROTO GetNextWildName(); public : char AL_DLL_FAR * AL_PROTO GetNextFile(); /* * Data members */ protected : ALExpanderState mState; ALWildCardExpander AL_DLL_FAR *mpNextExpander; ALName mInputLine; ALName mFullWildName; ALName mWildNameOnly; ALName mWildPathOnly; ALName mResultFileName; #if defined( AL_WIN32S ) WIN32_FIND_DATA mFindFileData; HANDLE mFindFileHandle; #else struct find_t AL_DLL_FAR *mpFfblk; #endif int miTraverseFlag; public : const ALCase mCase; AL_CLASS_TAG( _ALWildCardExpanderTag ); }; #endif /* #if defined( __cplusplus ) */ #endif /* #ifdef _WINMON_H */