home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / borhead.zip / REGEXP.H < prev    next >
C/C++ Source or Header  |  1994-11-09  |  3KB  |  98 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  REGEXP.H                                                              */
  4. /*                                                                        */
  5. /*------------------------------------------------------------------------*/
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 1.5
  9.  *
  10.  *      Copyright (c) 1987, 1994 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.  
  31. #if !defined(RC_INVOKED)
  32.  
  33. #if defined(__STDC__)
  34. #pragma warn -nak
  35. #endif
  36.  
  37. #endif  /* !RC_INVOKED */
  38.  
  39.  
  40. class _EXPCLASS string;
  41.  
  42. /*------------------------------------------------------------------------*/
  43. /*                                                                        */
  44. /*  class TRegexp                                                         */
  45. /*                                                                        */
  46. /*  Implements regular expression searching                               */
  47. /*                                                                        */
  48. /*------------------------------------------------------------------------*/
  49.  
  50. class _EXPCLASS TRegexp
  51. {
  52.  
  53. public:
  54.  
  55.     enum StatVal
  56.     {
  57.         OK=0,
  58.         ILLEGAL,
  59.         TOOLONG
  60.     };
  61.  
  62.     _RTLENTRY TRegexp( const char _FAR *cp );
  63.     _RTLENTRY TRegexp( const TRegexp _FAR &r );
  64.     _RTLENTRY ~TRegexp();
  65.  
  66.     TRegexp _FAR & _RTLENTRY operator = ( const TRegexp _FAR &r ) throw( xalloc );
  67.     TRegexp _FAR & _RTLENTRY operator = ( const char _FAR *cp ) throw( xalloc );
  68.     size_t _RTLENTRY find( const string _FAR &s,
  69.                            size_t _FAR *len,
  70.                            size_t start = 0 ) const;
  71.     StatVal _RTLENTRY status() throw();
  72.  
  73. private:
  74.  
  75.     void _RTLENTRY copy_pattern( const TRegexp _FAR &r ) throw( xalloc );
  76.     void _RTLENTRY gen_pattern( const char _FAR *cp ) throw( xalloc );
  77.  
  78.     unsigned char _FAR *the_pattern;
  79.     StatVal stat;
  80.     static const unsigned maxpat;
  81. };
  82.  
  83. #if defined( BI_OLDNAMES )
  84. #define BI_Regexp TRegexp
  85. #endif
  86.  
  87.  
  88. #if !defined(RC_INVOKED)
  89.  
  90. #if defined(__STDC__)
  91. #pragma warn .nak
  92. #endif
  93.  
  94. #endif  /* !RC_INVOKED */
  95.  
  96.  
  97. #endif /* __REGEXP_H */
  98.