home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / regexp.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  2.4 KB  |  94 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  REGEXP.H                                                              */
  4. /*                                                                        */
  5. /*------------------------------------------------------------------------*/
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 10.0
  9.  *
  10.  *      Copyright (c) 1998, 2000 by Inprise Corporation
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. /* $Revision:   9.3  $        */
  16.  
  17. #ifndef __cplusplus
  18. #error Must use C++ for REGEXP.H
  19. #endif
  20.  
  21. #ifndef __REGEXP_H
  22. #define __REGEXP_H
  23.  
  24. #if !defined(___DEFS_H)
  25. #include <_defs.h>
  26. #endif
  27.  
  28. #if !defined( __EXCEPT_H )
  29. #include <except.h>
  30. #endif
  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. /*------------------------------------------------------------------------*/
  42. /*                                                                        */
  43. /*  class TRegexp                                                         */
  44. /*                                                                        */
  45. /*  Implements regular expression searching                               */
  46. /*                                                                        */
  47. /*------------------------------------------------------------------------*/
  48.  
  49. class _EXPCLASS TRegexp
  50. {
  51.  
  52. public:
  53.  
  54.     enum StatVal
  55.     {
  56.         OK=0,
  57.         ILLEGAL,
  58.     NOMEMORY,
  59.         TOOLONG
  60.     };
  61.  
  62.     _RTLENTRY TRegexp( const char *cp );
  63.     _RTLENTRY TRegexp( const TRegexp &r );
  64.     _RTLENTRY ~TRegexp();
  65.  
  66.     TRegexp & _RTLENTRY operator = ( const TRegexp &r ) throw();
  67.     TRegexp & _RTLENTRY operator = ( const char *cp )   throw();
  68.     size_t _RTLENTRY find( const char *cp,
  69.                            size_t *len,
  70.                            size_t start = 0 ) const;
  71.     StatVal _RTLENTRY status() throw() { return stat; }
  72.  
  73. private:
  74.  
  75.     void _RTLENTRY copy_pattern( const TRegexp &r ) throw();
  76.     void _RTLENTRY gen_pattern( const char *cp )    throw();
  77.  
  78.     unsigned char *the_pattern;
  79.     StatVal stat;
  80.     static const unsigned maxpat;
  81. };
  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.