summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-04 16:02:27 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-04 16:02:27 +0200
commit0e128824e54a4994682023b7fd0fbb4c1938892c (patch)
treed5e19e3e7e89963f90ace2d8ea79907f00bb5540
parent5870a1e742b587ee8ee179037e70dd0ced82e6c7 (diff)
Fix some clang warnings about using typedef
Replace by using (except for function pointers). Where possible, use auto for iterators and remove the typedefs. Change-Id: I41a74ea304cf9f0f82a0089184af5e82e5982967 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/activeqt/container/qaxbase.cpp26
-rw-r--r--src/activeqt/container/qaxbase.h2
-rw-r--r--src/activeqt/container/qaxwidget.cpp2
-rw-r--r--src/activeqt/control/qaxserverbase.cpp6
-rw-r--r--src/activeqt/shared/qaxutils_p.h2
5 files changed, 15 insertions, 23 deletions
diff --git a/src/activeqt/container/qaxbase.cpp b/src/activeqt/container/qaxbase.cpp
index f601648..526a272 100644
--- a/src/activeqt/container/qaxbase.cpp
+++ b/src/activeqt/container/qaxbase.cpp
@@ -589,7 +589,7 @@ class QAxBasePrivate
{
Q_DISABLE_COPY(QAxBasePrivate)
public:
- typedef QHash<QUuid, QAxEventSink*> UuidEventSinkHash;
+ using UuidEventSinkHash = QHash<QUuid, QAxEventSink*>;
QAxBasePrivate()
: useEventSink(true), useMetaObject(true), useClassInfo(true),
@@ -1562,9 +1562,8 @@ public:
}
private:
- typedef QPair<QByteArray, int> ByteArrayIntPair;
- typedef QList<ByteArrayIntPair> ByteArrayIntPairList;
- typedef QMap<QByteArray, ByteArrayIntPairList>::ConstIterator EnumListMapConstIterator;
+ using ByteArrayIntPair = QPair<QByteArray, int>;
+ using ByteArrayIntPairList = QList<ByteArrayIntPair>;
void init();
@@ -3049,8 +3048,7 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co
int_data_size += (signal_list.count() + slot_list.count()) * 5 + paramsDataSize;
int_data_size += property_list.count() * 3;
int_data_size += enum_list.count() * 5;
- const EnumListMapConstIterator ecend = enum_list.end();
- for (EnumListMapConstIterator it = enum_list.begin(); it != ecend; ++it)
+ for (auto it = enum_list.cbegin(), end = enum_list.cend(); it != end; ++it)
int_data_size += it.value().count() * 2;
++int_data_size; // eod
@@ -3128,9 +3126,7 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co
Q_ASSERT(offset == header->propertyData);
// each property in form name\0type\0
- typedef QMap<QByteArray, Property>::ConstIterator PropertyMapConstIterator;
- const PropertyMapConstIterator pcend = property_list.end();
- for (PropertyMapConstIterator it = property_list.begin(); it != pcend; ++it) {
+ for (auto it = property_list.cbegin(), end = property_list.cend(); it != end; ++it) {
QByteArray name(it.key());
QByteArray type(it.value().type);
Q_ASSERT(!type.isEmpty());
@@ -3145,7 +3141,7 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co
int value_offset = offset + enum_list.count() * 5;
// each enum in form name\0
- for (EnumListMapConstIterator it = enum_list.begin(); it != ecend; ++it) {
+ for (auto it = enum_list.cbegin(), end = enum_list.cend(); it != end; ++it) {
QByteArray name(it.key());
int count = it.value().count();
@@ -3160,12 +3156,10 @@ QMetaObject *MetaObjectGenerator::metaObject(const QMetaObject *parentObject, co
Q_ASSERT(offset == header->enumeratorData + enum_list.count() * 5);
// each enum value in form key\0
- for (EnumListMapConstIterator it = enum_list.begin(); it != ecend; ++it) {
- const ByteArrayIntPairList::ConstIterator vcend = it.value().end();
- for (ByteArrayIntPairList::ConstIterator it2 = it.value().begin(); it2 != vcend; ++it2) {
- QByteArray key((*it2).first);
- int_data[offset++] = uint(strings.enter(key));
- int_data[offset++] = uint((*it2).second);
+ for (auto it = enum_list.cbegin(), end = enum_list.cend(); it != end; ++it) {
+ for (const auto &e : it.value()) {
+ int_data[offset++] = uint(strings.enter(e.first));
+ int_data[offset++] = uint(e.second);
}
}
Q_ASSERT(offset == int_data_size-1);
diff --git a/src/activeqt/container/qaxbase.h b/src/activeqt/container/qaxbase.h
index 740fd6d..38dec7e 100644
--- a/src/activeqt/container/qaxbase.h
+++ b/src/activeqt/container/qaxbase.h
@@ -72,7 +72,7 @@ class QAxBase
QDOC_PROPERTY(QString control READ control WRITE setControl)
public:
- typedef QMap<QString, QVariant> PropertyBag;
+ using PropertyBag = QMap<QString, QVariant>;
explicit QAxBase(IUnknown *iface = nullptr);
virtual ~QAxBase();
diff --git a/src/activeqt/container/qaxwidget.cpp b/src/activeqt/container/qaxwidget.cpp
index 4a22094..7e5a91b 100644
--- a/src/activeqt/container/qaxwidget.cpp
+++ b/src/activeqt/container/qaxwidget.cpp
@@ -405,7 +405,7 @@ private:
QMenu *subMenu;
int id;
};
- typedef QMap<QAction*, OleMenuItem> MenuItemMap;
+ using MenuItemMap = QMap<QAction*, OleMenuItem>;
QMenu *generatePopup(HMENU subMenu, QWidget *parent);
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index 9e873c5..ab73bb5 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -167,8 +167,7 @@ class QAxServerBase :
public IDataObject
{
public:
- typedef QMap<QUuid,IConnectionPoint*> ConnectionPoints;
- typedef QMap<QUuid,IConnectionPoint*>::Iterator ConnectionPointsIterator;
+ using ConnectionPoints = QMap<QUuid,IConnectionPoint*>;
QAxServerBase(const QString &classname, IUnknown *outerUnknown);
QAxServerBase(QObject *o);
@@ -643,8 +642,7 @@ public:
QAxConnection(QAxConnection &&) = delete;
QAxConnection &operator=(QAxConnection &&) = delete;
- typedef QList<CONNECTDATA> Connections;
- typedef QList<CONNECTDATA>::Iterator Iterator;
+ using Connections = QList<CONNECTDATA>;
QAxConnection(QAxServerBase *parent, const QUuid &uuid)
: that(parent), iid(uuid)
diff --git a/src/activeqt/shared/qaxutils_p.h b/src/activeqt/shared/qaxutils_p.h
index 8c86980..f56644b 100644
--- a/src/activeqt/shared/qaxutils_p.h
+++ b/src/activeqt/shared/qaxutils_p.h
@@ -78,7 +78,7 @@ class QWindow;
HWND hwndForWidget(QWidget *widget);
HRGN qaxHrgnFromQRegion(const QRegion &region, const QWindow *window);
-typedef QPair<qreal, qreal> QDpi;
+using QDpi = QPair<qreal, qreal>;
extern SIZEL qaxMapPixToLogHiMetrics(const QSize &s, const QDpi &d, const QWindow *w);
extern QSize qaxMapLogHiMetricsToPix(const SIZEL &s, const QDpi &d, const QWindow *w);