Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qmetacontainer.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 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
4#include "qmetacontainer.h"
5#include "qmetatype.h"
6
8
51{
52 if (!d_ptr)
53 return false;
55}
56
68{
69 if (!d_ptr)
70 return false;
72}
73
89
99{
100 if (!d_ptr)
101 return false;
103}
104
109{
110 if (auto iface = d())
112 return QMetaType();
113}
114
137
145{
146 if (auto iface = d()) {
147 return iface->addValueFn
149 }
150 return false;
151}
152
159void QMetaSequence::addValueAtBegin(void *container, const void *value) const
160{
161 if (canAddValueAtBegin())
163}
164
172{
173 if (auto iface = d()) {
174 return iface->removeValueFn
176 }
177 return false;
178}
179
191
199{
200 if (auto iface = d()) {
201 return iface->addValueFn
203 }
204 return false;
205}
206
213void QMetaSequence::addValueAtEnd(void *container, const void *value) const
214{
215 if (canAddValueAtEnd())
217}
218
226{
227 if (auto iface = d()) {
228 return iface->removeValueFn
230 }
231 return false;
232}
233
245
253{
254 return d_ptr && d_ptr->sizeFn;
255}
256
263qsizetype QMetaContainer::size(const void *container) const
264{
265 return hasSize() ? d_ptr->sizeFn(container) : -1;
266}
267
274{
275 return d_ptr && d_ptr->clearFn;
276}
277
283void QMetaContainer::clear(void *container) const
284{
285 if (canClear())
286 d_ptr->clearFn(container);
287}
288
296{
297 if (auto iface = d())
298 return iface->valueAtIndexFn;
299 return false;
300}
301
308void QMetaSequence::valueAtIndex(const void *container, qsizetype index, void *result) const
309{
310 if (canGetValueAtIndex())
311 d()->valueAtIndexFn(container, index, result);
312}
313
321{
322 if (auto iface = d())
323 return iface->setValueAtIndexFn;
324 return false;
325}
326
333void QMetaSequence::setValueAtIndex(void *container, qsizetype index, const void *value) const
334{
335 if (canSetValueAtIndex())
336 d()->setValueAtIndexFn(container, index, value);
337}
338
346{
347 if (auto iface = d())
348 return iface->addValueFn;
349 return false;
350}
351
365void QMetaSequence::addValue(void *container, const void *value) const
366{
367 if (canAddValue()) {
368 d()->addValueFn(container, value,
370 }
371}
372
380{
381 if (auto iface = d())
382 return iface->removeValueFn;
383 return false;
384}
385
397void QMetaSequence::removeValue(void *container) const
398{
399 if (canRemoveValue()) {
400 d()->removeValueFn(container,
402 }
403}
404
423
433void *QMetaContainer::begin(void *container) const
434{
435 return hasIterator()
438 : nullptr;
439}
440
450void *QMetaContainer::end(void *container) const
451{
452 return hasIterator()
455 : nullptr;
456}
457
464void QMetaContainer::destroyIterator(const void *iterator) const
465{
466 if (hasIterator())
467 d_ptr->destroyIteratorFn(iterator);
468}
469
477bool QMetaContainer::compareIterator(const void *i, const void *j) const
478{
479 return hasIterator() ? d_ptr->compareIteratorFn(i, j) : false;
480}
481
488void QMetaContainer::copyIterator(void *target, const void *source) const
489{
490 if (hasIterator())
492}
493
502void QMetaContainer::advanceIterator(void *iterator, qsizetype step) const
503{
504 if (hasIterator())
505 d_ptr->advanceIteratorFn(iterator, step);
506}
507
516qsizetype QMetaContainer::diffIterator(const void *i, const void *j) const
517{
518 return hasIterator() ? d_ptr->diffIteratorFn(i, j) : 0;
519}
520
528{
529 if (auto iface = d())
530 return iface->valueAtIteratorFn;
531 return false;
532}
533
540void QMetaSequence::valueAtIterator(const void *iterator, void *result) const
541{
543 d()->valueAtIteratorFn(iterator, result);
544}
545
553{
554 if (auto iface = d())
556 return false;
557}
558
565void QMetaSequence::setValueAtIterator(const void *iterator, const void *value) const
566{
568 d()->setValueAtIteratorFn(iterator, value);
569}
570
578{
579 if (auto iface = d())
581 return false;
582}
583
596void QMetaSequence::insertValueAtIterator(void *container, const void *iterator,
597 const void *value) const
598{
600 d()->insertValueAtIteratorFn(container, iterator, value);
601}
602
610{
611 if (auto iface = d())
613 return false;
614}
615
622void QMetaSequence::eraseValueAtIterator(void *container, const void *iterator) const
623{
625 d()->eraseValueAtIteratorFn(container, iterator);
626}
627
633{
634 if (auto iface = d())
636 return false;
637}
638
645void QMetaSequence::eraseRangeAtIterator(void *container, const void *iterator1,
646 const void *iterator2) const
647{
649 d()->eraseRangeAtIteratorFn(container, iterator1, iterator2);
650}
651
671
681void *QMetaContainer::constBegin(const void *container) const
682{
683 return hasConstIterator()
686 : nullptr;
687}
688
698void *QMetaContainer::constEnd(const void *container) const
699{
700 return hasConstIterator()
703 : nullptr;
704}
705
712void QMetaContainer::destroyConstIterator(const void *iterator) const
713{
714 if (hasConstIterator())
715 d_ptr->destroyConstIteratorFn(iterator);
716}
717
725bool QMetaContainer::compareConstIterator(const void *i, const void *j) const
726{
727 return hasConstIterator() ? d_ptr->compareConstIteratorFn(i, j) : false;
728}
729
736void QMetaContainer::copyConstIterator(void *target, const void *source) const
737{
738 if (hasConstIterator())
740}
741
750void QMetaContainer::advanceConstIterator(void *iterator, qsizetype step) const
751{
752 if (hasConstIterator())
753 d_ptr->advanceConstIteratorFn(iterator, step);
754}
755
764qsizetype QMetaContainer::diffConstIterator(const void *i, const void *j) const
765{
766 return hasConstIterator() ? d_ptr->diffConstIteratorFn(i, j) : 0;
767}
768
776{
777 if (auto iface = d())
779 return false;
780}
781
788void QMetaSequence::valueAtConstIterator(const void *iterator, void *result) const
789{
791 d()->valueAtConstIteratorFn(iterator, result);
792}
793
815{
816 if (auto iface = d())
817 return QMetaType(iface->keyMetaType);
818 return QMetaType();
819}
820
825{
826 if (auto iface = d())
828 return QMetaType();
829}
830
QMetaType keyMetaType() const
Returns the meta type for keys in the container.
QMetaType mappedMetaType() const
Returns the meta type for mapped values in the container.
const QtMetaContainerPrivate::QMetaAssociationInterface * iface() const
void advanceConstIterator(void *iterator, qsizetype step) const
Advances the const iterator by step steps.
bool hasSize() const
Returns true if the container can be queried for its size, false otherwise.
void * constEnd(const void *container) const
Creates and returns a const iterator pointing to the end of container.
void clear(void *container) const
Clears the given container if it can be cleared.
bool compareIterator(const void *i, const void *j) const
Returns true if the non-const iterators i and j point to the same value in the container they are ite...
void copyConstIterator(void *target, const void *source) const
Copies the const iterator source into the const iterator target.
void copyIterator(void *target, const void *source) const
Copies the non-const iterator source into the non-const iterator target.
bool compareConstIterator(const void *i, const void *j) const
Returns true if the const iterators i and j point to the same value in the container they are iterati...
bool hasRandomAccessIterator() const
Returns true if the underlying container provides a random access iterator as defined by std::random_...
void destroyConstIterator(const void *iterator) const
Destroys a const iterator previously created using \l constBegin() or \l constEnd().
bool hasInputIterator() const
Returns true if the underlying container provides at least an input iterator as defined by std::input...
bool canClear() const
Returns true if the container can be cleared, false otherwise.
void advanceIterator(void *iterator, qsizetype step) const
Advances the non-const iterator by step steps.
void * constBegin(const void *container) const
Creates and returns a const iterator pointing to the beginning of container.
void * end(void *container) const
Creates and returns a non-const iterator pointing to the end of container.
void destroyIterator(const void *iterator) const
Destroys a non-const iterator previously created using \l begin() or \l end().
qsizetype diffConstIterator(const void *i, const void *j) const
Returns the distance between the const iterators i and j, the equivalent of i - j.
bool hasIterator() const
Returns true if the underlying container offers a non-const iterator, false otherwise.
void * begin(void *container) const
Creates and returns a non-const iterator pointing to the beginning of container.
bool hasBidirectionalIterator() const
Returns true if the underlying container provides a bi-directional iterator or a random access iterat...
bool hasForwardIterator() const
Returns true if the underlying container provides at least a forward iterator as defined by std::forw...
qsizetype diffIterator(const void *i, const void *j) const
Returns the distance between the non-const iterators i and j, the equivalent of i - j.
qsizetype size(const void *container) const
Returns the number of values in the given container if it can be queried for its size.
const QtMetaContainerPrivate::QMetaContainerInterface * d_ptr
bool hasConstIterator() const
Returns true if the underlying container offers a const iterator, false otherwise.
bool canSetValueAtIndex() const
Returns true if an value can be written to the container by index, otherwise false.
bool canAddValueAtEnd() const
Returns true if values added using \l addValue() can be placed at the end of the container,...
bool canRemoveValueAtBegin() const
Returns true if values can be removed from the beginning of the container using \l removeValue() can ...
void setValueAtIndex(void *container, qsizetype index, const void *value) const
Overwrites the value at index in the container using the value passed as parameter if that is possibl...
bool canGetValueAtIterator() const
Returns true if the underlying container can retrieve the value pointed to by a non-const iterator,...
void eraseValueAtIterator(void *container, const void *iterator) const
Erases the value pointed to by the non-const iterator from the container, if possible.
bool canEraseRangeAtIterator() const
Returns true if a range between two iterators can be erased from the container, false otherwise.
bool canGetValueAtIndex() const
Returns true if values can be retrieved from the container by index, otherwise false.
void removeValue(void *container) const
Removes an value from the container if possible.
void valueAtConstIterator(const void *iterator, void *result) const
Retrieves the value pointed to by the const iterator and stores it in the memory location pointed to ...
bool canEraseValueAtIterator() const
Returns true if the value pointed to by a non-const iterator can be erased, false otherwise.
bool canAddValueAtBegin() const
Returns true if values added using \l addValue() can be placed at the beginning of the container,...
bool canRemoveValueAtEnd() const
Returns true if values can be removed from the end of the container using \l removeValue() can be pla...
void addValueAtEnd(void *container, const void *value) const
Adds value to the end of container if possible.
void setValueAtIterator(const void *iterator, const void *value) const
Writes value to the value pointed to by the non-const iterator, if possible.
void addValue(void *container, const void *value) const
Adds value to the container if possible.
bool canRemoveValue() const
Returns true if values can be removed from the container, false otherwise.
void removeValueAtEnd(void *container) const
Removes a value from the end of container if possible.
bool canSetValueAtIterator() const
Returns true if the underlying container can write to the value pointed to by a non-const iterator,...
bool canGetValueAtConstIterator() const
Returns true if the underlying container can retrieve the value pointed to by a const iterator,...
void removeValueAtBegin(void *container) const
Removes a value from the beginning of container if possible.
const QtMetaContainerPrivate::QMetaSequenceInterface * iface() const
QMetaType valueMetaType() const
Returns the meta type for values stored in the container.
bool canAddValue() const
Returns true if values can be added to the container, false otherwise.
void eraseRangeAtIterator(void *container, const void *iterator1, const void *iterator2) const
Erases the range of values between the iterators iterator1 and iterator2 from the container,...
void valueAtIterator(const void *iterator, void *result) const
Retrieves the value pointed to by the non-const iterator and stores it in the memory location pointed...
void insertValueAtIterator(void *container, const void *iterator, const void *value) const
Inserts value into the container, if possible, taking the non-const iterator into account.
void valueAtIndex(const void *container, qsizetype index, void *result) const
Retrieves the value at index in the container and places it in the memory location pointed to by resu...
bool canInsertValueAtIterator() const
Returns true if the underlying container can insert a new value, taking the location pointed to by a ...
bool isSortable() const
Returns true if the underlying container is sortable, otherwise returns false.
void addValueAtBegin(void *container, const void *value) const
Adds value to the beginning of container if possible.
\inmodule QtCore
Definition qmetatype.h:341
const QtPrivate::QMetaTypeInterface * keyMetaType
const QtPrivate::QMetaTypeInterface * mappedMetaType
const QtPrivate::QMetaTypeInterface * valueMetaType
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLenum target
GLsizei GLsizei GLchar * source
GLuint64EXT * result
[6]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
ptrdiff_t qsizetype
Definition qtypes.h:165