2020-02-21 00:45:53 +07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
using LanguageId = QString;
|
|
|
|
|
|
|
|
class LanguageCodes
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct Bundle {
|
|
|
|
LanguageId id;
|
|
|
|
QString iso639_1;
|
|
|
|
QString tesseract;
|
2020-03-18 02:15:28 +07:00
|
|
|
const char* name;
|
2020-02-21 00:45:53 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
std::optional<Bundle> findById(const LanguageId& id) const;
|
|
|
|
std::optional<Bundle> findByName(const QString& name) const;
|
|
|
|
std::optional<Bundle> findByTesseract(const QString& name) const;
|
|
|
|
const std::unordered_map<LanguageId, Bundle>& all() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const static std::unordered_map<LanguageId, Bundle> codes_;
|
|
|
|
};
|