X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Ftypes.h;h=381c5d6b942a600aa0a73f4c55a5ddb05bd8a812;hp=64bfbbc784860e4993807a1977ac67eea873566c;hb=7a1202a4d6b127521ac1d460aed45ffe9383ebf0;hpb=e733408e4759473bf38831f498f48a0f2f5e6dc7 diff --git a/src/common/types.h b/src/common/types.h index 64bfbbc7..381c5d6b 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -18,8 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _TYPES_H_ -#define _TYPES_H_ +#ifndef TYPES_H_ +#define TYPES_H_ #include #include @@ -32,10 +32,13 @@ class SignedId { public: inline SignedId(int _id = 0) { id = _id; } inline qint32 toInt() const { return id; } + inline bool isValid() const { return id > 0; } 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; } inline bool operator!=(int i) const { return id != i; } inline bool operator<(int i) const { return id < i; } @@ -78,11 +81,16 @@ struct IdentityId : public SignedId { //inline operator QVariant() const { return QVariant::fromValue(*this); } }; +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); //! Base class for exceptions. struct Exception {