X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Ftypes.h;h=07088184c40d1796c699794cd393394ca39577ac;hp=e2acbeb316a1e6f92e8b8784292aaf7a52b503bb;hb=ed2415135359b4f8a3f75f2634e028500c08c1fe;hpb=4d159822323116d1a7c7464b2624da7b65035fd6 diff --git a/src/common/types.h b/src/common/types.h index e2acbeb3..07088184 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -18,12 +18,13 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _TYPES_H_ -#define _TYPES_H_ +#ifndef TYPES_H_ +#define TYPES_H_ #include #include #include +#include class SignedId { protected: @@ -37,6 +38,7 @@ class SignedId { inline bool operator==(const SignedId &other) const { return id == other.id; } inline bool operator!=(const SignedId &other) const { return id != other.id; } inline bool operator<(const SignedId &other) const { return id < other.id; } + inline bool operator<=(const SignedId &other) const { return id <= other.id; } inline bool operator>(const SignedId &other) const { return id > other.id; } inline bool operator>=(const SignedId &other) const { return id >= other.id; } inline bool operator==(int i) const { return id == i; } @@ -53,6 +55,7 @@ class SignedId { inline QDataStream &operator<<(QDataStream &out, const SignedId &signedId) { out << signedId.toInt(); return out; } inline QDataStream &operator>>(QDataStream &in, SignedId &signedId) { in >> signedId.id; return in; } +inline QTextStream &operator<<(QTextStream &out, const SignedId &signedId) { out << QString::number(signedId.toInt()); return out; } inline QDebug operator<<(QDebug dbg, const SignedId &signedId) { dbg.space() << signedId.toInt(); return dbg; } inline uint qHash(const SignedId &id) { return qHash(id.toInt()); } @@ -85,12 +88,12 @@ struct AccountId : public SignedId { inline AccountId(int _id = 0) : SignedId(_id) {}; }; -Q_DECLARE_METATYPE(UserId); -Q_DECLARE_METATYPE(MsgId); -Q_DECLARE_METATYPE(BufferId); -Q_DECLARE_METATYPE(NetworkId); -Q_DECLARE_METATYPE(IdentityId); -Q_DECLARE_METATYPE(AccountId); +Q_DECLARE_METATYPE(UserId) +Q_DECLARE_METATYPE(MsgId) +Q_DECLARE_METATYPE(BufferId) +Q_DECLARE_METATYPE(NetworkId) +Q_DECLARE_METATYPE(IdentityId) +Q_DECLARE_METATYPE(AccountId) //! Base class for exceptions. struct Exception {