Changeset 27405 in webkit for trunk/JavaScriptCore/kjs/regexp_object.h
- Timestamp:
- Nov 3, 2007, 9:28:51 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/regexp_object.h
r27393 r27405 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 * This file is part of the KDE libraries4 2 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 3 * Copyright (C) 2003, 2007 Apple Inc. All Rights Reserved. 5 4 * 6 5 * This library is free software; you can redistribute it and/or … … 27 26 28 27 namespace KJS { 29 class ExecState;30 class RegExpPrototype : public JSObject {31 public:32 RegExpPrototype(ExecState *exec,33 ObjectPrototype *objProto,34 FunctionPrototype *funcProto);35 virtual const ClassInfo *classInfo() const { return &info; }36 static const ClassInfo info;37 };38 28 39 class RegExpProtoFunc : public InternalFunctionImp { 40 public: 41 RegExpProtoFunc(ExecState*, FunctionPrototype*, int i, int len, const Identifier&); 29 struct RegExpObjectImpPrivate; 42 30 43 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args); 31 class RegExpPrototype : public JSObject { 32 public: 33 RegExpPrototype(ExecState*, ObjectPrototype*, FunctionPrototype*); 34 virtual const ClassInfo* classInfo() const { return &info; } 35 static const ClassInfo info; 36 }; 44 37 45 enum { Compile, Exec, Test, ToString }; 46 private: 47 int id; 48 }; 38 class RegExpProtoFunc : public InternalFunctionImp { 39 public: 40 enum { Compile, Exec, Test, ToString }; 49 41 50 class RegExpImp : public JSObject { 51 public: 52 RegExpImp(RegExpPrototype* regexpProto); 53 virtual ~RegExpImp(); 54 void setRegExp(RegExp* r) { m_regExp.set(r); } 55 RegExp* regExp() const { return m_regExp.get(); } 42 RegExpProtoFunc(ExecState*, FunctionPrototype*, int id, int len, const Identifier&); 43 virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&); 56 44 57 virtual const ClassInfo* classInfo() const { return &info; } 58 static const ClassInfo info; 59 private: 60 OwnPtr<RegExp> m_regExp; 61 }; 45 private: 46 int id; 47 }; 62 48 63 struct RegExpObjectImpPrivate; 49 class RegExpImp : public JSObject { 50 public: 51 RegExpImp(RegExpPrototype*, RegExp*); 52 virtual ~RegExpImp(); 64 53 65 class RegExpObjectImp : public InternalFunctionImp { 66 public: 67 enum { Dollar1, Dollar2, Dollar3, Dollar4, Dollar5, Dollar6, Dollar7, Dollar8, Dollar9, 68 Input, Multiline, LastMatch, LastParen, LeftContext, RightContext }; 69 70 RegExpObjectImp(ExecState *exec, 71 FunctionPrototype *funcProto, 72 RegExpPrototype *regProto); 73 virtual bool implementsConstruct() const; 74 virtual JSObject *construct(ExecState *exec, const List &args); 75 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args); 54 void setRegExp(RegExp* r) { m_regExp.set(r); } 55 RegExp* regExp() const { return m_regExp.get(); } 76 56 77 virtual void put(ExecState *, const Identifier &, JSValue *, int attr = None); 78 void putValueProperty(ExecState *, int token, JSValue *, int attr); 79 virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); 80 JSValue *getValueProperty(ExecState *, int token) const; 81 void performMatch(RegExp*, const UString&, int startOffset, int& position, int& length, int** ovector = 0); 82 JSObject* arrayOfMatches(ExecState*) const; 83 84 virtual const ClassInfo *classInfo() const { return &info; } 85 private: 86 JSValue *getBackref(unsigned) const; 87 JSValue *getLastParen() const; 88 JSValue *getLeftContext() const; 89 JSValue *getRightContext() const; 57 JSValue* test(ExecState*, const List& args); 58 JSValue* exec(ExecState*, const List& args); 90 59 91 OwnPtr<RegExpObjectImpPrivate> d; 92 93 static const ClassInfo info; 94 }; 60 virtual bool implementsCall() const; 61 virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&); 62 virtual const ClassInfo* classInfo() const { return &info; } 63 static const ClassInfo info; 64 65 private: 66 bool match(ExecState*, const List& args); 67 68 OwnPtr<RegExp> m_regExp; 69 }; 70 71 class RegExpObjectImp : public InternalFunctionImp { 72 public: 73 enum { Dollar1, Dollar2, Dollar3, Dollar4, Dollar5, Dollar6, Dollar7, Dollar8, Dollar9, 74 Input, Multiline, LastMatch, LastParen, LeftContext, RightContext }; 75 76 RegExpObjectImp(ExecState*, FunctionPrototype*, RegExpPrototype*); 77 78 virtual bool implementsConstruct() const; 79 virtual JSObject* construct(ExecState*, const List&); 80 virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&); 81 virtual void put(ExecState*, const Identifier&, JSValue*, int attributes = None); 82 void putValueProperty(ExecState*, int token, JSValue*, int attributes); 83 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 84 JSValue* getValueProperty(ExecState*, int token) const; 85 virtual const ClassInfo* classInfo() const { return &info; } 86 87 void performMatch(RegExp*, const UString&, int startOffset, int& position, int& length, int** ovector = 0); 88 JSObject* arrayOfMatches(ExecState*) const; 89 const UString& input() const; 90 91 private: 92 JSValue* getBackref(unsigned) const; 93 JSValue* getLastParen() const; 94 JSValue* getLeftContext() const; 95 JSValue* getRightContext() const; 96 97 OwnPtr<RegExpObjectImpPrivate> d; 98 99 static const ClassInfo info; 100 }; 95 101 96 102 } // namespace
Note:
See TracChangeset
for help on using the changeset viewer.