summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptvariant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/bridge/qscriptvariant.cpp')
-rw-r--r--src/script/bridge/qscriptvariant.cpp45
1 files changed, 31 insertions, 14 deletions
diff --git a/src/script/bridge/qscriptvariant.cpp b/src/script/bridge/qscriptvariant.cpp
index 0255961..46da70a 100644
--- a/src/script/bridge/qscriptvariant.cpp
+++ b/src/script/bridge/qscriptvariant.cpp
@@ -21,7 +21,6 @@ QT_BEGIN_NAMESPACE
namespace JSC
{
-ASSERT_CLASS_FITS_IN_CELL(QScript::QVariantWrapperObject);
ASSERT_CLASS_FITS_IN_CELL(QScript::QVariantPrototype);
}
@@ -30,34 +29,52 @@ namespace QScript
JSC::UString qtStringToJSCUString(const QString &str);
-const JSC::ClassInfo QVariantWrapperObject::info = { "QVariant", 0, 0, 0 };
+QVariantDelegate::QVariantDelegate(const QVariant &value)
+ : m_value(value)
+{
+}
+
+QVariantDelegate::~QVariantDelegate()
+{
+}
-QVariantWrapperObject::QVariantWrapperObject(WTF::PassRefPtr<JSC::Structure> sid)
- : JSC::JSObject(sid), data(new Data())
+QVariant &QVariantDelegate::value()
{
+ return m_value;
}
-QVariantWrapperObject::~QVariantWrapperObject()
+void QVariantDelegate::setValue(const QVariant &value)
{
- delete data;
+ m_value = value;
+}
+
+QScriptObjectDelegate::Type QVariantDelegate::type() const
+{
+ return Variant;
}
static JSC::JSValue JSC_HOST_CALL variantProtoFuncToString(JSC::ExecState *exec, JSC::JSObject*,
JSC::JSValue thisValue, const JSC::ArgList&)
{
- if (!thisValue.isObject(&QVariantWrapperObject::info))
- return throwError(exec, JSC::TypeError);
- const QVariant &v = static_cast<QVariantWrapperObject*>(JSC::asObject(thisValue))->value();
- // ### check the type
+ if (!thisValue.isObject(&QScriptObject::info))
+ return throwError(exec, JSC::TypeError, "This object is not a QVariant");
+ QScriptObjectDelegate *delegate = static_cast<QScriptObject*>(JSC::asObject(thisValue))->delegate();
+ if (!delegate || (delegate->type() != QScriptObjectDelegate::Variant))
+ return throwError(exec, JSC::TypeError, "This object is not a QVariant");
+ const QVariant &v = static_cast<QVariantDelegate*>(delegate)->value();
+ // ### call valueOf()
return JSC::jsString(exec, QScript::qtStringToJSCUString(v.toString()));
}
static JSC::JSValue JSC_HOST_CALL variantProtoFuncValueOf(JSC::ExecState *exec, JSC::JSObject*,
JSC::JSValue thisValue, const JSC::ArgList&)
{
- if (!thisValue.isObject(&QVariantWrapperObject::info))
+ if (!thisValue.isObject(&QScriptObject::info))
+ return throwError(exec, JSC::TypeError);
+ QScriptObjectDelegate *delegate = static_cast<QScriptObject*>(JSC::asObject(thisValue))->delegate();
+ if (!delegate || (delegate->type() != QScriptObjectDelegate::Variant))
return throwError(exec, JSC::TypeError);
- const QVariant &v = static_cast<QVariantWrapperObject*>(JSC::asObject(thisValue))->value();
+ const QVariant &v = static_cast<QVariantDelegate*>(delegate)->value();
switch (v.type()) {
case QVariant::Invalid:
return JSC::jsUndefined();
@@ -87,9 +104,9 @@ static JSC::JSValue JSC_HOST_CALL variantProtoFuncValueOf(JSC::ExecState *exec,
QVariantPrototype::QVariantPrototype(JSC::ExecState* exec, WTF::PassRefPtr<JSC::Structure> structure,
JSC::Structure* prototypeFunctionStructure)
- : QVariantWrapperObject(structure)
+ : QScriptObject(structure)
{
- setValue(QVariant());
+ setDelegate(new QVariantDelegate(QVariant()));
putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, variantProtoFuncToString), JSC::DontEnum);
putDirectFunction(exec, new (exec) JSC::PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, variantProtoFuncValueOf), JSC::DontEnum);
mn5'>\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8e82773 Remove unused GLOBAL_TARGET generation code 0621362 Fix dependency tracing of INSTALL and PACKAGE (#11598) | * | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused GLOBAL_TARGET generation codeBrad King2010-12-132-22/+3 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove a boolean parameter of cmGlobalGenerator::CreateGlobalTarget that is never set to true anymore. Remove global target "consolidation" loop because no global targets exist before it runs anymore. | * | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix dependency tracing of INSTALL and PACKAGE (#11598)Brad King2010-12-131-0/+6 | |/ / / / / / / / / / / / / / / / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit e01cce28 (Allow add_dependencies() on imported targets, 2010-11-19) started using cmMakefile::FindTargetToUse to follow dependencies, including those of GLOBAL_TARGETs like INSTALL and PACKAGE. Since global targets exist in every directory, dependencies between them must be traced within each directory too. Teach FindTargetToUse to check the current directory before checking globally. For global targets this will find the local copy. For for normal targets this will be a no-op because they are globally unique. * | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge topic 'FixDocTypoInFindFLEX'Brad King2010-12-141-2/+2 |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3ce0049 Fix typos in the doc | * | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix typos in the docAlex Neundorf2010-12-071-2/+2 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alex * | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge topic 'BundleUtilities-should-produce-error-if-item-is-not-embedded'Brad King2010-12-141-0/+30 |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c2895f4 BundleUtilities: error if fixup_bundle_item called on non-embedded item | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | BundleUtilities: error if fixup_bundle_item called on non-embedded itemDavid Cole2010-12-061-0/+30 | | |_|_|_|_|_|/ / / / / / / / / / / / / / / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, improve the documentation of the fixup_bundle and fixup_bundle_item functions to clarify that plugin type "libs" need to be copied into the bundle *before* calling fixup_bundle. Commit e93a4b4d3421ced7b8c852b76c0dcb427f798df8 changed the way that the libs parameter to fixup_bundle is interpreted. Before the commit, the libs were copied into the bundle first and then fixed up. After the commit, the copy was skipped, assuming the libs were in the bundle in the first place, and then the fixups occurred as before. However, before the commit, it was possible to name a lib from outside the bundle, and have it copied in and then fixed up. Its resolved embedded name was always inside the bundle before. After, its resolved embedded name was just the same as its resolved name, which is in its original location, and not necessarily inside the bundle. This manifested itself as a problem with the ParaView call to fixup_bundle and its many plugins. Previously, ParaView had simply passed in the list of plugin file names as they existed in the build tree, and left the copying into the bundle up to the fixup_bundle function. When built with CMake 2.8.3 (the first version to contain the above named commit) the fixup_bundle call would inadventently fixup libraries in the build tree, not libraries that were in the bundle. Furthermore, the plugins would not be in the final bundle. This points out the fact that the fix for the bugs made by the above commit was a backwards-incompatible change in behavior. This commit makes it an error to try to fixup an item that is not already inside the bundle to make the change in behavior apparent to folks who were depending on the prior copy-in behavior: now, they should get an error, and hopefully, reading the new and improved documentation, should be able to resolve it in their projects by adding code to install or copy in such libraries prior to calling fixup_bundle. Whew. * | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge topic 'vs10-express-64bit'Brad King2010-12-145-0/+85 |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fb97ba6 Enable 64-bit tools with VS 2010 Express (#9981, #10722) | * | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable 64-bit tools with VS 2010 Express (#9981, #10722)Brad King2010-12-015-0/+85 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Express Edition does not come with 64-bit tools, but one can install the "Microsoft Windows SDK v7.1" to get them. Detect this case and check for the SDK. If found, set PlatformToolset to use the SDK tools. Otherwise, fail with a concise and informative error. * | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KWSys: Use EXPORT name only if installing libraryBrad King2010-12-141-3/+3 | |_|_|_|_|_|_|_|_|_|_|_|_|/ / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not set KWSYS_INSTALL_LIBRARY_RULE just because the parent project set KWSYS_INSTALL_EXPORT_NAME. Require KWSYS_INSTALL_LIB_DIR to be set too. * | | | | | | | | | | | | | | | | | | | | | | | | | | | | KWSys Nightly Date StampKWSys Robot2010-12-141-1/+1 | |_|_|_|_|_|_|/ / / / / / / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | | KWSys Nightly Date StampKWSys Robot2010-12-131-1/+1 | |_|_|_|_|_|_|_|/ / / / / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | | KWSys Nightly Date StampKWSys Robot2010-12-121-1/+1 | |_|_|_|_|_|_|/ / / / / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | | | | KWSys Nightly Date StampKWSys Robot2010-12-111-1/+1 | |_|_|_|_|_|/ / / / / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | | | KWSys Nightly Date StampKWSys Robot2010-12-101-1/+1 | |_|_|_|/ / / / / / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | | KWSys Nightly Date StampKWSys Robot2010-12-091-1/+1 | | | | | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | | KWSys: Remove realpath from SystemTools::GetPath (#10335)Brad King2010-12-081-3/+1 | |_|_|_|_|/ / / / / / / / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit "merge in changes for beos support" (2006-12-04) added a realpath call for every directory parsed out of a PATH-style environment variable. No reason was given in the commit message or comments. The call incorrectly resolves symlinks in referenced paths. Remove it. If BeOS support really needs it then it can be restored for that platform with a full explanation. * | | | | | | | | | | | | | | | | | | | | | | KWSys Nightly Date StampKWSys Robot2010-12-081-1/+1 | | | | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | Merge topic 'fix-typo-in-error-message'David Cole2010-12-071-1/+1 |\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a2a997d Correct misspelling in error message text. | * | | | | | | | | | | | | | | | | | | | | | | Correct misspelling in error message text.David Cole2010-12-061-1/+1 | | |/ / / / / / / / / / / / / / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | | | | | | | | Merge topic 'fortran-avoid-timestamp-touch'David Cole2010-12-07