Loading...
Searching...
No Matches
Hashes.hpp
1#pragma once
2
3// Qt-aware adapters over ossia::hash (rapidhash). Centralises the
4// QString / QByteArray hashing pattern so cache keys across the gfx
5// pipeline produce the same stable values without each call site
6// re-deriving the trick of hashing the raw character buffer.
7//
8// All hashes here delegate to ossia::hash_bytes, which dispatches
9// to the appropriate rapidhash tier (Nano / Micro / full) based on
10// size. Use these — not qHash, not std::hash<QString> — for any
11// in-memory cache key in this plugin.
12
13#include <ossia/detail/hash.hpp>
14
15#include <QByteArray>
16#include <QString>
17
18#include <cstddef>
19#include <cstdint>
20
21namespace score::gfx
22{
23
24inline uint64_t hash_qstring(const QString& s) noexcept
25{
26 return ossia::hash_bytes(
27 s.constData(), (std::size_t)s.size() * sizeof(QChar));
28}
29
30inline uint64_t hash_qbytearray(const QByteArray& b) noexcept
31{
32 return ossia::hash_bytes(b.constData(), (std::size_t)b.size());
33}
34
35} // namespace score::gfx
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11