home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / REGEXP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-18  |  2.4 KB  |  94 lines

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