home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OFcl.hpp < prev    next >
C/C++ Source or Header  |  1996-01-16  |  5KB  |  146 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OFcl.hpp
  5.  
  6. // file collector
  7.  
  8. /*
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  15.  *    endorse or promote products derived from this software
  16.  *    without specific prior written permission.
  17.  * 3. See OCL.INF for a detailed copyright notice.
  18.  *
  19.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  20.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29.  * SUCH DAMAGE.
  30.  */
  31.  
  32. // $Header: E:/Projects/OCL/Include/rcs/OFcl.hpp 1.12 1996/01/16 10:12:18 B.STEIN Release B.STEIN $
  33.  
  34. #ifndef FCL_INCLUDED
  35.   #define FCL_INCLUDED
  36.  
  37.  
  38. #ifndef OSTRING_INCLUDED
  39.   #include <OString.hpp>
  40. #endif
  41.  
  42. #ifndef LIST_INCLUDED
  43.   #include <OList.hpp>
  44. #endif
  45.  
  46. #ifndef LOSTRING_INCLUDED
  47.   #include <lOString.hpp>
  48. #endif
  49.  
  50. typedef class OFcl *pOFcl;
  51.  
  52. class __CPP_EXPORT__ OFcl
  53.   : public OCLObject
  54. {
  55.  protected:
  56.      BOOL            stopASAP;
  57.  
  58.  private:
  59.      PFILEFINDBUF3   pffb;
  60.      OString         filespec;
  61.      OString         ext;
  62.      PBYTE           tmp;
  63.      ULONG           ulMaxFiles;
  64.      ULONG           bufSize;
  65.      APIRET          rc;
  66.      BOOL            recurse;
  67.      BOOL            checkDate;
  68.      BOOL            checkTime;
  69.  
  70.      void
  71.         setupFilebuf (),                        // allocate space for the buffer
  72.         finddirs     (PSZ  dir),                // find dirs in case of recursion
  73.         finddrives   (PCSZ spec),               // find all non removable drives
  74.         findfiles    (OListItem<OString> *tmp), // find all files
  75.         addfiles     (),                        // set all found file into List this->files
  76.         adddirs      (PCSZ dir),                // set all found dirs into List this->dirs
  77.         copy         ();                        // copy all batches into out
  78.  
  79.      BOOL
  80.         hasDate      (PFILEFINDBUF3 buf),
  81.         hasTime      (PFILEFINDBUF3 buf);
  82.  
  83.  public:
  84.  
  85.      lOString        dirs,                      // List of found dirs
  86.                      files;                     // List of found files
  87.      ULONG           AttrMask,                  // attribute mask (default FILE_NORMAL)
  88.                      space,                     // amount of space used by all found files
  89.                      found;                     // count of found files
  90.      DATETIME        *DateTime;
  91.  
  92.      OFcl();                                    // constructor
  93.  
  94.      virtual
  95.         ~OFcl();                                // destructor
  96.  
  97.      virtual
  98.         PSZ isOfType () const; 
  99.  
  100.      void
  101.         fclinit      (),                       // delete all Lists
  102.         setCheck     (BOOL date, BOOL time),
  103.         collect      (PCSZ spec,               // collect files with this mask
  104.                       BOOL rec,                // recursive or not
  105.                       BOOL local),             // all local drives?
  106.         fclstop      ();                       // stops the scanner immediatly
  107. };
  108.  
  109.  
  110.  
  111.  
  112. typedef class OScanFcl *pOScanFcl;
  113.  
  114. class __CPP_EXPORT__ OScanFcl
  115.    : public OFcl
  116. {
  117.  private:
  118.     PSZ             Buffer;
  119.     OString         ToScan;
  120.  
  121.  public:
  122.     lOString        good;
  123.     ifstream        file;
  124.  
  125.  
  126.     OScanFcl        ();
  127.     virtual
  128.        ~OScanFcl    ();
  129.  
  130.     virtual
  131.        PSZ isOfType () const; 
  132.  
  133.     BOOL init       (PCSZ FileName, PCSZ toScan);
  134.     void init       (PCSZ FileName);
  135.     void release    ();
  136.     BOOL check      (PCSZ string);
  137.     void checkFiles (PCSZ text);
  138. };
  139.  
  140.  
  141.  
  142.  
  143. #endif // FCL_INCLUDED
  144.  
  145. // end of source
  146.