X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fbufferinfo.cpp;h=f9c01c049c113d46815afe685d236ad70e366209;hp=1d0496d2292174e9e6502d58431db7896a3a7511;hb=c0d6dc0dec628f2e143e37ecc95cec45e636f8a5;hpb=68878dc8366f2f4a0afe132847aad9a51a80cdbf diff --git a/src/common/bufferinfo.cpp b/src/common/bufferinfo.cpp index 1d0496d2..f9c01c04 100644 --- a/src/common/bufferinfo.cpp +++ b/src/common/bufferinfo.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,41 +18,36 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include +#include "bufferinfo.h" + +#include + +#include #include #include -#include - -#include "bufferinfo.h" +#include #include "util.h" BufferInfo::BufferInfo() - : _bufferId(0), - _netid(0), - _type(InvalidBuffer), - _groupId(0), - _bufferName(QString()) -{ -} - - -BufferInfo::BufferInfo(BufferId id, NetworkId networkid, Type type, uint gid, QString buf) - : _bufferId(id), - _netid(networkid), - _type(type), - _groupId(gid), - _bufferName(buf) -{ -} - + : _bufferId(0) + , _netid(0) + , _bufferName(QString()) +{} + +BufferInfo::BufferInfo(BufferId id, NetworkId networkid, Type type, uint gid, QString buf) + : _bufferId(id) + , _netid(networkid) + , _type(type) + , _groupId(gid) + , _bufferName(std::move(buf)) +{} BufferInfo BufferInfo::fakeStatusBuffer(NetworkId networkId) { return BufferInfo(0, networkId, StatusBuffer); } - QString BufferInfo::bufferName() const { if (isChannelName(_bufferName)) @@ -61,30 +56,27 @@ QString BufferInfo::bufferName() const return nickFromMask(_bufferName); // FIXME get rid of global functions and use the Network stuff instead! } - bool BufferInfo::acceptsRegularMessages() const { - if(_type == StatusBuffer || _type == InvalidBuffer) + if (_type == StatusBuffer || _type == InvalidBuffer) return false; return true; } - -QDebug operator<<(QDebug dbg, const BufferInfo &b) +QDebug operator<<(QDebug dbg, const BufferInfo& b) { - dbg.nospace() << "(bufId: " << b.bufferId() << ", netId: " << b.networkId() << ", groupId: " << b.groupId() << ", buf: " << b.bufferName() << ")"; + dbg.nospace() << "(bufId: " << b.bufferId() << ", netId: " << b.networkId() << ", groupId: " << b.groupId() + << ", buf: " << b.bufferName() << ")"; return dbg.space(); } - -QDataStream &operator<<(QDataStream &out, const BufferInfo &bufferInfo) +QDataStream& operator<<(QDataStream& out, const BufferInfo& bufferInfo) { out << bufferInfo._bufferId << bufferInfo._netid << (qint16)bufferInfo._type << bufferInfo._groupId << bufferInfo._bufferName.toUtf8(); return out; } - -QDataStream &operator>>(QDataStream &in, BufferInfo &bufferInfo) +QDataStream& operator>>(QDataStream& in, BufferInfo& bufferInfo) { QByteArray buffername; qint16 bufferType; @@ -94,8 +86,7 @@ QDataStream &operator>>(QDataStream &in, BufferInfo &bufferInfo) return in; } - -uint qHash(const BufferInfo &bufferid) +uint qHash(const BufferInfo& bufferid) { return qHash(bufferid._bufferId); }