modernize: Prefer default member init over ctor init
[quassel.git] / src / common / types.h
index d7b4404..fb85012 100644 (file)
@@ -137,8 +137,8 @@ Q_DECLARE_METATYPE(AccountId)
 Q_DECLARE_METATYPE(QHostAddress)
 
 // a few typedefs
-typedef QList<MsgId> MsgIdList;
-typedef QList<BufferId> BufferIdList;
+using MsgIdList = QList<MsgId>;
+using BufferIdList = QList<BufferId>;
 
 /**
  * Catch-all stream serialization operator for enum types.
@@ -169,3 +169,17 @@ QDataStream &operator>>(QDataStream &in, T &value) {
     value = static_cast<T>(v);
     return in;
 }
+
+// Exceptions
+
+/**
+ * Thrown during initialization to enforce exiting the application before the event loop is started
+ */
+struct ExitException
+{
+    int exitCode;
+    QString errorString;
+
+    ExitException(int code = EXIT_FAILURE, QString error = {})
+        : exitCode(code), errorString(std::move(error)) {}
+};