Differential D3185 Diff 14436 source/third_party/tinygettext/include/tinygettext/dictionary_manager.hpp
Changeset View
Changeset View
Standalone View
Standalone View
source/third_party/tinygettext/include/tinygettext/dictionary_manager.hpp
Show All 14 Lines | |||||
// appreciated but is not required. | // appreciated but is not required. | ||||
// 2. Altered source versions must be plainly marked as such, and must not be | // 2. Altered source versions must be plainly marked as such, and must not be | ||||
// misrepresented as being the original software. | // misrepresented as being the original software. | ||||
// 3. This notice may not be removed or altered from any source distribution. | // 3. This notice may not be removed or altered from any source distribution. | ||||
#ifndef HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP | #ifndef HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP | ||||
#define HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP | #define HEADER_TINYGETTEXT_DICTIONARY_MANAGER_HPP | ||||
#include <deque> | |||||
#include <memory> | #include <memory> | ||||
#include <set> | #include <set> | ||||
#include <string> | #include <string> | ||||
#include <unordered_map> | #include <unordered_map> | ||||
#include <vector> | |||||
#include "dictionary.hpp" | #include "dictionary.hpp" | ||||
#include "language.hpp" | #include "language.hpp" | ||||
namespace tinygettext { | namespace tinygettext { | ||||
class FileSystem; | class FileSystem; | ||||
/** Manager class for dictionaries, you give it a bunch of directories | /** Manager class for dictionaries, you give it a bunch of directories | ||||
with .po files and it will then automatically load the right file | with .po files and it will then automatically load the right file | ||||
on demand depending on which language was set. */ | on demand depending on which language was set. */ | ||||
class DictionaryManager | class DictionaryManager | ||||
{ | { | ||||
private: | private: | ||||
typedef std::unordered_map<Language, Dictionary*, Language_hash> Dictionaries; | typedef std::unordered_map<Language, Dictionary*, Language_hash> Dictionaries; | ||||
Dictionaries dictionaries; | Dictionaries dictionaries; | ||||
typedef std::vector<std::string> SearchPath; | typedef std::deque<std::string> SearchPath; | ||||
SearchPath search_path; | SearchPath search_path; | ||||
std::string charset; | std::string charset; | ||||
bool use_fuzzy; | bool use_fuzzy; | ||||
Language current_language; | Language current_language; | ||||
Dictionary* current_dict; | Dictionary* current_dict; | ||||
Show All 22 Lines | public: | ||||
void set_use_fuzzy(bool t); | void set_use_fuzzy(bool t); | ||||
bool get_use_fuzzy() const; | bool get_use_fuzzy() const; | ||||
/** Set a charset that will be set on the returned dictionaries */ | /** Set a charset that will be set on the returned dictionaries */ | ||||
void set_charset(const std::string& charset); | void set_charset(const std::string& charset); | ||||
/** Add a directory to the search path for dictionaries, earlier | /** Add a directory to the search path for dictionaries, earlier | ||||
added directories have higher priority then later added ones */ | added directories have higher priority then later added ones. | ||||
void add_directory(const std::string& pathname); | Set @p precedence to true to invert this for a single addition. */ | ||||
void add_directory(const std::string& pathname, bool precedence = false); | |||||
/** Remove a directory from the search path */ | |||||
void remove_directory(const std::string& pathname); | |||||
/** Return a set of the available languages in their country code */ | /** Return a set of the available languages in their country code */ | ||||
std::set<Language> get_languages(); | std::set<Language> get_languages(); | ||||
void set_filesystem(std::unique_ptr<FileSystem> filesystem); | void set_filesystem(std::unique_ptr<FileSystem> filesystem); | ||||
std::string convertFilename2Language(const std::string &s_in) const; | std::string convertFilename2Language(const std::string &s_in) const; | ||||
private: | private: | ||||
Show All 9 Lines |
Wildfire Games · Phabricator