home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cslio205.zip / INCLUDE / CSDIR.H < prev    next >
C/C++ Source or Header  |  1997-01-21  |  2KB  |  96 lines

  1. /***********************************************************************
  2.  
  3.                        CSA Library, Free Evaluation Version 2.0.5 
  4.                                        Release: January 22th 1997 
  5.  
  6.        Header file for the directory class.
  7.  
  8.        This class can be used to travers through a
  9.        directory to obtain all file names.
  10.        It ignores all file attributes.
  11.  
  12.        There is no support for a recursive descent.
  13.  
  14.                                            Copyright(c) 1994-1997 
  15.                                                           ComBits 
  16.                                                   The Netherlands 
  17. ***********************************************************************/
  18. #ifndef __CSDIR_H
  19. #define __CSDIR_H
  20.  
  21.  
  22. #include "cstypes.h"
  23. #include "csdate.h"
  24. #include "csfile.h"
  25.  
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. ////////////////////// The CSDIR class //////////////////////////////////////
  29. /////////////////////////////////////////////////////////////////////////////
  30.  
  31.  
  32.  
  33. class CSDIR: public csDATE, public FILE_NAME
  34. {
  35.  
  36. #if (defined( _CP_030))
  37.       struct stat    statbuf;
  38.       struct dirent *dirp;
  39.       DIR           *dp;
  40. #endif
  41.  
  42. #if (defined( _CP_001))
  43.       int first;
  44.       csSTR nam;
  45.       struct ffblk  ff;
  46. #endif
  47.  
  48. #if (defined( _CP_002a) || defined(_CP_002c))
  49.       int first;
  50.       csSTR nam;
  51.       struct _find_t  ff;
  52. #endif
  53.  
  54. #if (defined( _CP_002b) )
  55.       int first;
  56.       csSTR nam;
  57.       struct _finddata_t  ff;
  58.       long hFile;
  59. #endif
  60.  
  61. #if (defined(_CP_004))
  62.       int first;
  63.       csSTR nam;
  64.       struct find_t  ff;
  65. #endif
  66.  
  67.  
  68.   private:
  69.       int     IsOpen;
  70.       csCHAR *NameBuf;
  71.       csCHAR *p;
  72.  
  73.  
  74.    public:
  75.  
  76.  
  77.       CSDIR(void);
  78.       virtual
  79.      ~CSDIR(void);
  80.  
  81.       int open(csCHAR *name);  // 'Open' a directoru for reading.
  82.       int rewind(void);        // Done automatically by open();
  83.       int read(void);          // Read the next entry.
  84.  
  85.       // 0 = error, 1=dir, 2=file, 3=something else
  86.       int type(void);
  87.       int close(void);
  88.       long size(void);
  89.  
  90. };
  91.  
  92.  
  93.  
  94.  
  95. #endif
  96.