regexp_object.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 virtual const ClassInfo *classInfo() const { return &info; }
00037 static const ClassInfo info;
00038 };
00039
00040 class RegExpProtoFuncImp : public InternalFunctionImp {
00041 public:
00042 RegExpProtoFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto, int i, int len,
00043 const Identifier &_ident);
00044
00045 virtual bool implementsCall() const;
00046 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00047
00048 enum { Exec, Test, ToString, Compile };
00049 private:
00050 int id;
00051 };
00052
00053 class RegExpImp : public ObjectImp {
00054 public:
00055 RegExpImp(RegExpPrototypeImp *regexpProto);
00056 ~RegExpImp();
00057 void setRegExp(RegExp *r);
00058 RegExp* regExp() { return reg; }
00059
00060 virtual const ClassInfo *classInfo() const { return &info; }
00061 static const ClassInfo info;
00062 private:
00063 RegExp *reg;
00064 };
00065
00066 class RegExpObjectImp : public InternalFunctionImp {
00067 public:
00068 RegExpObjectImp(ExecState *exec,
00069 FunctionPrototypeImp *funcProto,
00070 RegExpPrototypeImp *regProto);
00071 virtual ~RegExpObjectImp();
00072 virtual bool implementsConstruct() const;
00073 virtual Object construct(ExecState *exec, const List &args);
00074 virtual bool implementsCall() const;
00075 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00076
00077 Value get(ExecState *exec, const Identifier &p) const;
00078 int ** registerRegexp( const RegExp* re, const UString& s );
00079 void setSubPatterns(int num) { lastNrSubPatterns = num; }
00080 Object arrayOfMatches(ExecState *exec, const UString &result) const;
00081
00082
00083
00084
00085
00086
00087 static RegExp* makeEngine(ExecState *exec, const UString &p, const Value &flagsInput);
00088 private:
00089 UString lastString;
00090 int *lastOvector;
00091 unsigned int lastNrSubPatterns;
00092 };
00093
00094 }
00095
00096 #endif
|