8#include <QtCore/qiodevicebase.h>
9#include <QtCore/qchar.h>
10#include <QtCore/qstringconverter_base.h>
18#pragma qt_class(QTextStream)
22#error qtextstream.h must be included before any header file that defines Status
31#if !QT_DEPRECATED_SINCE(6
, 9
)
32# define QT_NO_INHERITABLE_TEXT_STREAM
35#ifdef QT_NO_INHERITABLE_TEXT_STREAM
36# define QT_TEXT_STREAM_FINAL final
38# define QT_TEXT_STREAM_FINAL
44 Q_DECLARE_PRIVATE(QTextStream)
47 enum RealNumberNotation {
69 UppercaseDigits = 0x10
71 Q_DECLARE_FLAGS(NumberFlags, NumberFlag)
74 explicit QTextStream(QIODevice *device);
75 explicit QTextStream(FILE *fileHandle, OpenMode openMode = ReadWrite);
76 explicit QTextStream(QString *string, OpenMode openMode = ReadWrite);
77 explicit QTextStream(QByteArray *array, OpenMode openMode = ReadWrite);
78 explicit QTextStream(
const QByteArray &array, OpenMode openMode = ReadOnly);
80 #if defined(__has_warning
)
81 # if __has_warning
("-Wunnecessary-virtual-specifier")
82 QT_WARNING_DISABLE_CLANG(
"-Wunnecessary-virtual-specifier")
89 void setEncoding(QStringConverter::Encoding encoding);
90 QStringConverter::Encoding encoding()
const;
91 void setAutoDetectUnicode(
bool enabled);
92 bool autoDetectUnicode()
const;
93 void setGenerateByteOrderMark(
bool generate);
94 bool generateByteOrderMark()
const;
96 void setLocale(
const QLocale &locale);
97 QLocale locale()
const;
99 void setDevice(QIODevice *device);
100 QIODevice *device()
const;
102 void setString(QString *string, OpenMode openMode = ReadWrite);
103 QString *string()
const;
105 Status status()
const;
106 void setStatus(Status status);
112 bool seek(qint64 pos);
115 void skipWhiteSpace();
117 QString readLine(qint64 maxlen = 0);
118 bool readLineInto(QString *line, qint64 maxlen = 0);
120 QString read(qint64 maxlen);
122 void setFieldAlignment(FieldAlignment alignment);
123 FieldAlignment fieldAlignment()
const;
125 void setPadChar(QChar ch);
126 QChar padChar()
const;
128 void setFieldWidth(
int width);
129 int fieldWidth()
const;
131 void setNumberFlags(NumberFlags flags);
132 NumberFlags numberFlags()
const;
134 void setIntegerBase(
int base);
135 int integerBase()
const;
137 void setRealNumberNotation(RealNumberNotation notation);
138 RealNumberNotation realNumberNotation()
const;
140 void setRealNumberPrecision(
int precision);
141 int realNumberPrecision()
const;
143 QTextStream &operator>>(QChar &ch);
144 QTextStream &operator>>(
char &ch);
145 QTextStream &operator>>(
char16_t &ch)
146 { QChar c; *
this >> c; ch = c.unicode();
return *
this; }
147 QTextStream &operator>>(
signed short &i);
148 QTextStream &operator>>(
unsigned short &i);
149 QTextStream &operator>>(
signed int &i);
150 QTextStream &operator>>(
unsigned int &i);
151 QTextStream &operator>>(
signed long &i);
152 QTextStream &operator>>(
unsigned long &i);
153 QTextStream &operator>>(qlonglong &i);
154 QTextStream &operator>>(qulonglong &i);
155 QTextStream &operator>>(
float &f);
156 QTextStream &operator>>(
double &f);
157 QTextStream &operator>>(QString &s);
158 QTextStream &operator>>(QByteArray &array);
159#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6
, 12
)
160 QT_DEPRECATED_VERSION_X_6_12(
"Use the QByteArray overload: this function cannot be used safely.")
161 QTextStream &operator>>(
char *c);
164 QTextStream &operator<<(QChar ch);
165 QTextStream &operator<<(
char ch);
166 QTextStream &operator<<(
char16_t ch) {
return *
this << QChar(ch); }
167 QTextStream &operator<<(
signed short i);
168 QTextStream &operator<<(
unsigned short i);
169 QTextStream &operator<<(
signed int i);
170 QTextStream &operator<<(
unsigned int i);
171 QTextStream &operator<<(
signed long i);
172 QTextStream &operator<<(
unsigned long i);
173 QTextStream &operator<<(qlonglong i);
174 QTextStream &operator<<(qulonglong i);
175 QTextStream &operator<<(
float f);
176 QTextStream &operator<<(
double f);
177 QTextStream &operator<<(
const QString &s);
178 QTextStream &operator<<(QStringView s);
179 QTextStream &operator<<(QLatin1StringView s);
180 QTextStream &operator<<(
const QByteArray &array);
181 QTextStream &operator<<(
const char *c);
182 QTextStream &operator<<(
const void *ptr);
184 explicit operator
bool()
const noexcept {
return status() == Ok; }
187 Q_DISABLE_COPY(QTextStream)
188 friend class QDebugStateSaverPrivate;
191 std::unique_ptr<QTextStreamPrivate> d_ptr;
194Q_DECLARE_OPERATORS_FOR_FLAGS(QTextStream::NumberFlags)
197
198
200typedef QTextStream & (*QTextStreamFunction)(QTextStream &);
201typedef void (QTextStream::*QTSMFI)(
int);
202typedef void (QTextStream::*QTSMFC)(QChar);
208 constexpr QTextStreamManipulator(QTSMFI m,
int a)
noexcept : mf(m), mc(
nullptr), arg(a), ch() {}
209 constexpr QTextStreamManipulator(QTSMFC m, QChar c)
noexcept : mf(
nullptr), mc(m), arg(-1), ch(c) {}
210 void exec(QTextStream &s) {
if (mf) { (s.*mf)(arg); }
else { (s.*mc)(ch); } }
219inline QTextStream &operator>>(QTextStream &s, QTextStreamFunction f)
222inline QTextStream &operator<<(QTextStream &s, QTextStreamFunction f)
225inline QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m)
226{ m.exec(s);
return s; }
265 QTSMFI func = &QTextStream::setFieldWidth;
266 return QTextStreamManipulator(func,width);
271 QTSMFC func = &QTextStream::setPadChar;
272 return QTextStreamManipulator(func, ch);
277 QTSMFI func = &QTextStream::setRealNumberPrecision;
278 return QTextStreamManipulator(func, precision);
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
The QCommandLineParser class provides a means for handling the command line options.
const_iterator & operator++() noexcept
The prefix ++ operator ({++i}) advances the iterator to the next item in the hash and returns an iter...
const_iterator(const iterator &o) noexcept
Constructs a copy of other.
constexpr const_iterator() noexcept=default
Constructs an uninitialized iterator.
const_iterator operator++(int) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::forward_iterator_tag iterator_category
const T * operator->() const noexcept
Returns a pointer to the current item's value.
bool operator==(const const_iterator &o) const noexcept
Returns true if other points to the same item as this iterator; otherwise returns false.
const T & value() const noexcept
Returns the current item's value.
const Key & key() const noexcept
Returns the current item's key.
bool operator!=(const const_iterator &o) const noexcept
Returns true if other points to a different item than this iterator; otherwise returns false.
const T & operator*() const noexcept
Returns the current item's value.
key_iterator & operator++() noexcept
The prefix ++ operator ({++i}) advances the iterator to the next item in the hash and returns an iter...
key_iterator() noexcept=default
bool operator!=(key_iterator o) const noexcept
Returns true if other points to a different item than this iterator; otherwise returns false.
key_iterator operator++(int) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
const Key & operator*() const noexcept
Returns the current item's key.
const Key * operator->() const noexcept
Returns a pointer to the current item's key.
key_iterator(const_iterator o) noexcept
bool operator==(key_iterator o) const noexcept
Returns true if other points to the same item as this iterator; otherwise returns false.
const_iterator::iterator_category iterator_category
const_iterator base() const noexcept
Returns the underlying const_iterator this key_iterator is based on.
key_value_iterator try_emplace(const_iterator, K &&key, Args &&...args)
T & operator[](const K &key)
key_iterator keyEnd() const noexcept
const T operator[](const K &key) const noexcept
std::pair< const_iterator, const_iterator > equal_range(const Key &key) const noexcept
TryEmplaceResult insertOrAssign(const Key &key, Value &&value)
float load_factor() const noexcept
Returns the current load factor of the QHash's internal hash table.
const_iterator constFind(const Key &key) const noexcept
iterator insert(const Key &key, T &&value)
std::pair< key_value_iterator, bool > insert_or_assign(Key &&key, Value &&value)
~QHash()
Destroys the hash.
QHash & operator=(const QHash &other) noexcept
Assigns other to this hash and returns a reference to this hash.
iterator erase(const_iterator it)
std::pair< key_value_iterator, bool > try_emplace(K &&key, Args &&...args)
iterator emplace(const Key &key, Args &&... args)
key_value_iterator keyValueBegin()
const_iterator constFind(const K &key) const noexcept
T value(const K &key, const T &defaultValue) const noexcept
QHash(const QHash &other) noexcept
Constructs a copy of other.
auto asKeyValueRange() const &&
TryEmplaceResult tryEmplace(K &&key, Args &&...args)
TryEmplaceResult tryInsert(const Key &key, const T &value)
iterator emplace(Key &&key, Args &&... args)
Inserts a new element into the container.
friend bool comparesEqual(const QHash &lhs, const QHash &rhs) noexcept
TryEmplaceResult tryEmplace(const Key &key, Args &&...args)
\variable QHash::TryEmplaceResult::iterator
const_key_value_iterator constKeyValueEnd() const noexcept
bool empty() const noexcept
This function is provided for STL compatibility.
std::pair< key_value_iterator, bool > insert_or_assign(K &&key, Value &&value)
const_iterator cbegin() const noexcept
std::pair< key_value_iterator, bool > try_emplace(const Key &key, Args &&...args)
key_value_iterator insert_or_assign(const_iterator, K &&key, Value &&value)
iterator insert(Key &&key, T &&value)
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
void insert(const QHash &hash)
const_iterator find(const Key &key) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::pair< key_value_iterator, bool > try_emplace(Key &&key, Args &&...args)
static float max_load_factor() noexcept
QKeyValueIterator< const Key &, const T &, const_iterator > const_key_value_iterator
\inmodule QtCore
const_key_value_iterator keyValueBegin() const noexcept
TryEmplaceResult insertOrAssign(K &&key, Value &&value)
key_value_iterator keyValueEnd()
const_iterator end() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Key key_type
Typedef for Key.
iterator find(const K &key)
const_key_value_iterator constKeyValueBegin() const noexcept
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
qsizetype count(const K &key) const
iterator insert(Key &&key, const T &value)
std::pair< iterator, iterator > equal_range(const K &key)
key_iterator keyBegin() const noexcept
iterator Iterator
Qt-style synonym for QHash::iterator.
key_value_iterator insert_or_assign(const_iterator, const Key &key, Value &&value)
bool contains(const K &key) const
TryEmplaceResult tryInsert(K &&key, const T &value)
std::pair< const_iterator, const_iterator > equal_range(const K &key) const noexcept
size_t bucket_count() const noexcept
const_iterator ConstIterator
Qt-style synonym for QHash::const_iterator.
key_value_iterator try_emplace(const_iterator, Key &&key, Args &&...args)
auto asKeyValueRange() &&
auto asKeyValueRange() const &
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
qsizetype count() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
QHash(std::initializer_list< std::pair< Key, T > > list)
T value(const K &key) const noexcept
const_iterator find(const K &key) const noexcept
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
QHash(QHash &&other) noexcept
Move-constructs a QHash instance, making it point at the same object that other was pointing to.
std::pair< key_value_iterator, bool > insert_or_assign(const Key &key, Value &&value)
std::pair< iterator, iterator > equal_range(const Key &key)
const_iterator cend() const noexcept
key_value_iterator insert_or_assign(const_iterator, Key &&key, Value &&value)
static size_t max_bucket_count() noexcept
bool remove(const K &key)
QKeyValueIterator< const Key &, T &, iterator > key_value_iterator
\inmodule QtCore
TryEmplaceResult insertOrAssign(Key &&key, Value &&value)
QHash() noexcept=default
Constructs an empty hash.
const T & const_reference
TryEmplaceResult tryEmplace(Key &&key, Args &&...args)
key_value_iterator try_emplace(const_iterator, const Key &key, Args &&...args)
T mapped_type
Typedef for T.
const_key_value_iterator keyValueEnd() const noexcept
const_iterator begin() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
RCCResourceLibrary(quint8 formatVersion)
ResourceDataFileMap resourceDataFileMap() const
bool readFiles(bool listMode, QIODevice &errorDevice)
QStringList failedResources() const
QStringList dataFiles() const
int formatVersion() const
QStringList inputFiles() const
void setResourceRoot(const QString &root)
static int parseCompressionLevel(CompressionAlgorithm algo, const QString &level, QString *errorMsg)
bool useNameSpace() const
int compressLevel() const
bool output(QIODevice &outDevice, QIODevice &tempDevice, QIODevice &errorDevice)
void setInitName(const QString &name)
void setCompressionAlgorithm(CompressionAlgorithm algo)
int compressThreshold() const
void setCompressThreshold(int t)
CompressionAlgorithm compressionAlgorithm() const
void setCompressLevel(int c)
QString resourceRoot() const
void setOutputName(const QString &name)
QHash< QString, QString > ResourceDataFileMap
QString outputName() const
void setUseNameSpace(bool v)
void setInputFiles(const QStringList &files)
static CompressionAlgorithm parseCompressionAlgorithm(QStringView algo, QString *errorMsg)
QT_FORWARD_DECLARE_CLASS(QTextStream)
constexpr size_t bucketForHash(size_t nBuckets, size_t hash) noexcept
constexpr size_t bucketsForCapacity(size_t requestedCapacity) noexcept
constexpr bool HasStdHashSpecializationWithoutSeed
constexpr bool isRelocatable_v
size_t calculateHash(const T &t, size_t seed=0)
constexpr bool HasQHashOverload
std::conditional_t< std::is_same_v< HashKey, q20::remove_cvref_t< KeyArgument > >, KeyArgument, HashKey > HeterogenousConstructProxy
constexpr bool HasStdHashSpecializationWithSeed
Combined button and popup list for selecting options.
const QString & asString(const QString &s)
QList< QFileInfo > QFileInfoList
qsizetype erase_if(QMultiHash< Key, T > &hash, Predicate pred)
size_t qHash(const QMultiHash< Key, T > &key, size_t seed=0) noexcept(noexcept(qHash(std::declval< Key & >())) &&noexcept(qHash(std::declval< T & >())))
qsizetype erase_if(QHash< Key, T > &hash, Predicate pred)
#define qPrintable(string)
#define QStringLiteral(str)
void dumpRecursive(const QDir &dir, QTextStream &out)
int runRcc(int argc, char *argv[])
void writeDepFile(QIODevice &iodev, const QStringList &depsList, const QString &targetName)
QString makefileEscape(const QString &filepath)
int createProject(const QString &outFileName)
QTextStreamManipulator qSetPadChar(QChar ch)
QTextStreamManipulator qSetRealNumberPrecision(int precision)
#define QT_TEXT_STREAM_FINAL
QTextStreamManipulator qSetFieldWidth(int width)
int main(int argc, char *argv[])
[ctor_close]
friend bool operator==(Bucket lhs, Bucket rhs) noexcept
size_t offset() const noexcept
bool isUnused() const noexcept
Bucket(const Data *d, size_t bucket) noexcept
Bucket(Span *s, size_t i) noexcept
void advance(const Data *d) noexcept
Node & nodeAtOffset(size_t offset)
iterator toIterator(const Data *d) const noexcept
friend bool operator!=(Bucket lhs, Bucket rhs) noexcept
void advanceWrapped(const Data *d) noexcept
Bucket(iterator it) noexcept
size_t toBucketIndex(const Data *d) const noexcept
Bucket findBucketWithHash(const K &key, size_t hash) const noexcept
iterator begin() const noexcept
QHashPrivate::Span< Node > Span
size_t nextBucket(size_t bucket) const noexcept
typename Node::ValueType T
InsertionResult findOrInsert(const K &key) noexcept
Node * findNode(const K &key) const noexcept
QHashPrivate::iterator< Node > iterator
static Data * detached(Data *d)
iterator detachedIterator(iterator other) const noexcept
constexpr iterator end() const noexcept
bool shouldGrow() const noexcept
typename Node::KeyType Key
void rehash(size_t sizeHint=0)
Q_ALWAYS_INLINE void reallocationHelper(const Data &other, size_t nSpans)
void erase(Bucket bucket) noexcept(std::is_nothrow_destructible< Node >::value)
static Data * detached(Data *d, size_t size)
float loadFactor() const noexcept
static auto allocateSpans(size_t numBuckets)
Data(const Data &other, size_t reserved)
static constexpr size_t maxNumBuckets() noexcept
Bucket findBucket(const K &key) const noexcept
qsizetype free() noexcept(std::is_nothrow_destructible_v< T >)
bool contains(const T &val) const noexcept
static qsizetype freeChain(MultiNode *n) noexcept(std::is_nothrow_destructible_v< T >)
MultiNode(MultiNode &&other)
void insertMulti(Args &&... args)
MultiNode(const MultiNode &other)
static void createInPlace(MultiNode *n, const Key &k, Args &&... args)
MultiNode(const Key &k, Chain *c)
static void createInPlace(MultiNode *n, Key &&k, Args &&... args)
MultiNode(Key &&k, Chain *c) noexcept(std::is_nothrow_move_assignable_v< Key >)
MultiNodeChain< T > Chain
void emplaceValue(Args &&... args)
static void createInPlace(Node *n, const Key &k, Args &&...)
QHashDummyValue ValueType
void emplaceValue(Args &&...)
bool valuesEqual(const Node *) const
ValueType takeValue() noexcept
static void createInPlace(Node *n, Key &&k, Args &&...)
void emplaceValue(Args &&... args)
bool valuesEqual(const Node *other) const
T && takeValue() noexcept
static void createInPlace(Node *n, const Key &k, Args &&... args)
static void createInPlace(Node *n, Key &&k, Args &&... args)
static constexpr size_t SpanShift
static constexpr size_t LocalBucketMask
static constexpr size_t UnusedEntry
static constexpr size_t NEntries
unsigned char & nextFree()
const Node & at(size_t i) const noexcept
void moveLocal(size_t from, size_t to) noexcept
void freeData() noexcept(std::is_nothrow_destructible< Node >::value)
void erase(size_t bucket) noexcept(std::is_nothrow_destructible< Node >::value)
unsigned char offsets[SpanConstants::NEntries]
Node & atOffset(size_t o) noexcept
size_t offset(size_t i) const noexcept
bool hasNode(size_t i) const noexcept
void moveFromSpan(Span &fromSpan, size_t fromIndex, size_t to) noexcept(std::is_nothrow_move_constructible_v< Node >)
const Node & atOffset(size_t o) const noexcept
Node & at(size_t i) noexcept
Node * node() const noexcept
size_t span() const noexcept
iterator operator++() noexcept
size_t index() const noexcept
QHashPrivate::Span< Node > Span
bool isUnused() const noexcept
bool operator!=(iterator other) const noexcept
bool atEnd() const noexcept
bool operator==(iterator other) const noexcept
TryEmplaceResult(QHash::iterator it, bool b)
TryEmplaceResult()=default