modules/up/src/gnug++/Regex.h

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. Regex

   1 // This may look like C code, but it is really -*- C++ -*-
   2 /* 
   3 Copyright (C) 1988 Free Software Foundation
   4     written by Doug Lea (dl@rocky.oswego.edu)
   5 
   6 This file is part of the GNU C++ Library.  This library is free
   7 software; you can redistribute it and/or modify it under the terms of
   8 the GNU Library General Public License as published by the Free
   9 Software Foundation; either version 2 of the License, or (at your
  10 option) any later version.  This library is distributed in the hope
  11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13 PURPOSE.  See the GNU Library General Public License for more details.
  14 You should have received a copy of the GNU Library General Public
  15 License along with this library; if not, write to the Free Software
  16 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17 */
  18 
  19 
  20 #ifndef _Regex_h
  21 #ifdef __GNUG__
  22 #pragma interface
  23 #endif
  24 #define _Regex_h 1
  25 
  26 #undef OK
  27 
  28 #if defined(SHORT_NAMES) || defined(VMS)
  29 #define re_compile_pattern      recmppat
  30 #define re_pattern_buffer       repatbuf
  31 #define re_registers            reregs
  32 #endif
  33 
  34 struct re_pattern_buffer;       // defined elsewhere
  35 struct re_registers;
  36 
  37 class Regex
     /* [<][>][^][v][top][bottom][index][help] */
  38 {
  39 private:
  40 
  41                      Regex(const Regex&) {}  // no X(X&)
  42   void               operator = (const Regex&) {} // no assignment
  43 
  44 protected:
  45   re_pattern_buffer* buf;
  46   re_registers*      reg;
  47 
  48 public:
  49                      Regex(const char* t, 
  50                            int fast = 0, 
  51                            int bufsize = 40, 
  52                            const char* transtable = 0);
  53 
  54                     ~Regex();
  55 
  56   int                match(const char* s, int len, int pos = 0) const;
  57   int                search(const char* s, int len, 
  58                             int& matchlen, int startpos = 0) const;
  59   int                match_info(int& start, int& length, int nth = 0) const;
  60 
  61   int                OK() const;  // representation invariant
  62 };
  63 
  64 // some built in regular expressions
  65 
  66 extern const Regex RXwhite;          // = "[ \n\t\r\v\f]+"
  67 extern const Regex RXint;            // = "-?[0-9]+"
  68 extern const Regex RXdouble;         // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
  69                                      //    \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
  70                                      //    \\([eE][---+]?[0-9]+\\)?"
  71 extern const Regex RXalpha;          // = "[A-Za-z]+"
  72 extern const Regex RXlowercase;      // = "[a-z]+"
  73 extern const Regex RXuppercase;      // = "[A-Z]+"
  74 extern const Regex RXalphanum;       // = "[0-9A-Za-z]+"
  75 extern const Regex RXidentifier;     // = "[A-Za-z_][A-Za-z0-9_]*"
  76 
  77 
  78 #endif

/* [<][>][^][v][top][bottom][index][help] */