mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 11:53:47 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
55
drape/utils/glyph_usage_tracker.hpp
Normal file
55
drape/utils/glyph_usage_tracker.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "drape/drape_diagnostics.hpp"
|
||||
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace dp
|
||||
{
|
||||
class GlyphUsageTracker
|
||||
{
|
||||
public:
|
||||
struct UnexpectedGlyphData
|
||||
{
|
||||
size_t m_counter = 0;
|
||||
size_t m_group = 0;
|
||||
std::set<size_t> m_expectedGroups;
|
||||
};
|
||||
using UnexpectedGlyphs = std::map<strings::UniChar, UnexpectedGlyphData>;
|
||||
using InvalidGlyphs = std::map<strings::UniChar, size_t>;
|
||||
|
||||
struct GlyphUsageStatistic
|
||||
{
|
||||
std::string ToString() const;
|
||||
|
||||
InvalidGlyphs m_invalidGlyphs;
|
||||
UnexpectedGlyphs m_unexpectedGlyphs;
|
||||
};
|
||||
|
||||
static GlyphUsageTracker & Instance();
|
||||
|
||||
void AddInvalidGlyph(strings::UniString const & str, strings::UniChar const & c);
|
||||
void AddUnexpectedGlyph(strings::UniString const & str, strings::UniChar const & c,
|
||||
size_t const group, size_t const expectedGroup);
|
||||
|
||||
GlyphUsageStatistic Report();
|
||||
|
||||
private:
|
||||
GlyphUsageTracker() = default;
|
||||
GlyphUsageTracker(GlyphUsageTracker const & rhs) = delete;
|
||||
GlyphUsageTracker(GlyphUsageTracker && rhs) = delete;
|
||||
|
||||
private:
|
||||
GlyphUsageStatistic m_glyphStat;
|
||||
std::unordered_set<std::string> m_processedStrings;
|
||||
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
} // namespace dp
|
||||
Reference in New Issue
Block a user