NerixyzandGitHub e07c250ba3 feat: Add strong view aliases (#7194)
We have some strong aliases/typedefs like `UserId`, `UserName`,
`EmoteName`, etc. Currently, they wrap a `QString`. In some cases, we
don't want to use owned types. Notably, when looking up items in a map.
There, it would be fine to look them up by `QStringView`. However,
`QStringView` isn't "tagged" to contain a user ID, username, etc.

This PR adds `-View` types as "tagged" versions of `QStringView`. So now
`EmoteName` has a corresponding `EmoteNameView`. The view can be created
from the owned type, and they can be compared to each other.

The containers don't know about this relationship - for example,
`std::unordered_map<EmoteName, V>` doesn't know that you can do lookup
by `EmoteNameView`. To tell them, we need to provide both a transparent
hasher (i.e. a hasher working for both types) and a transparent
comparator. For the hasher, there's `EmoteNameHash` which forwards to
the `QStringView` hash. For the comparison,
[`std::equal_to<>`](https://en.cppreference.com/cpp/utility/functional/equal_to_void)
can be used. See the tests for examples.

Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
2026-08-23 12:17:32 +00:00
2026-08-23 12:17:32 +00:00
2026-04-07 18:21:07 +00:00
2026-03-22 12:50:28 +01:00
2026-01-02 14:56:29 +00:00
2017-10-13 21:57:43 +02:00

chatterinoLogo Chatterino 2 GitHub Actions Build (Windows, Ubuntu, MacOS) Build FreeBSD Chocolatey Package Flatpak Package

Chatterino 2 is a chat client for Twitch.tv. The Chatterino 2 wiki can be found here. Contribution guidelines can be found here.

Download

Current releases are available at https://chatterino.com. Windows users can also install Chatterino from Chocolatey.

Nightly build

You can download the latest Chatterino 2 build over here

You might also need to install the VC++ Redistributables from Microsoft if you do not have it installed already.
If you still receive an error about MSVCR120.dll missing, then you should install the VC++ 2013 Restributable.

Building

To get source code with required submodules run:

git clone --recurse-submodules https://github.com/Chatterino/chatterino2.git

or

git clone https://github.com/Chatterino/chatterino2.git
cd chatterino2
git submodule update --init --recursive

Git blame

This project has big commits in the history which touch most files while only doing stylistic changes. To improve the output of git-blame, consider setting:

git config blame.ignoreRevsFile .git-blame-ignore-revs

This will ignore all revisions mentioned in the .git-blame-ignore-revs file. GitHub does this by default.

Code style

The code is formatted using clang-format. Our configuration is found in the .clang-format file in the repository root directory.

For more contribution guidelines, take a look at the wiki.

Doxygen

Doxygen is used to generate project information daily and is available here.

Languages
C++ 95%
CMake 2.5%
Python 1.2%
Lua 0.7%
Shell 0.3%
Other 0.2%