aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexpobject_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject_p.h')
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h59
1 files changed, 36 insertions, 23 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 1b408749d3..ac07707b2f 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -63,11 +63,18 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-class RegExp;
-
struct RegExpObject: Object {
- V4_OBJECT
+ struct Data : Object::Data {
+ Data(ExecutionEngine *engine, RegExp *value, bool global);
+ Data(ExecutionEngine *engine, const QRegExp &re);
+ Data(InternalClass *ic);
+
+ RegExp *value;
+ bool global;
+ };
+ V4_OBJECT(Object)
Q_MANAGED_TYPE(RegExpObject)
+
// needs to be compatible with the flags in qv4jsir_p.h
enum Flags {
RegExp_Global = 0x01,
@@ -80,39 +87,37 @@ struct RegExpObject: Object {
Index_ArrayInput = Index_ArrayIndex + 1
};
- RegExp* value;
- Property *lastIndexProperty(ExecutionContext *ctx);
- bool global;
-
- RegExpObject(ExecutionEngine *engine, RegExpRef value, bool global);
- RegExpObject(ExecutionEngine *engine, const QRegExp &re);
- ~RegExpObject() {}
+ RegExp *value() const { return d()->value; }
+ bool global() const { return d()->global; }
void init(ExecutionEngine *engine);
+ Property *lastIndexProperty(ExecutionContext *ctx);
QRegExp toQRegExp() const;
QString toString() const;
QString source() const;
uint flags() const;
protected:
- RegExpObject(InternalClass *ic);
- static void destroy(Managed *that);
static void markObjects(Managed *that, ExecutionEngine *e);
};
-DEFINE_REF(RegExp, Object);
-
struct RegExpCtor: FunctionObject
{
- V4_OBJECT
- RegExpCtor(ExecutionContext *scope);
+ struct Data : FunctionObject::Data {
+ Data(ExecutionContext *scope);
+ Value lastMatch;
+ StringValue lastInput;
+ int lastMatchStart;
+ int lastMatchEnd;
+ void clearLastMatch();
+ };
+ V4_OBJECT(FunctionObject)
- Value lastMatch;
- StringValue lastInput;
- int lastMatchStart;
- int lastMatchEnd;
- void clearLastMatch();
+ Value lastMatch() { return d()->lastMatch; }
+ StringValue lastInput() { return d()->lastInput; }
+ int lastMatchStart() { return d()->lastMatchStart; }
+ int lastMatchEnd() { return d()->lastMatchEnd; }
static ReturnedValue construct(Managed *m, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -121,8 +126,16 @@ struct RegExpCtor: FunctionObject
struct RegExpPrototype: RegExpObject
{
- RegExpPrototype(InternalClass *ic): RegExpObject(ic) {}
- void init(ExecutionEngine *engine, ObjectRef ctor);
+ struct Data : RegExpObject::Data
+ {
+ Data(InternalClass *ic): RegExpObject::Data(ic)
+ {
+ setVTable(staticVTable());
+ }
+ };
+ V4_OBJECT(RegExpObject)
+
+ void init(ExecutionEngine *engine, Object *ctor);
static ReturnedValue method_exec(CallContext *ctx);
static ReturnedValue method_test(CallContext *ctx);