summaryrefslogtreecommitdiff
path: root/src/mbgl/util/font_stack.cpp
blob: 362fdf1845bf9d7e688bf02ce817cb084da9fb3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <mbgl/util/font_stack.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <mbgl/util/hash.hpp>

#include <boost/algorithm/string/join.hpp>

namespace mbgl {

using namespace style;

std::string fontStackToString(const FontStack& fontStack) {
    return boost::algorithm::join(fontStack, ",");
}

FontStackHash FontStackHasher::operator()(const FontStack& fontStack) const {
    std::size_t seed = 0;
    for (const auto& font : fontStack) {
        util::hash_combine(seed, font);
    }
    return seed;
}

std::set<FontStack> fontStacks(const std::vector<Immutable<style::Layer::Impl>>& layers) {
    std::set<FontStack> result;
    for (const auto& layer : layers) {
        layer->populateFontStack(result);
    }

    return result;
}

} // namespace mbgl