kjs Library API Documentation

regexp_object.h

00001 // -*- c-basic-offset: 2 -*-
00002 /*
00003  *  This file is part of the KDE libraries
00004  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser General Public
00017  *  License along with this library; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef _REGEXP_OBJECT_H_
00023 #define _REGEXP_OBJECT_H_
00024 
00025 #include "internal.h"
00026 #include "function_object.h"
00027 #include "regexp.h"
00028 
00029 namespace KJS {
00030   class ExecState;
00031   class RegExpPrototypeImp : public ObjectImp {
00032   public:
00033     RegExpPrototypeImp(ExecState *exec,
00034                        ObjectPrototypeImp *objProto,
00035                        FunctionPrototypeImp *funcProto);
00036   };
00037 
00038   class RegExpProtoFuncImp : public InternalFunctionImp {
00039   public:
00040     RegExpProtoFuncImp(ExecState *exec,
00041                        FunctionPrototypeImp *funcProto, int i, int len);
00042 
00043     virtual bool implementsCall() const;
00044     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00045 
00046     enum { Exec, Test, ToString };
00047   private:
00048     int id;
00049   };
00050 
00051   class RegExpImp : public ObjectImp {
00052   public:
00053     RegExpImp(RegExpPrototypeImp *regexpProto);
00054     ~RegExpImp();
00055     void setRegExp(RegExp *r) { reg = r; }
00056     RegExp* regExp() const { return reg; }
00057 
00058     virtual const ClassInfo *classInfo() const { return &info; }
00059     static const ClassInfo info;
00060   private:
00061     RegExp *reg;
00062   };
00063 
00064   class RegExpObjectImp : public InternalFunctionImp {
00065   public:
00066     RegExpObjectImp(ExecState *exec,
00067                     FunctionPrototypeImp *funcProto,
00068                     RegExpPrototypeImp *regProto);
00069     virtual ~RegExpObjectImp();
00070     virtual bool implementsConstruct() const;
00071     virtual Object construct(ExecState *exec, const List &args);
00072     virtual bool implementsCall() const;
00073     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00074 
00075     Value get(ExecState *exec, const UString &p) const;
00076     int ** registerRegexp( const RegExp* re, const UString& s );
00077     void setSubPatterns(int num) { lastNrSubPatterns = num; }
00078     Object arrayOfMatches(ExecState *exec, const UString &result) const;
00079   private:
00080     UString lastString;
00081     int *lastOvector;
00082     uint lastNrSubPatterns;
00083   };
00084 
00085 } // namespace
00086 
00087 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:08:34 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001