Chatterino
Aliases.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QHash>
4 #include <QString>
5 #include <functional>
6 
7 #define QStringAlias(name) \
8  namespace chatterino { \
9  struct name { \
10  QString string; \
11  bool operator==(const name &other) const \
12  { \
13  return this->string == other.string; \
14  } \
15  bool operator!=(const name &other) const \
16  { \
17  return this->string != other.string; \
18  } \
19  }; \
20  } /* namespace chatterino */ \
21  namespace std { \
22  template <> \
23  struct hash<chatterino::name> { \
24  size_t operator()(const chatterino::name &s) const \
25  { \
26  return qHash(s.string); \
27  } \
28  }; \
29  } /* namespace std */
30 
31 QStringAlias(UserName);
32 QStringAlias(UserId);
33 QStringAlias(Url);
34 QStringAlias(Tooltip);
35 QStringAlias(EmoteId);
36 QStringAlias(EmoteName);
37 QStringAlias(EmoteAuthor);
#define QStringAlias(name)
Definition: Aliases.hpp:7