Ignore:
Timestamp:
Jun 28, 2010, 8:19:59 AM (15 years ago)
Author:
[email protected]
Message:

2010-06-28 Caio Marcelo de Oliveira Filho <[email protected]>

Reviewed by Kenneth Rohde Christiansen.

[Qt] QScriptValue should have API for accessing object properties
https://bugs.webkit.org/show_bug.cgi?id=40903

Make possible to access properties inside QScriptValues. While this
still doesn't support the ResolveLocal parameter, it is already useful
for testing the API.

The tests from upstream QtScript weren't imported since most of them
depend on the setProperty() function as well. A simple test was created.

  • qt/api/qscriptvalue.cpp: (QScriptValue::property):
  • qt/api/qscriptvalue.h: (QScriptValue::):
  • qt/api/qscriptvalue_p.h: (QScriptValuePrivate::property):
  • qt/tests/qscriptvalue/tst_qscriptvalue.cpp: (tst_QScriptValue::propertySimple):
  • qt/tests/qscriptvalue/tst_qscriptvalue.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/qt/api/qscriptvalue.h

    r61860 r62007  
    3333
    3434class QScriptValue {
    35 public:   
     35public:
     36    enum ResolveFlag {
     37        ResolveLocal     = 0x00,
     38        ResolvePrototype = 0x01
     39    };
     40
     41    Q_DECLARE_FLAGS(ResolveFlags, ResolveFlag)
     42
    3643    enum SpecialValue {
    3744        NullValue,
     
    6774    bool strictlyEquals(const QScriptValue& other) const;
    6875    bool instanceOf(const QScriptValue& other) const;
     76
     77    QScriptValue property(const QString& name, const ResolveFlags& mode = ResolvePrototype) const;
     78    QScriptValue property(quint32 arrayIndex, const ResolveFlags& mode = ResolvePrototype) const;
    6979
    7080    QScriptEngine* engine() const;
Note: See TracChangeset for help on using the changeset viewer.