Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QArrayData Struct Reference

#include <qarraydata.h>

+ Inheritance diagram for QArrayData:
+ Collaboration diagram for QArrayData:

Public Types

enum  AllocationOption { Grow , KeepSize }
 
enum  GrowthPosition { GrowsAtEnd , GrowsAtBeginning }
 
enum  ArrayOption { ArrayOptionDefault = 0 , CapacityReserved = 0x1 }
 

Public Member Functions

qsizetype allocatedCapacity () noexcept
 
qsizetype constAllocatedCapacity () const noexcept
 
bool ref () noexcept
 Returns true if sharing took place.
 
bool deref () noexcept
 Returns false if deallocation is necessary.
 
bool isShared () const noexcept
 
bool needsDetach () const noexcept
 
qsizetype detachCapacity (qsizetype newSize) const noexcept
 

Static Public Member Functions

static Q_CORE_EXPORT voidallocate (QArrayData **pdata, qsizetype objectSize, qsizetype alignment, qsizetype capacity, AllocationOption option=QArrayData::KeepSize) noexcept
 
static Q_CORE_EXPORT QPair< QArrayData *, void * > reallocateUnaligned (QArrayData *data, void *dataPointer, qsizetype objectSize, qsizetype newCapacity, AllocationOption option) noexcept
 
static Q_CORE_EXPORT void deallocate (QArrayData *data, qsizetype objectSize, qsizetype alignment) noexcept
 

Public Attributes

QBasicAtomicInt ref_
 
ArrayOptions flags
 
qsizetype alloc
 

Detailed Description

Definition at line 16 of file qarraydata.h.

Member Enumeration Documentation

◆ AllocationOption

Enumerator
Grow 
KeepSize 

Definition at line 18 of file qarraydata.h.

◆ ArrayOption

Enumerator
ArrayOptionDefault 
CapacityReserved 

the capacity was reserved by the user, try to keep it

Definition at line 28 of file qarraydata.h.

◆ GrowthPosition

Enumerator
GrowsAtEnd 
GrowsAtBeginning 

Definition at line 23 of file qarraydata.h.

Member Function Documentation

◆ allocate()

void * QArrayData::allocate ( QArrayData **  pdata,
qsizetype  objectSize,
qsizetype  alignment,
qsizetype  capacity,
QArrayData::AllocationOption  option = QArrayData::KeepSize 
)
staticnoexcept

Definition at line 160 of file qarraydata.cpp.

References alignment, allocateData(), calculateBlockSize(), capacity, QTypedArrayData< T >::dataStart(), header(), headerSize, Q_ASSERT, Q_UNLIKELY, and reserveExtraBytes().

Referenced by QTypedArrayData< T >::allocate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ allocatedCapacity()

qsizetype QArrayData::allocatedCapacity ( )
inlinenoexcept

Definition at line 38 of file qarraydata.h.

References alloc.

Referenced by QArrayDataPointer< T >::allocatedCapacity().

+ Here is the caller graph for this function:

◆ constAllocatedCapacity()

qsizetype QArrayData::constAllocatedCapacity ( ) const
inlinenoexcept

Definition at line 43 of file qarraydata.h.

References alloc.

Referenced by QArrayDataPointer< T >::constAllocatedCapacity(), detachCapacity(), and QArrayDataPointer< T >::freeSpaceAtEnd().

+ Here is the caller graph for this function:

◆ deallocate()

void QArrayData::deallocate ( QArrayData data,
qsizetype  objectSize,
qsizetype  alignment 
)
staticnoexcept

Definition at line 234 of file qarraydata.cpp.

References alignment, Q_ASSERT, and Q_UNUSED.

Referenced by QTypedArrayData< T >::deallocate().

+ Here is the caller graph for this function:

◆ deref()

bool QArrayData::deref ( )
inlinenoexcept

Returns false if deallocation is necessary.

Definition at line 56 of file qarraydata.h.

References QBasicAtomicInteger< T >::deref(), and ref_.

Referenced by QStringHashNode::~QStringHashNode(), and QArrayDataPointer< T >::deref().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detachCapacity()

qsizetype QArrayData::detachCapacity ( qsizetype  newSize) const
inlinenoexcept

Definition at line 74 of file qarraydata.h.

References CapacityReserved, and constAllocatedCapacity().

Referenced by QArrayDataPointer< T >::detachCapacity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isShared()

bool QArrayData::isShared ( ) const
inlinenoexcept

Definition at line 61 of file qarraydata.h.

References QBasicAtomicInteger< T >::loadRelaxed(), and ref_.

Referenced by QArrayDataPointer< T >::isShared(), and QArrayDataPointer< T >::reinterpreted().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ needsDetach()

bool QArrayData::needsDetach ( ) const
inlinenoexcept

Definition at line 69 of file qarraydata.h.

References QBasicAtomicInteger< T >::loadRelaxed(), and ref_.

Referenced by QArrayDataPointer< T >::needsDetach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reallocateUnaligned()

QPair< QArrayData *, void * > QArrayData::reallocateUnaligned ( QArrayData data,
void dataPointer,
qsizetype  objectSize,
qsizetype  newCapacity,
AllocationOption  option 
)
staticnoexcept

Definition at line 204 of file qarraydata.cpp.

References calculateBlockSize(), capacity, header(), headerSize, Q_ASSERT, Q_UNLIKELY, qMakePair(), and reserveExtraBytes().

Referenced by QTypedArrayData< T >::reallocateUnaligned().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ref()

bool QArrayData::ref ( )
inlinenoexcept

Returns true if sharing took place.

Definition at line 49 of file qarraydata.h.

References QBasicAtomicInteger< T >::ref(), and ref_.

Referenced by QStringHashNode::QStringHashNode(), QStringHashNode::QStringHashNode(), QStringHash< T >::initializeNode(), QStringHashNode::key(), QArrayDataPointer< T >::ref(), and QStringHash< T >::takeNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ alloc

qsizetype QArrayData::alloc

◆ flags

ArrayOptions QArrayData::flags

◆ ref_


The documentation for this struct was generated from the following files: