diff options
Diffstat (limited to 'src/3rdparty/masm/stubs/wtf')
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/HashMap.h | 58 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/HashSet.h | 67 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/Optional.h | 83 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/PassRefPtr.h | 14 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/Vector.h | 7 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/text/CString.h | 4 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/text/StringBuilder.h | 52 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/text/WTFString.h | 15 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/unicode/Unicode.h | 30 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/wtf/unicode/utypes.h | 1 |
10 files changed, 325 insertions, 6 deletions
diff --git a/src/3rdparty/masm/stubs/wtf/HashMap.h b/src/3rdparty/masm/stubs/wtf/HashMap.h new file mode 100644 index 0000000000..888c6cceb0 --- /dev/null +++ b/src/3rdparty/masm/stubs/wtf/HashMap.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2018 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$ +** +****************************************************************************/ +#ifndef HASHMAP_H +#define HASHMAP_H + +#include <QtCore/qhash.h> + +namespace WTF { + +template<typename Key, typename Value> +class HashMap final : public QHash<Key, Value> +{ +public: + void add(const Key &k, const Value &v) { QHash<Key, Value>::insert(k, v); } + Value get(const Key &k) { return QHash<Key, Value>::value(k); } +}; + +} + +using WTF::HashMap; + +#endif diff --git a/src/3rdparty/masm/stubs/wtf/HashSet.h b/src/3rdparty/masm/stubs/wtf/HashSet.h new file mode 100644 index 0000000000..3765c9a8b1 --- /dev/null +++ b/src/3rdparty/masm/stubs/wtf/HashSet.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2018 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$ +** +****************************************************************************/ +#ifndef HASHSET_H +#define HASHSET_H + +#include <QtCore/qset.h> + +namespace WTF { + +template<typename Key> +class HashSet final : public QSet<Key> +{ +public: + struct SetAddResult { + bool isNewEntry; + }; + SetAddResult add(const Key &k) + { + if (QSet<Key>::find(k) == QSet<Key>::constEnd()) { + QSet<Key>::insert(k); + return { true }; + } + return { false }; + } +}; + +} + +using WTF::HashSet; + +#endif diff --git a/src/3rdparty/masm/stubs/wtf/Optional.h b/src/3rdparty/masm/stubs/wtf/Optional.h new file mode 100644 index 0000000000..44fa3ee62d --- /dev/null +++ b/src/3rdparty/masm/stubs/wtf/Optional.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2018 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$ +** +****************************************************************************/ + +#pragma once + +#include <QtCore/qglobal.h> + +#if __cplusplus > 201402L && QT_HAS_INCLUDE(<optional>) +#include <optional> +#else + +namespace std { + +struct nullopt_t {}; + +constexpr nullopt_t nullopt {}; + +template<typename T> +class optional { +public: + optional() = default; + optional(nullopt_t) {} + optional(const T &v) : _value(v), _hasValue(true) {} + ~optional() = default; + + optional &operator =(nullopt_t) { + _value = T(); + _hasValue = false; + return *this; + } + + T operator->() { return _value; } + T operator*() { return _value; } + + operator bool() const { return _hasValue; } + bool has_value() const { return _hasValue; } + + T value() const { return _value; } + +private: + T _value = T(); + bool _hasValue = false; +}; + +} + +#endif diff --git a/src/3rdparty/masm/stubs/wtf/PassRefPtr.h b/src/3rdparty/masm/stubs/wtf/PassRefPtr.h index f072e70dd7..cc03a5d651 100644 --- a/src/3rdparty/masm/stubs/wtf/PassRefPtr.h +++ b/src/3rdparty/masm/stubs/wtf/PassRefPtr.h @@ -83,14 +83,22 @@ public: private: PassRefPtr<T>& operator=(const PassRefPtr<T>& t); - template <typename PtrType> friend PassRefPtr<PtrType> adoptRef(PtrType*); +protected: mutable T* m_ptr; }; template <typename T> -PassRefPtr<T> adoptRef(T* ptr) +class Ref : public PassRefPtr<T> { - PassRefPtr<T> result; + using PassRefPtr<T>::PassRefPtr; + + template <typename PtrType> friend Ref<PtrType> adoptRef(PtrType*); +}; + +template <typename T> +Ref<T> adoptRef(T* ptr) +{ + Ref<T> result; result.m_ptr = ptr; return result; } diff --git a/src/3rdparty/masm/stubs/wtf/Vector.h b/src/3rdparty/masm/stubs/wtf/Vector.h index 2025acf8a9..f4f4dc5cf4 100644 --- a/src/3rdparty/masm/stubs/wtf/Vector.h +++ b/src/3rdparty/masm/stubs/wtf/Vector.h @@ -55,6 +55,8 @@ class Vector : public std::vector<T> { public: Vector() {} Vector(int initialSize) : std::vector<T>(initialSize) {} + Vector(const Vector &other) : std::vector<T>(other) {} + Vector(std::initializer_list<T> list) : std::vector<T>(list) {} inline void append(const T& value) { this->push_back(value); } @@ -63,6 +65,9 @@ public: inline void append(const OtherType& other) { this->push_back(T(other)); } + inline void append(T&& other) + { this->push_back(std::move(other)); } + inline void append(const Vector<T>& vector) { this->insert(this->end(), vector.begin(), vector.end()); @@ -80,6 +85,8 @@ public: this->push_back(*it); } + unsigned size() const { return static_cast<unsigned>(std::vector<T>::size()); } + using std::vector<T>::insert; inline void reserveInitialCapacity(size_t size) { this->reserve(size); } diff --git a/src/3rdparty/masm/stubs/wtf/text/CString.h b/src/3rdparty/masm/stubs/wtf/text/CString.h index 26f74f7593..7129f5049e 100644 --- a/src/3rdparty/masm/stubs/wtf/text/CString.h +++ b/src/3rdparty/masm/stubs/wtf/text/CString.h @@ -39,4 +39,8 @@ #ifndef CSTRING_H #define CSTRING_H +class CString : public QByteArray { + +}; + #endif // CSTRING_H diff --git a/src/3rdparty/masm/stubs/wtf/text/StringBuilder.h b/src/3rdparty/masm/stubs/wtf/text/StringBuilder.h new file mode 100644 index 0000000000..a382f6da83 --- /dev/null +++ b/src/3rdparty/masm/stubs/wtf/text/StringBuilder.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2018 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$ +** +****************************************************************************/ +#pragma once + +#include <wtf/text/WTFString.h> + +namespace WTF { + +struct StringBuilder : public String +{ + String toString() const { return *this; } +}; + +} + +using WTF::StringBuilder; diff --git a/src/3rdparty/masm/stubs/wtf/text/WTFString.h b/src/3rdparty/masm/stubs/wtf/text/WTFString.h index 928c684fdb..da5183f734 100644 --- a/src/3rdparty/masm/stubs/wtf/text/WTFString.h +++ b/src/3rdparty/masm/stubs/wtf/text/WTFString.h @@ -42,26 +42,33 @@ #include <QString> #include <wtf/ASCIICType.h> #include <wtf/unicode/Unicode.h> +#include <memory> namespace WTF { +class PrintStream; + class String : public QString { public: + String() = default; String(const QString& s) : QString(s) {} bool is8Bit() const { return false; } const unsigned char *characters8() const { return 0; } const UChar *characters16() const { return reinterpret_cast<const UChar*>(constData()); } template <typename T> - const T* getCharacters() const; + const T* characters() const; + + bool operator!() const { return isEmpty(); } + void dump(PrintStream &) const {} }; template <> -inline const unsigned char* String::getCharacters<unsigned char>() const { return characters8(); } +inline const unsigned char* String::characters<unsigned char>() const { return characters8(); } template <> -inline const UChar* String::getCharacters<UChar>() const { return characters16(); } +inline const UChar* String::characters<UChar>() const { return characters16(); } } @@ -70,4 +77,6 @@ namespace JSC { using WTF::String; } +#define WTFMove(value) std::move(value) + #endif // WTFSTRING_H diff --git a/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h b/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h index d61cec5c4e..0f7f005c89 100644 --- a/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h +++ b/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h @@ -43,6 +43,7 @@ typedef unsigned char LChar; typedef unsigned short UChar; +typedef int32_t UChar32; namespace Unicode { inline UChar toLower(UChar ch) { @@ -52,6 +53,35 @@ namespace Unicode { inline UChar toUpper(UChar ch) { return QChar::toUpper(ch); } + inline UChar32 u_tolower(UChar32 ch) { + return QChar::toLower(ch); + } + inline UChar32 u_toupper(UChar32 ch) { + return QChar::toUpper(ch); + } } +using Unicode::u_toupper; +using Unicode::u_tolower; + +#define U16_IS_LEAD(ch) QChar::isHighSurrogate((ch)) +#define U16_IS_TRAIL(ch) QChar::isLowSurrogate((ch)) +#define U16_GET_SUPPLEMENTARY(lead, trail) static_cast<UChar32>(QChar::surrogateToUcs4((lead), (trail))) +#define U_IS_BMP(ch) ((ch) < 0x10000) +#define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2) +#define UCHAR_MAX_VALUE 0x10ffff + +#define U_MASK(category) (1u << (category)) +#define U_GET_GC_MASK(c) U_MASK(QChar::category((c))) +#define U_GC_L_MASK (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK) +#define U_GC_LU_MASK U_MASK(QChar::Letter_Uppercase) +#define U_GC_LL_MASK U_MASK(QChar::Letter_Lowercase) +#define U_GC_LT_MASK U_MASK(QChar::Letter_Titlecase) +#define U_GC_LM_MASK U_MASK(QChar::Letter_Modifier) +#define U_GC_LO_MASK U_MASK(QChar::Letter_Other) +#define U_GC_MN_MASK U_MASK(QChar::Mark_NonSpacing) +#define U_GC_MC_MASK U_MASK(QChar::Mark_SpacingCombining) +#define U_GC_ND_MASK U_MASK(QChar::Number_DecimalDigit) +#define U_GC_PC_MASK U_MASK(QChar::Punctuation_Connector) + #endif // UNICODE_H diff --git a/src/3rdparty/masm/stubs/wtf/unicode/utypes.h b/src/3rdparty/masm/stubs/wtf/unicode/utypes.h new file mode 100644 index 0000000000..e1b4ff90a6 --- /dev/null +++ b/src/3rdparty/masm/stubs/wtf/unicode/utypes.h @@ -0,0 +1 @@ +#include <unicode/Unicode.h> |