Coverage Report

Created: 2026-05-16 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/crow/include/crow/ci_map.h
Line
Count
Source
1
#pragma once
2
3
#include <string_view>
4
#include <locale>
5
#include <unordered_map>
6
7
#include "crow/utility.h"
8
9
namespace crow
10
{
11
    /// Hashing function for ci_map (unordered_multimap).
12
    struct ci_hash
13
    {
14
        size_t operator()(const std::string_view key) const
15
0
        {
16
0
            std::size_t seed = 0;
17
0
            std::locale locale;
18
19
0
            for (auto c : key)
20
0
                hash_combine(seed, std::toupper(c, locale));
21
22
0
            return seed;
23
0
        }
24
25
    private:
26
        static inline void hash_combine(std::size_t& seed, char v)
27
0
        {
28
0
            std::hash<char> hasher;
29
0
            seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
30
0
        }
31
    };
32
33
    /// Equals function for ci_map (unordered_multimap).
34
    struct ci_key_eq
35
    {
36
        bool operator()(const std::string_view l, const std::string_view r) const
37
0
        {
38
0
            return utility::string_equals(l, r);
39
0
        }
40
    };
41
42
    using ci_map = std::unordered_multimap<std::string, std::string, ci_hash, ci_key_eq>;
43
} // namespace crow