home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / borland / cb / setup / cbuilder / data.z / REGEXP.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  3KB  |  100 lines

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