| qalgorithms.h |
|
3262 |
- |
| qalgorithms.qdoc |
|
8927 |
- |
| qarraydata.cpp |
This pair of functions is declared in qtools_p.h and is used by the Qt
containers to allocate memory and grow the memory block during append
operations.
They take qsizetype parameters and return qsizetype so they will change sizes
according to the pointer width. However, knowing Qt containers store the
container size and element indexes in ints, these functions never return a
size larger than INT_MAX. This is done by casting the element count and
memory block size to int in several comparisons: the check for negative is
very fast on most platforms as the code only needs to check the sign bit.
These functions return SIZE_MAX on overflow, which can be passed to malloc()
and will surely cause a NULL return (there's no way you can allocate a
memory block the size of your entire VM space).
|
9900 |
- |
| qarraydata.h |
|
7901 |
- |
| qarraydataops.h |
|
36729 |
- |
| qarraydatapointer.h |
! \internal
Reinterprets the data of this QArrayDataPointer to type X. It's the
caller's responsibility to ensure that the data contents are valid and
properly aligned, particularly if T and X are not trivial types (i.e,
don't do that). The current size is kept and the allocated capacity is
updated to account for the difference in the element type's size.
This is used in QString::fromLatin1 to perform in-place conversion of
QString to QByteArray.
|
17232 |
- |
| qatomicscopedvaluerollback.h |
|
5670 |
- |
| qatomicscopedvaluerollback.qdoc |
|
5107 |
- |
| qbitarray.cpp |
!
\class QBitArray
\inmodule QtCore
\brief The QBitArray class provides an array of bits.
\ingroup tools
\ingroup shared
\reentrant
\compares equality
A QBitArray is an array that gives access to individual bits and
provides operators (\l{operator&()}{AND}, \l{operator|()}{OR},
\l{operator^()}{XOR}, and \l{operator~()}{NOT}) that work on
entire arrays of bits. It uses \l{implicit sharing} (copy-on-write)
to reduce memory usage and to avoid the needless copying of data.
The following code constructs a QBitArray containing 200 bits
initialized to false (0):
\snippet code/src_corelib_tools_qbitarray.cpp 0
To initialize the bits to true, either pass \c true as second
argument to the constructor, or call fill() later on.
QBitArray uses 0-based indexes, just like C++ arrays. To access
the bit at a particular index position, you can use operator[]().
On non-const bit arrays, operator[]() returns a reference to a
bit that can be used on the left side of an assignment. For
example:
\snippet code/src_corelib_tools_qbitarray.cpp 1
For technical reasons, it is more efficient to use testBit() and
setBit() to access bits in the array than operator[](). For
example:
\snippet code/src_corelib_tools_qbitarray.cpp 2
QBitArray supports \c{&} (\l{operator&()}{AND}), \c{|}
(\l{operator|()}{OR}), \c{^} (\l{operator^()}{XOR}),
\c{~} (\l{operator~()}{NOT}), as well as
\c{&=}, \c{|=}, and \c{^=}. These operators work in the same way
as the built-in C++ bitwise operators of the same name. For
example:
\snippet code/src_corelib_tools_qbitarray.cpp 3
For historical reasons, QBitArray distinguishes between a null
bit array and an empty bit array. A \e null bit array is a bit
array that is initialized using QBitArray's default constructor.
An \e empty bit array is any bit array with size 0. A null bit
array is always empty, but an empty bit array isn't necessarily
null:
\snippet code/src_corelib_tools_qbitarray.cpp 4
All functions except isNull() treat null bit arrays the same as
empty bit arrays; for example, QBitArray() compares equal to
QBitArray(0). We recommend that you always use isEmpty() and
avoid isNull().
\sa QByteArray, QList
|
29036 |
- |
| qbitarray.h |
|
6300 |
- |
| qcache.h |
|
6377 |
- |
| qcache.qdoc |
|
6241 |
- |
| qcommandlineoption.cpp |
!
\since 5.2
\class QCommandLineOption
\brief The QCommandLineOption class defines a possible command-line option.
\inmodule QtCore
\ingroup shared
\ingroup tools
This class is used to describe an option on the command line. It allows
different ways of defining the same option with multiple aliases possible.
It is also used to describe how the option is used - it may be a flag (e.g. \c{-v})
or take a value (e.g. \c{-o file}).
Examples:
\snippet code/src_corelib_tools_qcommandlineoption.cpp 0
\sa QCommandLineParser
|
11680 |
- |
| qcommandlineoption.h |
implicit |
2162 |
- |
| qcommandlineparser.cpp |
|
44964 |
- |
| qcommandlineparser.h |
|
2563 |
- |
| qcontainerfwd.h |
= std::dynamic_extent |
1899 |
- |
| qcontainertools_impl.h |
!
\internal
Returns whether \a p is within a range [b, e). In simplest form equivalent to:
b <= p < e.
|
15876 |
- |
| qcontiguouscache.cpp |
ref= |
14309 |
- |
| qcontiguouscache.h |
|
11904 |
- |
| qcryptographichash.cpp |
This lets us choose between SHA3 implementations at build time.
|
58104 |
- |
| qcryptographichash.h |
|
3716 |
- |
| qduplicatetracker_p.h |
QDUPLICATETRACKER_P_H |
3961 |
- |
| qeasingcurve.cpp |
| *property* | *Used for type* |
| period | QEasingCurve::{In,Out,InOut,OutIn}Elastic |
| amplitude | QEasingCurve::{In,Out,InOut,OutIn}Bounce, QEasingCurve::{In,Out,InOut,OutIn}Elastic |
| overshoot | QEasingCurve::{In,Out,InOut,OutIn}Back |
|
55231 |
- |
| qeasingcurve.h |
|
3487 |
- |
| qflatmap_p.h |
QFlatMap provides an associative container backed by sorted sequential
containers. By default, QList is used.
Keys and values are stored in two separate containers. This provides improved
cache locality for key iteration and makes keys() and values() fast
operations.
One can customize the underlying container type by passing the KeyContainer
and MappedContainer template arguments:
QFlatMap<float, int, std::less<float>, std::vector<float>, std::vector<int>>
|
30308 |
- |
| qfreelist.cpp |
|
924 |
- |
| qfreelist_p.h |
! \internal
Element in a QFreeList. ConstReferenceType and ReferenceType are used as
the return values for QFreeList::at() and QFreeList::operator[](). Contains
the real data storage (_t) and the id of the next free element (next).
Note: the t() functions should be used to access the data, not _t.
|
8511 |
- |
| qfunctionaltools_impl.cpp |
end |
1364 |
- |
| qfunctionaltools_impl.h |
!
\class QtPrivate::CompactStorage
\internal
CompactStorage is a small utility class that stores an object in the
most space-efficient way possible. If the stored type is empty and not
marked as \c final, CompactStorage inherits from it directly, allowing
the compiler to apply the Empty Base Optimization (EBO). Otherwise,
the object is stored as a regular data member.
This class is typically used as a private base class for utility types
that need to optionally carry extra data without increasing their size.
The stored object can be accessed through the \c object() accessor,
which returns the contained object in any const/reference combination.
Example 1:
// FileHandle carries a lightweight context describing
// the underlying OS resource.
struct Context {
int fd = -1;
bool isTemporary = false;
};
struct FileHandle : private QtPrivate::CompactStorage<Context>
{
using Storage = QtPrivate::CompactStorage<Context>;
FileHandle(int descriptor, bool temp)
: Storage(Context{descriptor, temp})
{}
void open(int descriptor, bool temp) noexcept {
object().fd = descriptor;
object().isTemporary = temp;
}
void close() noexcept {
if (object().isTemporary)
::close(object().fd);
}
};
Example 2:
// When the stored type is empty, EBO removes any overhead.
struct EmptyContext {};
struct LightweightHandle : private QtPrivate::CompactStorage<EmptyContext>
{
using Storage = QtPrivate::CompactStorage<EmptyContext>;
int handle = -1;
void reset(int h) noexcept { handle = h; }
};
static_assert(sizeof(LightweightHandle) == sizeof(int));
|
3758 |
- |
| qhash.cpp |
The QHash seed itself.
|
145640 |
- |
| qhash.h |
|
90239 |
- |
| qhashfunctions.h |
QHashPrivate::hash() xors before mixing, while 1-to-2-arg adapter xors after |
20850 |
- |
| qiterator.h |
|
13600 |
- |
| qiterator.qdoc |
|
53831 |
- |
| qline.cpp |
!
\class QLine
\inmodule QtCore
\ingroup painting
\compares equality
\compareswith equality QLineF
\endcompareswith
\brief The QLine class provides a two-dimensional vector using
integer precision.
A QLine describes a finite length line (or a line segment) on a
two-dimensional surface. The start and end points of the line are
specified using integer point accuracy for coordinates. Use the
QLineF constructor to retrieve a floating point copy.
\table
\row
\li \inlineimage qline-point.png {Line with p1, p2, dx, dy labeled}
\li \inlineimage qline-coordinates.png
{Line with x1, y1, x2, y2, dx, dy labeled}
\endtable
The positions of the line's start and end points can be retrieved
using the p1(), x1(), y1(), p2(), x2(), and y2() functions. The
dx() and dy() functions return the horizontal and vertical
components of the line. Use isNull() to determine whether the
QLine represents a valid line or a null line.
Finally, the line can be translated a given offset using the
translate() function.
\sa QLineF, QPolygon, QRect
|
20179 |
- |
| qline.h |
class QLine
***************************************************************************** |
10963 |
- |
| qlist.h |
|
40901 |
- |
| qlist.qdoc |
|
50506 |
- |
| qmakearray_p.h |
|
4146 |
- |
| qmap.h |
|
58907 |
- |
| qmap.qdoc |
|
46966 |
- |
| qmargins.cpp |
!
\class QMargins
\inmodule QtCore
\ingroup painting
\since 4.6
\compares equality
\compareswith equality QMarginsF
\endcompareswith
\brief The QMargins class defines the four margins of a rectangle.
QMargin defines a set of four margins; left, top, right, and bottom,
that describe the size of the borders surrounding a rectangle.
The isNull() function returns \c true only if all margins are set to zero.
QMargin objects can be streamed as well as compared.
|
18516 |
- |
| qmargins.h |
QMargins class
*************************************************************************** |
20441 |
- |
| qmessageauthenticationcode.h |
|
3494 |
- |
| qminimalflatset_p.h |
This is a minimal version of a QFlatSet, the std::set version of QFlatMap.
Like QFlatMap, it has linear insertion and removal, not logarithmic, like
real QMap and std::set, so it's only a good container if you either have
very few entries or lots, but with separate setup and lookup stages.
Because a full QFlatSet would be 10x the work on writing this minimal one,
we keep it here for now. When more users pop up and the class has matured a
bit, we can consider moving it as QFlatSet alongside QFlatMap.
|
5656 |
- |
| qmultimap.qdoc |
|
54962 |
- |
| qoffsetstringarray_p.h |
|
4696 |
- |
| qpair.h |
|
699 |
- |
| qpair.qdoc |
|
751 |
- |
| qpoint.cpp |
!
\class QPoint
\inmodule QtCore
\ingroup painting
\reentrant
\compares equality
\compareswith equality QPointF
\endcompareswith
\brief The QPoint class defines a point in the plane using integer
precision.
A point is specified by a x coordinate and an y coordinate which
can be accessed using the x() and y() functions. The isNull()
function returns \c true if both x and y are set to 0. The
coordinates can be set (or altered) using the setX() and setY()
functions, or alternatively the rx() and ry() functions which
return references to the coordinates (allowing direct
manipulation).
Given a point \e p, the following statements are all equivalent:
\snippet code/src_corelib_tools_qpoint.cpp 0
A QPoint object can also be used as a vector: Addition and
subtraction are defined as for vectors (each component is added
separately). A QPoint object can also be divided or multiplied by
an \c int or a \c qreal.
In addition, the QPoint class provides the manhattanLength()
function which gives an inexpensive approximation of the length of
the QPoint object interpreted as a vector. Finally, QPoint objects
can be streamed as well as compared.
\sa QPointF, QPolygon
|
19342 |
- |
| qpoint.h |
QPoint stream functions
*************************************************************************** |
13588 |
- |
| qquasivirtual_impl.h |
const validation |
8608 |
- |
| qqueue.cpp |
!
\class QQueue
\inmodule QtCore
\brief The QQueue class is a generic container that provides a queue.
\ingroup tools
\ingroup shared
\ingroup containers
\reentrant
QQueue\<T\> is one of Qt's generic \l{container classes}, where
\a T specifies the element type. It implements a queue data structure
for items of a same type.
A queue is a first in, first out (FIFO) structure. Items are
added to the tail of the queue using enqueue() and retrieved from
the head using dequeue(). The head() function provides access to
the head item without removing it.
Example:
\snippet code/src_corelib_tools_qqueue.cpp 0
The example will output 1, 2, 3 in that order.
QQueue inherits from QList. All of QList's functionality also
applies to QQueue. For example, you can use isEmpty() to test
whether the queue is empty, and you can traverse a QQueue using
QList's iterator classes (for example, QListIterator). But in
addition, QQueue provides three convenience functions that make
it easy to implement FIFO semantics: enqueue(), dequeue(), and
head().
QQueue's value type must be an \l{assignable data type}. This
covers most data types that are commonly used, but the compiler
won't let you, for example, store a QWidget as a value. Use
QWidget* instead.
\sa QList, QStack
|
2517 |
- |
| qqueue.h |
|
844 |
- |
| qrect.cpp |
|
65010 |
- |
| qrect.h |
|
31166 |
- |
| qrefcount.cpp |
!
\class QtPrivate::RefCount
\inmodule QtCore
\internal
QRefCount implements atomic ref counting for Qt's shared classes. It behaves very similar
to QAtomicInt, but ignores negative ref counts.
This can be used to allow to implement e.g. const read-only QStringData objects. QString::shared_null and
the qs(...) macro make use of this feature.
|
510 |
- |
| qrefcount.h |
|
1283 |
- |
| qringbuffer.cpp |
!
\internal
Access the bytes at a specified position the out-variable length will
contain the amount of bytes readable from there, e.g. the amount still
the same QByteArray
|
9610 |
- |
| qringbuffer_p.h |
|
5700 |
- |
| qscopedpointer.h |
|
6407 |
- |
| qscopedpointer.qdoc |
|
10775 |
- |
| qscopedvaluerollback.cpp |
!
\class QScopedValueRollback
\inmodule QtCore
\brief The QScopedValueRollback class resets a variable to its previous value on destruction.
\since 4.8
\ingroup misc
QScopedValueRollback\<T\> is a template class where \a T is the type of the
variable being managed. The QScopedValueRollback class can be used to revert
state when an exception is thrown without needing to write try-catch blocks.
It can also be used to manage variables that are temporarily set,
such as reentrancy guards. By using this class, the variable will
be reset whether the function is exited normally, exited early by
a return statement, or exited by an exception.
The template can only be instantiated with a type that supports assignment.
\sa QScopedPointer, QScopeGuard
|
1810 |
- |
| qscopedvaluerollback.h |
|
999 |
- |
| qscopeguard.h |
|
1814 |
- |
| qscopeguard.qdoc |
|
2824 |
- |
| qset.h |
non-constexpr |
15830 |
- |
| qset.qdoc |
|
26803 |
- |
| qshareddata.cpp |
!
\class QSharedData
\inmodule QtCore
\brief The QSharedData class is a base class for shared data objects.
\reentrant
QSharedData is designed to be used with QSharedDataPointer or
QExplicitlySharedDataPointer to implement custom \l{implicitly
shared} or explicitly shared classes. QSharedData provides
\l{thread-safe} reference counting.
See QSharedDataPointer and QExplicitlySharedDataPointer for details.
|
26902 |
- |
| qshareddata.h |
|
13043 |
- |
| qshareddata_impl.h |
|
4428 |
- |
| qsharedpointer.cpp |
|
64814 |
- |
| qsharedpointer.h |
|
8030 |
- |
| qsharedpointer_impl.h |
|
37180 |
- |
| qsize.cpp |
!
\class QSize
\inmodule QtCore
\ingroup painting
\brief The QSize class defines the size of a two-dimensional
object using integer point precision.
A size is specified by a width() and a height(). It can be set in
the constructor and changed using the setWidth(), setHeight(), or
scale() functions, or using arithmetic operators. A size can also
be manipulated directly by retrieving references to the width and
height using the rwidth() and rheight() functions. Finally, the
width and height can be swapped using the transpose() function.
The isValid() function determines if a size is valid (a valid size
has both width and height greater than or equal to zero). The isEmpty()
function returns \c true if either of the width and height is less
than, or equal to, zero, while the isNull() function returns \c true
only if both the width and the height is zero.
Use the expandedTo() function to retrieve a size which holds the
maximum height and width of \e this size and a given
size. Similarly, the boundedTo() function returns a size which
holds the minimum height and width of \e this size and a given
size.
QSize objects can be streamed as well as compared.
\sa QSizeF, QPoint, QRect
|
21233 |
- |
| qsize.h |
QSize stream functions
*************************************************************************** |
15012 |
- |
| qsmallbytearray_p.h |
|
3338 |
- |
| qspan.h |
bring into scope |
20444 |
- |
| qspan.qdoc |
|
24418 |
- |
| qstack.cpp |
!
\class QStack
\inmodule QtCore
\brief The QStack class is a template class that provides a stack.
\ingroup tools
\ingroup shared
\ingroup containers
\reentrant
QStack\<T\> is one of Qt's generic \l{container classes}, where
\a T specifies the element type. It implements a stack data structure
for items of the same type.
A stack is a last in, first out (LIFO) structure. Items are added
to the top of the stack using push() and retrieved from the top
using pop(). The top() function provides access to the topmost
item without removing it.
Example:
\snippet qstack/main.cpp 0
The example will output 3, 2, 1 in that order.
QStack inherits from QList. All of QList's functionality also
applies to QStack. For example, you can use isEmpty() to test
whether the stack is empty, and you can traverse a QStack using
QList's iterator classes (for example, QListIterator). But in
addition, QStack provides three convenience functions that make
it easy to implement LIFO semantics: push(), pop(), and top().
QStack's value type must be an \l{assignable data type}. This
covers most data types that are commonly used, but the compiler
won't let you, for example, store a QWidget as a value; instead,
store a QWidget *.
\sa QList, QQueue
|
2517 |
- |
| qstack.h |
|
785 |
- |
| qtaggedpointer.h |
|
5560 |
- |
| qtaggedpointer.qdoc |
|
6158 |
- |
| qtimeline.cpp |
!
\internal
|
22633 |
- |
| qtimeline.h |
|
2884 |
- |
| qtools_p.h |
otherwise |
3498 |
- |
| qtyperevision.cpp |
!
\class QTypeRevision
\inmodule QtCore
\since 6.0
\brief The QTypeRevision class contains a lightweight representation of
a version number with two 8-bit segments, major and minor, either
of which can be unknown.
\compares strong
Use this class to describe revisions of a type. Compatible revisions can be
expressed as increments of the minor version. Breaking changes can be
expressed as increments of the major version. The return values of
\l QMetaMethod::revision() and \l QMetaProperty::revision() can be passed to
\l QTypeRevision::fromEncodedVersion(). The resulting major and minor versions
specify in which Qt versions the properties and methods were added.
\sa QMetaMethod::revision(), QMetaProperty::revision()
|
6272 |
- |
| qtyperevision.h |
|
6423 |
- |
| quniquehandle_p.h |
! \internal QUniqueHandle is a general purpose RAII wrapper intended
for interfacing with resource-allocating C-style APIs, for example
operating system APIs, database engine APIs, or any other scenario
where resources are allocated and released, and where pointer
semantics does not seem a perfect fit.
QUniqueHandle does not support copying, because it is intended to
maintain ownership of resources that can not be copied. This makes
it safer to use than naked handle types, since ownership is
maintained by design.
The underlying handle object is described using a client supplied
HandleTraits object that is implemented per resource type. The
traits struct must describe two properties of a handle:
1) What value is considered invalid
2) How to close a resource.
Example 1:
struct InvalidHandleTraits {
using Type = HANDLE;
static Type invalidValue() {
return INVALID_HANDLE_VALUE;
}
static bool close(Type handle) {
return CloseHandle(handle) != 0;
}
}
using FileHandle = QUniqueHandle<InvalidHandleTraits>;
Usage:
// Takes ownership of returned handle.
FileHandle handle{ CreateFile(...) };
if (!handle.isValid()) {
qDebug() << GetLastError()
return;
}
...
Example 2:
struct SqLiteTraits {
using Type = sqlite3*;
static Type invalidValue() {
return nullptr;
}
static bool close(Type handle) {
sqlite3_close(handle);
return true;
}
}
using DbHandle = QUniqueHandle<SqLiteTraits>;
Usage:
DbHandle h;
// Take ownership of returned handle.
int result = sqlite3_open(":memory:", &h);
...
Example 3:
struct TempFileTraits {
using Type = FILE*;
static Type invalidValue() {
return nullptr;
}
static bool close(Type handle) {
return fclose(handle) == 0;
}
};
struct TempFileDeleter {
using Type = TempFileTraits::Type;
void operator()(Type handle) {
if (handle != TempFileTraits::invalidValue()) {
TempFileTraits::close(handle);
if (path)
remove(path);
}
}
const char* path{ nullptr };
};
using TempFileHandle = QUniqueHandle<TempFileTraits, TempFileDeleter>;
Usage:
TempFileHandle tempFile(fopen("temp.bin", "wb"), TempFileDeleter{ "my_temp.bin" });
...
NOTE: The QUniqueHandle assumes that closing a resource is
guaranteed to succeed, and provides no support for handling failure
to close a resource. It is therefore only recommended for use cases
where failure to close a resource is either not an error, or an
unrecoverable error.
|
8949 |
- |
| quniquehandle_types.cpp |
|
1050 |
- |
| quniquehandle_types_p.h |
|
1882 |
- |
| qvarlengtharray.h |
|
38838 |
- |
| qvarlengtharray.qdoc |
|
36899 |
- |
| qvector.h |
|
653 |
- |
| qversionnumber.cpp |
!
\class QVersionNumber
\inmodule QtCore
\since 5.6
\brief The QVersionNumber class contains a version number with an arbitrary
number of segments.
\compares strong
\snippet qversionnumber/main.cpp 0
|
16595 |
- |
| qversionnumber.h |
QVersionNumber stores small values inline, without memory allocation.
We do that by setting the LSB in the pointer that would otherwise hold
the longer form of the segments.
The constants below help us deal with the permutations for 32- and 64-bit,
little- and big-endian architectures.
|
15405 |
- |