Port two more local QSets to QDuplicateTrackers
Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Change-Id: Ia9e837ebba88aeb1916da041fc8460a0692a03e4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
4ab2abf379
commit
6da4ff824e
@ -44,6 +44,7 @@
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtCore/private/qstringiterator_p.h>
|
||||
#include <QtCore/private/qduplicatetracker_p.h>
|
||||
|
||||
#include <QtGui/private/qpaintengine_raster_p.h>
|
||||
#include <QtGui/private/qguiapplication_p.h>
|
||||
@ -346,7 +347,7 @@ bool QFontEngineQPF2::stringToCMap(const QChar *str, int len, QGlyphLayout *glyp
|
||||
}
|
||||
|
||||
#if defined(DEBUG_FONTENGINE)
|
||||
QSet<QChar> seenGlyphs;
|
||||
QDuplicateTracker<QChar> seenGlyphs;
|
||||
#endif
|
||||
|
||||
int glyph_pos = 0;
|
||||
@ -366,10 +367,8 @@ bool QFontEngineQPF2::stringToCMap(const QChar *str, int len, QGlyphLayout *glyp
|
||||
glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc);
|
||||
#if 0 && defined(DEBUG_FONTENGINE)
|
||||
QChar c(uc);
|
||||
if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.contains(c))
|
||||
if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.hasSeen(c))
|
||||
qDebug() << "glyph for character" << c << '/' << Qt::hex << uc << "is" << Qt::dec << glyphs[glyph_pos].glyph;
|
||||
|
||||
seenGlyphs.insert(c);
|
||||
#endif
|
||||
++glyph_pos;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
// for normalizeTypeInternal
|
||||
#include <private/qmetaobject_moc_p.h>
|
||||
#include <private/qduplicatetracker_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -1868,14 +1869,13 @@ void Moc::checkProperties(ClassDef *cdef)
|
||||
// specify get function, for compatibiliy we accept functions
|
||||
// returning pointers, or const char * for QByteArray.
|
||||
//
|
||||
QSet<QByteArray> definedProperties;
|
||||
QDuplicateTracker<QByteArray> definedProperties;
|
||||
for (int i = 0; i < cdef->propertyList.count(); ++i) {
|
||||
PropertyDef &p = cdef->propertyList[i];
|
||||
if (definedProperties.contains(p.name)) {
|
||||
if (definedProperties.hasSeen(p.name)) {
|
||||
QByteArray msg = "The property '" + p.name + "' is defined multiple times in class " + cdef->classname + ".";
|
||||
warning(msg.constData());
|
||||
}
|
||||
definedProperties.insert(p.name);
|
||||
|
||||
if (p.read.isEmpty() && p.member.isEmpty()) {
|
||||
if (!cdef->qPropertyMembers.contains(p.name) && !p.isQProperty) {
|
||||
|
Loading…
Reference in New Issue
Block a user