home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / mslang / filesys / filesys.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-03  |  2.9 KB  |  93 lines

  1.  
  2. //***************************************************************************
  3. //
  4. // Class:                    CFileSystem
  5. //
  6. // Purpose:                To encapsulate access to the file system.
  7. //
  8. // Copyright:            Copyright 1993, 1994 Scott P. Leslie, All Rights Reserved.
  9. //
  10. // Version:                Version 1.0 for MS Windows 3.1 and MSVC 1.0.
  11. //
  12. // Shareware:            This class is ShareWare.  If you use it, you should register
  13. //                                it with the author.  If you do not register it after 14 days
  14. //                                of use, you must discontinue using it.
  15. //
  16. //                                Contact the author at ScotLeslie@aol.com for more info.
  17. //
  18. // Distribution:    You may distribute this class unmodified as long as all
  19. //                                accompanying documentation and notes are also distributed.
  20. //                                Object code generated from this class (or any derivation
  21. //                                of this class) can only be distributed by registered users.
  22. //
  23. // Disclaimer:        This class is provided as is with no implied or express
  24. //                                warranties.  You should test this class for your particular
  25. //                                use on non-critical data before using it in a production
  26. //                                system.
  27. //
  28. //***************************************************************************
  29.  
  30. #ifndef _CFileSystem_h_
  31. #define _CFileSystem_h_
  32.  
  33. #include "dos.h"
  34. #include "direct.h"
  35.  
  36. #include "stdafx.h"
  37.  
  38. class CFileSystem : public CObject
  39. {
  40. public:
  41.     CFileSystem();
  42.     ~CFileSystem();
  43.  
  44.     enum Attribute {
  45.         normal        = CFile::normal,
  46.         readOnly    = CFile::readOnly,
  47.         hidden        = CFile::hidden,
  48.         system        = CFile::system,
  49.         volume        = CFile::volume,
  50.         directory    = CFile::directory,
  51.         archive        = CFile::archive,
  52.     }; // Attribute
  53.  
  54.     CString *            GetDirectoryEntry(CString Wildcard = "", Attribute eFileAttrib = normal);
  55.  
  56.     CString                GetCurrentDirectory();
  57.     BOOL                    ChangeDirectory(CString NewDirectory);
  58.     BOOL                    MakeDirectory(CString NewDirectory);
  59.     BOOL                    MakePath(CString NewDirectory);
  60.     BOOL                    DeleteDirectory(CString Directory);
  61.  
  62.     CString                GetCurrentFileSystem();
  63.     BOOL                    ChangeFileSystem(char cFileSystem);
  64.     CStringList *    GetFileSystemList();
  65.  
  66.     BOOL                    RenameFile(CString OldFileName, CString NewFileName);
  67.     BOOL                    DeleteFile(CString FileName);
  68.     BOOL                    CopyFile(CString SourceFileName, CString DestFileName, unsigned long lBuffSize = 10240);
  69.  
  70.     BOOL                    CloseFile(CFile *pFile) const;
  71.  
  72.     CString                GetFileName(CString PathAndFileName);
  73.     CString                GetPath(CString PathAndFileName);
  74.  
  75.     CStringList    *    GetDirectory(CString SearchString, Attribute eFileAttrib, BOOL bRecurseSubDirs=FALSE, CStringList *pStringList = NULL);
  76.  
  77.  
  78.     CStringList *    GetSubdirList(CString SearchDir, BOOL bPathInName = TRUE);
  79.     CStringList *    GetFileList(CString SearchString, Attribute eFileAttrib);
  80.  
  81.     static void        LoadListBox(CListBox *pListBox, CStringList * pStringList);
  82.     static void        LoadComboBox(CComboBox *pComboBox, CStringList * pStringList);
  83.  
  84.     int                        MaxFileNameLength;
  85.  
  86. private:
  87.     struct _find_t    m_FileInfo;
  88.  
  89. }; // CFileSystem
  90.  
  91. #endif // _CFileSystem_h_
  92.  
  93.