This branch introduces a new sync method which should use less bandwidth and might...
[quassel.git] / src / common / types.h
index 64bfbbc..0154247 100644 (file)
@@ -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 <QDebug>
 #include <QString>
@@ -32,10 +32,14 @@ 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>=(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 +82,16 @@ struct IdentityId : public SignedId {
   //inline operator QVariant() const { return QVariant::fromValue<IdentityId>(*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 {