Changeset 846 for trunk/src/script/api/qscriptvalueiterator.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/script/api/qscriptvalueiterator.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 85 85 : initialized(false) 86 86 {} 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 87 109 void ensureInitialized() 88 110 { 89 111 if (initialized) 90 112 return; 91 QScriptEnginePrivate *eng_p = QScriptEnginePrivate::get(object.engine()); 113 QScriptEnginePrivate *eng_p = engine(); 114 QScript::APIShim shim(eng_p); 92 115 JSC::ExecState *exec = eng_p->globalExec(); 93 116 JSC::PropertyNameArray propertyNamesArray(exec); 94 propertyNamesArray.setShouldCache(false); 95 JSC::asObject(QScriptValuePrivate::get(object)->jscValue)->getOwnPropertyNames(exec, propertyNamesArray, /*includeNonEnumerable=*/true); 117 JSC::asObject(object()->jscValue)->getOwnPropertyNames(exec, propertyNamesArray, JSC::IncludeDontEnumProperties); 96 118 97 119 JSC::PropertyNameArray::const_iterator propertyNamesIt = propertyNamesArray.begin(); 98 120 for(; propertyNamesIt != propertyNamesArray.end(); ++propertyNamesIt) { 99 propertyNames.append( propertyNamesIt->ustring());121 propertyNames.append(); 100 122 } 101 123 it = propertyNames.begin(); … … 103 125 } 104 126 105 QScriptValue object ;106 QLinkedList<JSC:: UString> propertyNames;107 QLinkedList<JSC:: UString>::iterator it;108 QLinkedList<JSC:: UString>::iterator current;127 QScriptValue object; 128 QLinkedList<JSC::> propertyNames; 129 QLinkedList<JSC::>::iterator it; 130 QLinkedList<JSC::>::iterator current; 109 131 bool initialized; 110 132 }; … … 120 142 if (object.isObject()) { 121 143 d_ptr.reset(new QScriptValueIteratorPrivate()); 122 d_ptr->object = object;144 d_ptr->object = object; 123 145 } 124 146 } … … 241 263 { 242 264 Q_D(const QScriptValueIterator); 243 if (!d || !d->initialized )265 if (!d || !d->initialized) 244 266 return QString(); 245 return *d->current;267 return ; 246 268 } 247 269 … … 255 277 { 256 278 Q_D(const QScriptValueIterator); 257 if (!d || !d->initialized )279 if (!d || !d->initialized) 258 280 return QScriptString(); 259 return d-> object.engine()->toStringHandle(name());281 return d->); 260 282 } 261 283 … … 269 291 { 270 292 Q_D(const QScriptValueIterator); 271 if (!d || !d->initialized )293 if (!d || !d->initialized) 272 294 return QScriptValue(); 273 return d->object.property(name()); 295 QScript::APIShim shim(d->engine()); 296 JSC::JSValue jsValue = d->object()->property(*d->current); 297 return d->engine()->scriptValueFromJSCValue(jsValue); 274 298 } 275 299 … … 283 307 { 284 308 Q_D(QScriptValueIterator); 285 if (!d || !d->initialized) 286 return; 287 d->object.setProperty(name(), value); 309 if (!d || !d->initialized || !d->engine()) 310 return; 311 QScript::APIShim shim(d->engine()); 312 JSC::JSValue jsValue = d->engine()->scriptValueToJSCValue(value); 313 d->object()->setProperty(*d->current, jsValue); 288 314 } 289 315 … … 297 323 { 298 324 Q_D(const QScriptValueIterator); 299 if (!d || !d->initialized )325 if (!d || !d->initialized) 300 326 return 0; 301 return d->object.propertyFlags(name()); 327 QScript::APIShim shim(d->engine()); 328 return d->object()->propertyFlags(*d->current); 302 329 } 303 330 … … 311 338 { 312 339 Q_D(QScriptValueIterator); 313 if (!d || !d->initialized) 314 return; 315 d->object.setProperty(name(), QScriptValue()); 340 if (!d || !d->initialized || !d->engine()) 341 return; 342 QScript::APIShim shim(d->engine()); 343 d->object()->setProperty(*d->current, JSC::JSValue()); 316 344 d->propertyNames.erase(d->current); 317 345 } … … 327 355 if (object.isObject()) { 328 356 d_ptr.reset(new QScriptValueIteratorPrivate()); 329 d_ptr->object = object;357 d_ptr->object = object; 330 358 } 331 359 return *this;
Note:
See TracChangeset
for help on using the changeset viewer.