home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / REGEXP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  2.2 KB  |  78 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  REGEXP.H                                                              */
  4. /*                                                                        */
  5. /*------------------------------------------------------------------------*/
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.0
  9.  *
  10.  *      Copyright (c) 1987, 1993 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef __cplusplus
  16. #error Must use C++ for REGEXP.H
  17. #endif
  18.  
  19. #ifndef __REGEXP_H
  20. #define __REGEXP_H
  21.  
  22. #if !defined(___DEFS_H)
  23. #include <_defs.h>
  24. #endif
  25.  
  26. #if !defined( __EXCEPT_H )
  27. #include <except.h>
  28. #endif
  29.  
  30. class _EXPCLASS string;
  31.  
  32. /*------------------------------------------------------------------------*/
  33. /*                                                                        */
  34. /*  class TRegexp                                                         */
  35. /*                                                                        */
  36. /*  Implements regular expression searching                               */
  37. /*                                                                        */
  38. /*------------------------------------------------------------------------*/
  39.  
  40. class _EXPCLASS TRegexp
  41. {
  42.  
  43. public:
  44.  
  45.     enum StatVal
  46.     {
  47.         OK=0,
  48.         ILLEGAL,
  49.         TOOLONG
  50.     };
  51.  
  52.     _RTLENTRY TRegexp( const char _FAR *cp );
  53.     _RTLENTRY TRegexp( const TRegexp _FAR &r );
  54.     _RTLENTRY ~TRegexp();
  55.  
  56.     TRegexp _FAR & _RTLENTRY operator = ( const TRegexp _FAR &r ) throw( xalloc );
  57.     TRegexp _FAR & _RTLENTRY operator = ( const char _FAR *cp ) throw( xalloc );
  58.     size_t _RTLENTRY find( const string _FAR &s,
  59.                            size_t _FAR *len,
  60.                            size_t start = 0 ) const;
  61.     StatVal _RTLENTRY status() throw();
  62.  
  63. private:
  64.  
  65.     void _RTLENTRY copy_pattern( const TRegexp _FAR &r ) throw( xalloc );
  66.     void _RTLENTRY gen_pattern( const char _FAR *cp ) throw( xalloc );
  67.  
  68.     unsigned char _FAR *the_pattern;
  69.     StatVal stat;
  70.     static const unsigned maxpat;
  71. };
  72.  
  73. #if defined( BI_OLDNAMES )
  74. #define BI_Regexp TRegexp
  75. #endif
  76.  
  77. #endif /* __REGEXP_H */
  78.