diff options
Diffstat (limited to 'src/qml/jsapi/qjsprimitivevalue.cpp')
-rw-r--r-- | src/qml/jsapi/qjsprimitivevalue.cpp | 126 |
1 files changed, 88 insertions, 38 deletions
diff --git a/src/qml/jsapi/qjsprimitivevalue.cpp b/src/qml/jsapi/qjsprimitivevalue.cpp index 1d93a3f0e1..4bd418e082 100644 --- a/src/qml/jsapi/qjsprimitivevalue.cpp +++ b/src/qml/jsapi/qjsprimitivevalue.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qjsprimitivevalue.h" @@ -46,6 +10,9 @@ QT_BEGIN_NAMESPACE /*! \since 6.1 \class QJSPrimitiveUndefined + + \inmodule QtQml + \brief An empty marker type to signify the JavaScript Undefined type and its single value. \inmodule QtQml */ @@ -53,6 +20,9 @@ QT_BEGIN_NAMESPACE /*! \since 6.1 \class QJSPrimitiveNull + + \inmodule QtQml + \brief An empty marker type to signify the JavaScript null value. \inmodule QtQml */ @@ -161,6 +131,40 @@ QT_BEGIN_NAMESPACE */ /*! + \fn QJSPrimitiveValue::QJSPrimitiveValue(QMetaType type, const void *value) + \since 6.4 + + Creates a QJSPrimitiveValue of type \a type, and initializes with + \a value if \a type can be stored in QJSPrimtiveValue. \a value must not + be nullptr in that case. If \a type cannot be stored this results in a + QJSPrimitiveValue of type Undefined. + + Note that you have to pass the address of the variable you want stored. + + Usually, you never have to use this constructor, use the one taking QVariant + instead. + */ + +/*! + \fn QJSPrimitiveValue::QJSPrimitiveValue(QMetaType type) + \since 6.6 + \internal + + Creates a QJSPrimitiveValue of type \a type, and initializes with a + default-constructed value if \a type can be stored in QJSPrimtiveValue. + If \a type cannot be stored this results in a QJSPrimitiveValue of type + Undefined. +*/ + +/*! + \fn QJSPrimitiveValue::QJSPrimitiveValue(const QVariant &value) + + Creates a QJSPrimitiveValue from the contents of \a value if those contents + can be stored in QJSPrimtiveValue. Otherwise this results in a + QJSPrimitiveValue of type Undefined. + */ + +/*! \fn bool QJSPrimitiveValue::toBoolean() const Returns the value coerced a boolean by JavaScript rules. @@ -187,6 +191,7 @@ QT_BEGIN_NAMESPACE /*! \fn QJSPrimitiveValue QJSPrimitiveValue::operator+(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs) + \since 6.1 Perfoms the JavaScript '+' operation on \a lhs and \a rhs, and returns the @@ -279,6 +284,40 @@ QT_BEGIN_NAMESPACE result. */ +/*! + \fn QMetaType QJSPrimitiveValue::metaType() const + \since 6.6 + + Returns the QMetaType of the value stored in the QJSPrimitiveValue. + */ + +/*! + \fn const void *QJSPrimitiveValue::constData() const + \fn const void *QJSPrimitiveValue::data() const + \since 6.6 + + Returns a pointer to the contained value as a generic void* that cannot be + written to. + */ + +/*! + \fn const void *QJSPrimitiveValue::data() + \since 6.6 + + Returns a pointer to the contained data as a generic void* that can be + written to. +*/ + +/*! + \fn template<QJSPrimitiveValue::Type type> QJSPrimitiveValue QJSPrimitiveValue::to() const + \since 6.6 + + Coerces the value to the specified \e type and returns the result as a new + QJSPrimitiveValue. + + \sa toBoolean(), toInteger(), toDouble(), toString() +*/ + QString QJSPrimitiveValue::toString(double d) { QString result; @@ -286,5 +325,16 @@ QString QJSPrimitiveValue::toString(double d) return result; } +/*! + \fn double QQmlPrivate::jsExponentiate(double base, double exponent) + \internal + \since 6.4 + + Performs JavaScript's Number::exponentiate operation on \a base and + \a exponent, and returns the result. + + See https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-numeric-types-number-exponentiate + */ + QT_END_NAMESPACE |