X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Ftypes.h;h=fc46881e1ccf11c08234ca6851453c27c8f54cb8;hp=381c5d6b942a600aa0a73f4c55a5ddb05bd8a812;hb=f19fea582ace1d8f3dfe29c1096c48758079e56e;hpb=78fe605abd76277f479cad74df2b1302cdd05db6 diff --git a/src/common/types.h b/src/common/types.h index 381c5d6b..fc46881e 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -24,6 +24,7 @@ #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,16 @@ 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) + +// a few typedefs +typedef QList MsgIdList; +typedef QList BufferIdList; //! Base class for exceptions. struct Exception { @@ -100,7 +107,6 @@ struct Exception { protected: QString _msg; - }; #endif