Main Page   Class Hierarchy   Compound List   File List   Compound Members  

mregexp.h

00001 /***************************************************************************
00002  *   This file is part of the MagiC++ library.                             *
00003  *                                                                         *
00004  *   Copyright (C) 1998-2001 Marko Grönroos <magi@iki.fi>                  *
00005  *                                                                         *
00006  ***************************************************************************
00007  *                                                                         *
00008  *  This library is free software; you can redistribute it and/or          *
00009  *  modify it under the terms of the GNU Library General Public            *
00010  *  License as published by the Free Software Foundation; either           *
00011  *  version 2 of the License, or (at your option) any later version.       *
00012  *                                                                         *
00013  *  This library is distributed in the hope that it will be useful,        *
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
00016  *  Library General Public License for more details.                       *
00017  *                                                                         *
00018  *  You should have received a copy of the GNU Library General Public      *
00019  *  License along with this library; see the file COPYING.LIB.  If         *
00020  *  not, write to the Free Software Foundation, Inc., 59 Temple Place      *
00021  *  - Suite 330, Boston, MA 02111-1307, USA.                               *
00022  *                                                                         *
00023  ***************************************************************************/
00024 
00025 #ifndef __MAGIC_MREGEXP_H__
00026 #define __MAGIC_MREGEXP_H__
00027 
00028 #include <sys/types.h>
00029 #include <regex.h>
00030 
00031 // Externals:
00032 
00033 namespace MagiC {
00034     // Externals
00035     class String;
00036 
00037     // Internals
00038     class RegExp;
00039 }
00040 using namespace MagiC;
00041 
00042 template <class TYPE> class Array;
00043 
00044 
00046 //                                                                          //
00047 //                     ----              -----                              //
00048 //                     |   )  ___        |          --                      //
00049 //                     |---  /   )  ___  |---  \ / |  )                     //
00050 //                     | \   |---  (   \ |      X  |--                      //
00051 //                     |  \   \__   ---/ |____ / \ |                        //
00052 //                                  __/                                     //
00054 
00055 class MagiC::RegExp { // : public Object
00056     
00057     regex_t*    regt;
00058   public:
00059     // Mahdolliset käännöksissä tai vertailuissa havaitut virheet
00060     int         errcode;
00061 
00062                 RegExp      () {regt=NULL; errcode=0;}
00063                 RegExp      (const char* expr) {regt=NULL; errcode=0; make (expr);}
00064                 ~RegExp     ();
00065 
00066     // Esikääntää ekspression. Palauttaa !=0 virheen sattuessa
00067     int         make        (const char* expr);
00068 
00069     // Palauttaa 1 jos sovitus onnistui
00070     int         match       (const char* string);
00071 
00072     // Kuten yllä, mutta tallentaa aliekspressioiden tulokset results-vektoriin
00073     int         match       (const String& string, Array<String>& results);
00074 
00075     // Palauttaa virheen kuvauksen merkkijonona
00076     String      geterror    () const;
00077 };
00078 
00079 #endif

Generated at Tue Dec 4 19:53:27 2001 for MagiC++ by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001