From: Manuel Nickschas Date: Thu, 6 Sep 2018 17:47:17 +0000 (+0200) Subject: modernize: Use 'using' instead of 'typedef' X-Git-Tag: test-travis-01~143 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=80950b87640acfb2a75902f8aabf3419da094bf4 modernize: Use 'using' instead of 'typedef' --- diff --git a/src/common/aliasmanager.h b/src/common/aliasmanager.h index ef3b512b..fd3f5d66 100644 --- a/src/common/aliasmanager.h +++ b/src/common/aliasmanager.h @@ -43,7 +43,7 @@ public: QString expansion; Alias(const QString &name_, const QString &expansion_) : name(name_), expansion(expansion_) {} }; - typedef QList AliasList; + using AliasList = QList; 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 > CommandList; + using CommandList = QList>; CommandList processInput(const BufferInfo &info, const QString &message); diff --git a/src/common/bufferviewmanager.h b/src/common/bufferviewmanager.h index 3c633960..c066d77d 100644 --- a/src/common/bufferviewmanager.h +++ b/src/common/bufferviewmanager.h @@ -62,7 +62,7 @@ signals: // void deleteBufferViewsRequested(const QVariantList &bufferViews); protected: - typedef QHash BufferViewConfigHash; + using BufferViewConfigHash = QHash; inline const BufferViewConfigHash &bufferViewConfigHash() { return _bufferViewConfigs; } virtual BufferViewConfig *bufferViewConfigFactory(int bufferViewConfigId); diff --git a/src/common/eventmanager.h b/src/common/eventmanager.h index 6eab19de..0a72a70a 100644 --- a/src/common/eventmanager.h +++ b/src/common/eventmanager.h @@ -168,7 +168,7 @@ private: } }; - typedef QHash > HandlerHash; + using HandlerHash = QHash>; inline const HandlerHash ®isteredHandlers() const { return _registeredHandlers; } inline HandlerHash ®isteredHandlers() { return _registeredHandlers; } diff --git a/src/common/ignorelistmanager.h b/src/common/ignorelistmanager.h index a4fa3c38..1bec1c84 100644 --- a/src/common/ignorelistmanager.h +++ b/src/common/ignorelistmanager.h @@ -333,7 +333,7 @@ public: mutable ExpressionMatch _ctcpSenderMatch = {}; ///< Expression match cache for CTCP nick }; - typedef QList IgnoreList; + using IgnoreList = QList; int indexOf(const QString &ignore) const; inline bool contains(const QString &ignore) const { return indexOf(ignore) != -1; } diff --git a/src/common/message.h b/src/common/message.h index 1088b09d..fa9e6b04 100644 --- a/src/common/message.h +++ b/src/common/message.h @@ -112,7 +112,7 @@ private: }; -typedef QList MessageList; +using MessageList = QList; QDataStream &operator<<(QDataStream &out, const Message &msg); QDataStream &operator>>(QDataStream &in, Message &msg); diff --git a/src/common/network.h b/src/common/network.h index e237ef3d..4fe30f1c 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -143,7 +143,7 @@ public : bool operator==(const Server &other) const; bool operator!=(const Server &other) const; }; - typedef QList ServerList; + using ServerList = QList; Network(const NetworkId &networkid, QObject *parent = nullptr); ~Network() override; diff --git a/src/common/peer.h b/src/common/peer.h index 62e7cc41..803f15b5 100644 --- a/src/common/peer.h +++ b/src/common/peer.h @@ -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); diff --git a/src/common/peerfactory.h b/src/common/peerfactory.h index ec7426e7..ca6639aa 100644 --- a/src/common/peerfactory.h +++ b/src/common/peerfactory.h @@ -38,8 +38,8 @@ class COMMON_EXPORT PeerFactory public: // second value is the protocol-specific features - typedef QPair ProtoDescriptor; - typedef QVector ProtoList; + using ProtoDescriptor = QPair; + using ProtoList = QVector; static ProtoList supportedProtocols(); diff --git a/src/common/signalproxy.h b/src/common/signalproxy.h index 935df5e9..e6f594d8 100644 --- a/src/common/signalproxy.h +++ b/src/common/signalproxy.h @@ -195,12 +195,12 @@ private: SignalRelay *_signalRelay; // RPC function -> (object, slot ID) - typedef QPair MethodId; - typedef QMultiHash SlotHash; + using MethodId = QPair; + using SlotHash = QMultiHash; SlotHash _attachedSlots; // slaves for sync - typedef QHash ObjectId; + using ObjectId = QHash; QHash _syncSlave; ProxyMode _proxyMode; diff --git a/src/common/types.h b/src/common/types.h index 72cee266..fb85012d 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -137,8 +137,8 @@ Q_DECLARE_METATYPE(AccountId) Q_DECLARE_METATYPE(QHostAddress) // a few typedefs -typedef QList MsgIdList; -typedef QList BufferIdList; +using MsgIdList = QList; +using BufferIdList = QList; /** * Catch-all stream serialization operator for enum types. diff --git a/src/qtui/chatlinemodel.h b/src/qtui/chatlinemodel.h index 84d77e9a..e2fb2dfe 100644 --- a/src/qtui/chatlinemodel.h +++ b/src/qtui/chatlinemodel.h @@ -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 &); diff --git a/src/qtui/chatlinemodelitem.cpp b/src/qtui/chatlinemodelitem.cpp index fa0a103a..0524d087 100644 --- a/src/qtui/chatlinemodelitem.cpp +++ b/src/qtui/chatlinemodelitem.cpp @@ -28,14 +28,14 @@ // 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)); diff --git a/src/qtui/chatlinemodelitem.h b/src/qtui/chatlinemodelitem.h index 5713d0db..00d2f3ec 100644 --- a/src/qtui/chatlinemodelitem.h +++ b/src/qtui/chatlinemodelitem.h @@ -49,7 +49,7 @@ public: qreal width; qreal trailing; }; - typedef QVector WrapList; + using WrapList = QVector; private: QVariant timestampData(int role) const; diff --git a/src/qtui/statusnotifieritemdbus.h b/src/qtui/statusnotifieritemdbus.h index 20a76f97..719c8259 100644 --- a/src/qtui/statusnotifieritemdbus.h +++ b/src/qtui/statusnotifieritemdbus.h @@ -35,7 +35,7 @@ struct DBusImageStruct { QByteArray data; }; -typedef QVector DBusImageVector; +using DBusImageVector = QVector; struct DBusToolTipStruct { QString icon; diff --git a/src/uisupport/qssparser.h b/src/uisupport/qssparser.h index 4b2ee137..8cb1db46 100644 --- a/src/uisupport/qssparser.h +++ b/src/uisupport/qssparser.h @@ -39,7 +39,7 @@ public: inline const QHash &listItemFormats() const { return _listItemFormats; } protected: - typedef QList ColorTuple; + using ColorTuple = QList; void parseChatLineBlock(const QString &decl, const QString &contents); void parsePaletteBlock(const QString &decl, const QString &contents);