FlightGear next
LanguageInfo.hxx
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Florent Rougon
2// SPDX-License-Identifier: GPL-2.0-or-later
3
8
9#pragma once
10
11#include <functional>
12#include <map>
13#include <string>
14#include <type_traits>
15
16namespace flightgear
17{
18
36
38{
39public:
40 using intType = long long;
41
43 static std::size_t getNumberOfPluralForms(const std::string& languageId);
45 static std::size_t getPluralFormIndex(const std::string& languageId,
46 intType number);
47
48private:
49 // Important: std::abs(i) is not UB and fits in an uintType as long as i
50 // has type intType.
51 using uintType = std::make_unsigned_t<intType>;
52
53 static const std::map<std::string, std::size_t> nbPluralFormsMap;
54
55 using funcType = std::function<std::size_t(uintType)>;
60 static const std::map<std::string, funcType> pluralFormIndexFuncMap;
61
62 static std::size_t pluralFormIndex_EngineeringEnglishStyle(uintType n);
63 static std::size_t pluralFormIndex_EnglishStyle(uintType n);
64 static std::size_t pluralFormIndex_FrenchStyle(uintType n);
65 static std::size_t pluralFormIndex_PolishStyle(uintType n);
66 static std::size_t pluralFormIndex_RussianStyle(uintType n);
67};
68
69}
Class providing information on plural forms.
static std::size_t getPluralFormIndex(const std::string &languageId, intType number)
Return the index of the plural form to use for a number of “items”
static std::size_t getNumberOfPluralForms(const std::string &languageId)
Return the number of plural forms in the specified language.
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53