home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Source / OScan.cpp < prev    next >
C/C++ Source or Header  |  1997-04-05  |  3KB  |  108 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // scanfcl.cpp
  5. // scanner classes
  6.  
  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: W:/Projects/OCL/Source/rcs/OScan.cpp 1.50 1996/08/11 23:49:30 B.STEIN Release $
  33.  
  34. #define __OCL_SOURCE__
  35.  
  36. #define OINCL_OSTRING
  37. #define OINCL_BASE
  38.  
  39. #include <ocl.hpp>
  40. #include <OFcl.hpp>
  41.  
  42. // members of scan
  43.  
  44.  
  45. OScanFcl::OScanFcl()
  46. {
  47.  setCheck(FALSE, FALSE); 
  48. }
  49.  
  50. OScanFcl::~OScanFcl() 
  51. {
  52.  good.reset(); 
  53. }
  54.  
  55.  
  56. PSZ OScanFcl::isOfType() const
  57.  return("OScanFcl"); 
  58. }
  59.  
  60.  
  61. BOOL OScanFcl::init(PCSZ FileName, PCSZ toScan)
  62. {
  63.  Filename << FileName;
  64.  return(check(toScan));
  65. }
  66.  
  67.  
  68. void OScanFcl::init(PCSZ FileName)
  69. {
  70.  Filename << FileName;
  71. }
  72.  
  73.  
  74. BOOL OScanFcl::check(PCSZ string)
  75. {
  76.  OFuzzSearch  *searcher = NULL;
  77.  BOOL         retValue;
  78.  
  79.  ToScan << string;;
  80.  
  81.  searcher = new OFuzzSearch(Filename.getText(), ToScan.getText()); 
  82.  searcher->startSearch();
  83.  
  84.  retValue = (searcher->matches.numberOfElements() != 0) ? TRUE : FALSE;
  85.  
  86.  ToScan << (PSZ) NULL; 
  87.  delete searcher;
  88.  
  89.  return(retValue);  
  90. }
  91.  
  92.  
  93. void OScanFcl::checkFiles(PCSZ text)
  94. {
  95.  pOString temp = files.getFirst();
  96.  
  97.  while((temp) && (!stopASAP))
  98.   {
  99.    init(temp->getText());
  100.    if (check(text))
  101.      good << temp->getText();
  102.    temp = files.getNext(); 
  103.   }
  104. }
  105.  
  106. // end of source
  107.