modernize: Use 'using' instead of 'typedef'
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 6 Sep 2018 17:47:17 +0000 (19:47 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 18 Nov 2018 10:06:43 +0000 (11:06 +0100)
15 files changed:
src/common/aliasmanager.h
src/common/bufferviewmanager.h
src/common/eventmanager.h
src/common/ignorelistmanager.h
src/common/message.h
src/common/network.h
src/common/peer.h
src/common/peerfactory.h
src/common/signalproxy.h
src/common/types.h
src/qtui/chatlinemodel.h
src/qtui/chatlinemodelitem.cpp
src/qtui/chatlinemodelitem.h
src/qtui/statusnotifieritemdbus.h
src/uisupport/qssparser.h

index ef3b512..fd3f5d6 100644 (file)
@@ -43,7 +43,7 @@ public:
         QString expansion;
         Alias(const QString &name_, const QString &expansion_) : name(name_), expansion(expansion_) {}
     };
-    typedef QList<Alias> AliasList;
+    using AliasList = QList<Alias>;
 
     int indexOf(const QString &name) const;
     inline bool contains(const QString &name) const { return indexOf(name) != -1; }
@@ -56,7 +56,7 @@ public:
 
     static AliasList defaults();
 
-    typedef QList<QPair<BufferInfo, QString> > CommandList;
+    using CommandList = QList<QPair<BufferInfo, QString>>;
 
     CommandList processInput(const BufferInfo &info, const QString &message);
 
index 3c63396..c066d77 100644 (file)
@@ -62,7 +62,7 @@ signals:
 //   void deleteBufferViewsRequested(const QVariantList &bufferViews);
 
 protected:
-    typedef QHash<int, BufferViewConfig *> BufferViewConfigHash;
+    using  BufferViewConfigHash = QHash<int, BufferViewConfig *>;
     inline const BufferViewConfigHash &bufferViewConfigHash() { return _bufferViewConfigs; }
     virtual BufferViewConfig *bufferViewConfigFactory(int bufferViewConfigId);
 
index 6eab19d..0a72a70 100644 (file)
@@ -168,7 +168,7 @@ private:
         }
     };
 
-    typedef QHash<uint, QList<Handler> > HandlerHash;
+    using HandlerHash = QHash<uint, QList<Handler>>;
 
     inline const HandlerHash &registeredHandlers() const { return _registeredHandlers; }
     inline HandlerHash &registeredHandlers() { return _registeredHandlers; }
index a4fa3c3..1bec1c8 100644 (file)
@@ -333,7 +333,7 @@ public:
         mutable ExpressionMatch _ctcpSenderMatch = {};    ///< Expression match cache for CTCP nick
     };
 
-    typedef QList<IgnoreListItem> IgnoreList;
+    using IgnoreList = QList<IgnoreListItem>;
 
     int indexOf(const QString &ignore) const;
     inline bool contains(const QString &ignore) const { return indexOf(ignore) != -1; }
index 1088b09..fa9e6b0 100644 (file)
@@ -112,7 +112,7 @@ private:
 };
 
 
-typedef QList<Message> MessageList;
+using MessageList = QList<Message>;
 
 QDataStream &operator<<(QDataStream &out, const Message &msg);
 QDataStream &operator>>(QDataStream &in, Message &msg);
index e237ef3..4fe30f1 100644 (file)
@@ -143,7 +143,7 @@ public :
         bool operator==(const Server &other) const;
         bool operator!=(const Server &other) const;
     };
-    typedef QList<Server> ServerList;
+    using ServerList = QList<Server>;
 
     Network(const NetworkId &networkid, QObject *parent = nullptr);
     ~Network() override;
index 62e7cc4..803f15b 100644 (file)
@@ -114,7 +114,7 @@ private:
 };
 
 // We need to special-case Peer* in attached signals/slots, so typedef it for the meta type system
-typedef Peer * PeerPtr;
+using PeerPtr = Peer *;
 Q_DECLARE_METATYPE(PeerPtr)
 
 QDataStream &operator<<(QDataStream &out, PeerPtr ptr);
index ec7426e..ca6639a 100644 (file)
@@ -38,8 +38,8 @@ class COMMON_EXPORT PeerFactory
 
 public:
     // second value is the protocol-specific features
