project64/Source/Project64-core/Multilanguage/LanguageClass.h

67 lines
1.6 KiB
C
Raw Normal View History

2012-12-19 09:30:18 +00:00
#pragma once
#pragma warning(disable:4786)
#include <string> //stl string
#include <map> //stl map
#include <list> //stl list
2015-12-19 23:57:27 +00:00
#include <Common/stdtypes.h>
typedef std::map<int32_t, std::string, std::less<int32_t> > LANG_STRINGS;
typedef LANG_STRINGS::value_type LANG_STR;
struct LanguageFile
{
2015-10-25 10:50:28 +00:00
std::string Filename;
std::string LanguageName;
};
typedef std::list<LanguageFile> LanguageList;
2012-11-19 11:05:30 +00:00
class CLanguage
{
public:
2015-11-14 00:16:03 +00:00
CLanguage();
~CLanguage();
const std::string & GetString(LanguageStringID StringID);
2015-11-14 00:16:03 +00:00
LanguageList & GetLangList(void);
void SetLanguage(const char * LanguageName);
2015-11-14 00:16:03 +00:00
bool LoadCurrentStrings(void);
bool IsCurrentLang(LanguageFile & File);
bool IsLanguageLoaded(void) const { return m_LanguageLoaded; }
private:
2015-10-25 10:50:28 +00:00
CLanguage(const CLanguage&); // Disable copy constructor
CLanguage& operator=(const CLanguage&); // Disable assignment
static void StaticResetStrings(CLanguage * _this)
{
_this->ResetStrings();
}
void ResetStrings(void);
std::string m_SelectedLanguage;
const std::string m_emptyString;
2015-10-25 10:50:28 +00:00
LANG_STRINGS m_CurrentStrings, m_DefaultStrings;
LanguageList m_LanguageList;
std::string GetLangString(const char * FileName, LanguageStringID ID);
2015-11-14 00:16:03 +00:00
LANG_STR GetNextLangString(void * OpenFile);
void LoadDefaultStrings(void);
2015-11-14 00:16:03 +00:00
bool m_LanguageLoaded;
};
extern CLanguage * g_Lang;
inline const char * GS(LanguageStringID StringID)
{
2015-10-25 10:50:28 +00:00
return g_Lang->GetString(StringID).c_str();
}
2016-01-13 11:18:22 +00:00
#ifdef _WIN32
const std::wstring wGS(LanguageStringID StringID);
#endif