9#include <QtCore/qbasicatomic.h>
14QT_WARNING_DISABLE_GCC(
"-Wextra")
18class QAtomicInteger :
public QBasicAtomicInteger<T>
22 constexpr QAtomicInteger(T value = 0)
noexcept : QBasicAtomicInteger<T>(value) {}
24 inline QAtomicInteger(
const QAtomicInteger &other)
noexcept
25 : QBasicAtomicInteger<T>()
27 this->storeRelease(other.loadAcquire());
30 inline QAtomicInteger &operator=(
const QAtomicInteger &other)
noexcept
32 this->storeRelease(other.loadAcquire());
37 T loadRelaxed()
const;
38 T loadAcquire()
const;
39 void storeRelaxed(T newValue);
40 void storeRelease(T newValue);
43 QAtomicInteger &operator=(T);
45 static constexpr bool isReferenceCountingNative();
46 static constexpr bool isReferenceCountingWaitFree();
52 static constexpr bool isTestAndSetNative();
53 static constexpr bool isTestAndSetWaitFree();
55 bool testAndSetRelaxed(T expectedValue, T newValue);
56 bool testAndSetAcquire(T expectedValue, T newValue);
57 bool testAndSetRelease(T expectedValue, T newValue);
58 bool testAndSetOrdered(T expectedValue, T newValue);
60 bool testAndSetRelaxed(T expectedValue, T newValue, T ¤tValue);
61 bool testAndSetAcquire(T expectedValue, T newValue, T ¤tValue);
62 bool testAndSetRelease(T expectedValue, T newValue, T ¤tValue);
63 bool testAndSetOrdered(T expectedValue, T newValue, T ¤tValue);
65 static constexpr bool isFetchAndStoreNative();
66 static constexpr bool isFetchAndStoreWaitFree();
68 T fetchAndStoreRelaxed(T newValue);
69 T fetchAndStoreAcquire(T newValue);
70 T fetchAndStoreRelease(T newValue);
71 T fetchAndStoreOrdered(T newValue);
73 static constexpr bool isFetchAndAddNative();
74 static constexpr bool isFetchAndAddWaitFree();
76 T fetchAndAddRelaxed(T valueToAdd);
77 T fetchAndAddAcquire(T valueToAdd);
78 T fetchAndAddRelease(T valueToAdd);
79 T fetchAndAddOrdered(T valueToAdd);
81 T fetchAndSubRelaxed(T valueToSub);
82 T fetchAndSubAcquire(T valueToSub);
83 T fetchAndSubRelease(T valueToSub);
84 T fetchAndSubOrdered(T valueToSub);
86 T fetchAndOrRelaxed(T valueToOr);
87 T fetchAndOrAcquire(T valueToOr);
88 T fetchAndOrRelease(T valueToOr);
89 T fetchAndOrOrdered(T valueToOr);
91 T fetchAndAndRelaxed(T valueToAnd);
92 T fetchAndAndAcquire(T valueToAnd);
93 T fetchAndAndRelease(T valueToAnd);
94 T fetchAndAndOrdered(T valueToAnd);
96 T fetchAndXorRelaxed(T valueToXor);
97 T fetchAndXorAcquire(T valueToXor);
98 T fetchAndXorRelease(T valueToXor);
99 T fetchAndXorOrdered(T valueToXor);
105 T operator+=(T value);
106 T operator-=(T value);
107 T operator|=(T value);
108 T operator&=(T value);
109 T operator^=(T value);
132 this->storeRelease(other.loadAcquire());
137 this->storeRelease(other.loadAcquire());
181
182
183
184
185
187inline void qAtomicAssign(T *&d, T *x)
198
199
200
201
202
203
204
208 if (d->ref.loadRelaxed() == 1)
constexpr QAtomicInt(int value=0) noexcept
Constructs a QAtomicInt with the given value.
\macro Q_ATOMIC_INTnn_IS_SUPPORTED
QAtomicPointer(const QAtomicPointer< T > &other) noexcept
Constructs a copy of other.
QAtomicPointer< T > & operator=(const QAtomicPointer< T > &other) noexcept
Assigns other to this QAtomicPointer and returns a reference to this QAtomicPointer.
constexpr QAtomicPointer(T *value=nullptr) noexcept
Constructs a QAtomicPointer with the given value.
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)
void qAtomicDetach(T *&d)
This is a helper for the detach method of implicitly shared classes.
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