1 #ifndef _CEGFILESPEC_ 2 #define _CEGFILESPEC_ 3 4 5 #include "UtilStr.h" 6 #include "CEgErr.h" 7 8 9 class CEgFileSpec { 10 11 protected: 12 UtilStr mSpecData; 13 long mFileType; 14 15 16 public: 17 CEgFileSpec(); 18 CEgFileSpec( const char* inPathName, long inType = 'TEXT' ); 19 CEgFileSpec( const CEgFileSpec& inSpec ); 20 21 22 23 // Returns 1 is the file is found, 2 if the folder is found, 0 if not found 24 int Exists() const; 25 26 // Appends "1", "2", "3", ... until the file name is unique/not taken 27 void MakeUnique(); 28 29 void Assign( const CEgFileSpec& inSpec ); 30 void AssignPathName( const char* inPathName ); 31 void Assign( const void* inOSSpecPtr, long inType = 'TEXT' ); 32 33 CEgErr Duplicate( const CEgFileSpec& inDestSpec ) const; 34 void SaveAs( const CEgFileSpec& inDestSpec ) const; 35 void ChangeExt( const char* inExt ); 36 37 void Delete() const; 38 long GetType() const; 39 void SetType( long inType ); 40 41 const void* OSSpec() const; 42 43 // Post: Returns the filename of this spec (without extension) 44 // Usgae: "Blah.BL" ==> Returns "Blah" in <outFileName> 45 void GetFileName( UtilStr& outFileName ) const; 46 47 // Post: Sets this spec's filename, keeping the path information the same. 48 void Rename( const UtilStr& inNewName ); 49 50 void AssignFolder( const char* inFolderName ); 51 52 }; 53 54 #endif 55 56 57 58