-    typedef QPair<Protocol::Type, quint16> ProtoDescriptor;
-    typedef QVector<ProtoDescriptor> ProtoList;
+    using ProtoDescriptor = QPair<Protocol::Type, quint16>;
+    using ProtoList = QVector<ProtoDescriptor>;
 
     static ProtoList supportedProtocols();
 
index 935df5e..e6f594d 100644 (file)
@@ -195,12 +195,12 @@ private:
     SignalRelay *_signalRelay;
 
     // RPC function -> (object, slot ID)
-    typedef QPair<QObject *, int> MethodId;
-    typedef QMultiHash<QByteArray, MethodId> SlotHash;
+    using MethodId = QPair<QObject *, int>;
+    using SlotHash = QMultiHash<QByteArray, MethodId>;
     SlotHash _attachedSlots;
 
     // slaves for sync
-    typedef QHash<QString, SyncableObject *> ObjectId;
+    using ObjectId = QHash<QString, SyncableObject *>;
     QHash<QByteArray, ObjectId> _syncSlave;
 
     ProxyMode _proxyMode;
index 72cee26..fb85012 100644 (file)
@@ -137,8 +137,8 @@ Q_DECLARE_METATYPE(AccountId)
 Q_DECLARE_METATYPE(QHostAddress)
 
 // a few typedefs
-typedef QList<MsgId> MsgIdList;
-typedef QList<BufferId> BufferIdList;
+using MsgIdList = QList<MsgId>;
+using BufferIdList = QList<BufferId>;
 
 /**
  * Catch-all stream serialization operator for enum types.
index 84d77e9..e2fb2df 100644 (file)
@@ -39,8 +39,8 @@ public:
 
     ChatLineModel(QObject *parent = nullptr);
 
-    typedef ChatLineModelItem::Word Word;
-    typedef ChatLineModelItem::WrapList WrapList;
+    using Word = ChatLineModelItem::Word;
+    using WrapList = ChatLineModelItem::WrapList;
     inline const MessageModelItem *messageItemAt(int i) const override { return &_messageList[i]; }
 protected:
 //   virtual MessageModelItem *createMessageModelItem(const Message &);
index fa0a103..0524d08 100644 (file)
 
 // This Struct is taken from Harfbuzz. We use it only to calc it's size.
 // we use a shared memory region so we do not have to malloc a buffer area for every line
-typedef struct {
+using HB_CharAttributes_Dummy = struct {
     /*HB_LineBreakType*/ unsigned lineBreakType  : 2;
     /*HB_Bool*/ unsigned whiteSpace              : 1;     /* A unicode whitespace character, except NBSP, ZWNBSP */
     /*HB_Bool*/ unsigned charStop                : 1;     /* Valid cursor position (for left/right arrow) */
     /*HB_Bool*/ unsigned wordBoundary            : 1;
     /*HB_Bool*/ unsigned sentenceBoundary        : 1;
     unsigned unused                  : 2;
-} HB_CharAttributes_Dummy;
+};
 
 unsigned char *ChatLineModelItem::TextBoundaryFinderBuffer = (unsigned char *)malloc(512 * sizeof(HB_CharAttributes_Dummy));
 int ChatLineModelItem::TextBoundaryFinderBufferSize = 512 * (sizeof(HB_CharAttributes_Dummy) / sizeof(unsigned char));
index 5713d0d..00d2f3e 100644 (file)
@@ -49,7 +49,7 @@ public:
         qreal width;
         qreal trailing;
     };
-    typedef QVector<Word> WrapList;
+    using WrapList = QVector<Word>;
 
 private:
     QVariant timestampData(int role) const;
index 20a76f9..719c825 100644 (file)
@@ -35,7 +35,7 @@ struct DBusImageStruct {
     QByteArray data;
 };
 
-typedef QVector<DBusImageStruct> DBusImageVector;
+using DBusImageVector = QVector<DBusImageStruct>;
 
 struct DBusToolTipStruct {
     QString icon;
index 4b2ee13..8cb1db4 100644 (file)
@@ -39,7 +39,7 @@ public:
     inline const QHash<UiStyle::ItemFormatType, QTextCharFormat> &listItemFormats() const { return _listItemFormats; }
 
 protected:
-    typedef QList<qreal> ColorTuple;
+    using ColorTuple = QList<qreal>;
 
     void parseChatLineBlock(const QString &decl, const QString &contents);
     void parsePaletteBlock(const QString &decl, const QString &contents);