1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef WTFSTRING_H
4#define WTFSTRING_H
5
6#include <QString>
7#include <wtf/ASCIICType.h>
8#include <wtf/unicode/Unicode.h>
9#include <memory>
10
11namespace WTF {
12
13class PrintStream;
14
15class String : public QString
16{
17public:
18 String() = default;
19 String(const QString& s) : QString(s) {}
20 bool is8Bit() const { return false; }
21 const unsigned char *characters8() const { return 0; }
22 const UChar *characters16() const { return reinterpret_cast<const UChar*>(constData()); }
23
24 template <typename T>
25 const T* characters() const;
26
27 bool operator!() const { return isEmpty(); }
28
29 void dump(PrintStream &) const {}
30};
31
32template <>
33inline const unsigned char* String::characters<unsigned char>() const { return characters8(); }
34template <>
35inline const UChar* String::characters<UChar>() const { return characters16(); }
36
37}
38
39// Don't import WTF::String into the global namespace to avoid conflicts with QQmlJS::VM::String
40namespace JSC {
41 using WTF::String;
42}
43
44#define WTFMove(value) std::move(value)
45
46#endif // WTFSTRING_H
47

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtdeclarative/src/3rdparty/masm/stubs/wtf/text/WTFString.h