mirror of
https://github.com/reactos/reactos.git
synced 2025-06-05 01:10:26 +00:00
[RAPPS] CConfigParser cleanup
- removed `static` from strings declaration as pointed out by gadamopoulos svn path=/branches/GSoC_2017/rapps/; revision=75814
This commit is contained in:
parent
a2bf4ef201
commit
9cf1050fce
2 changed files with 15 additions and 36 deletions
|
@ -25,19 +25,16 @@ class CConfigParser
|
||||||
// Locale names cache
|
// Locale names cache
|
||||||
const static INT m_cchLocaleSize = 5;
|
const static INT m_cchLocaleSize = 5;
|
||||||
|
|
||||||
static ATL::CStringW m_szLocaleID;
|
ATL::CStringW m_szLocaleID;
|
||||||
static ATL::CStringW m_szCachedINISectionLocale;
|
ATL::CStringW m_szCachedINISectionLocale;
|
||||||
static ATL::CStringW m_szCachedINISectionLocaleNeutral;
|
ATL::CStringW m_szCachedINISectionLocaleNeutral;
|
||||||
|
|
||||||
const ATL::CStringW szConfigPath;
|
const ATL::CStringW szConfigPath;
|
||||||
|
|
||||||
static ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName);
|
ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName);
|
||||||
static VOID CacheINILocaleLazy();
|
VOID CacheINILocale();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const ATL::CStringW& GetLocale();
|
|
||||||
static INT CConfigParser::GetLocaleSize();
|
|
||||||
|
|
||||||
CConfigParser(const ATL::CStringW& FileName = "");
|
CConfigParser(const ATL::CStringW& FileName = "");
|
||||||
|
|
||||||
UINT GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
|
UINT GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
|
||||||
|
|
|
@ -405,14 +405,10 @@ BOOL GetInstalledVersion(ATL::CStringW *pszVersion, const ATL::CStringW &szRegNa
|
||||||
}
|
}
|
||||||
|
|
||||||
// CConfigParser
|
// CConfigParser
|
||||||
ATL::CStringW CConfigParser::m_szLocaleID;
|
|
||||||
ATL::CStringW CConfigParser::m_szCachedINISectionLocale;
|
|
||||||
ATL::CStringW CConfigParser::m_szCachedINISectionLocaleNeutral;
|
|
||||||
|
|
||||||
CConfigParser::CConfigParser(const ATL::CStringW& FileName) : szConfigPath(GetINIFullPath(FileName))
|
CConfigParser::CConfigParser(const ATL::CStringW& FileName) : szConfigPath(GetINIFullPath(FileName))
|
||||||
{
|
{
|
||||||
// we don't have cached section strings for the current system language, create them, lazy
|
CacheINILocale();
|
||||||
CacheINILocaleLazy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ATL::CStringW CConfigParser::GetINIFullPath(const ATL::CStringW& FileName)
|
ATL::CStringW CConfigParser::GetINIFullPath(const ATL::CStringW& FileName)
|
||||||
|
@ -426,32 +422,18 @@ ATL::CStringW CConfigParser::GetINIFullPath(const ATL::CStringW& FileName)
|
||||||
return szBuffer;
|
return szBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID CConfigParser::CacheINILocaleLazy()
|
VOID CConfigParser::CacheINILocale()
|
||||||
{
|
{
|
||||||
if (m_szLocaleID.IsEmpty())
|
// TODO: Set default locale if call fails
|
||||||
{
|
// find out what is the current system lang code (e.g. "0a") and append it to SectionLocale
|
||||||
// TODO: Set default locale if call fails
|
GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
|
||||||
// find out what is the current system lang code (e.g. "0a") and append it to SectionLocale
|
m_szLocaleID.GetBuffer(m_cchLocaleSize), m_cchLocaleSize);
|
||||||
GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
|
|
||||||
m_szLocaleID.GetBuffer(m_cchLocaleSize), m_cchLocaleSize);
|
|
||||||
|
|
||||||
m_szLocaleID.ReleaseBuffer();
|
m_szLocaleID.ReleaseBuffer();
|
||||||
m_szCachedINISectionLocale = L"Section." + m_szLocaleID;
|
m_szCachedINISectionLocale = L"Section." + m_szLocaleID;
|
||||||
|
|
||||||
// turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part
|
// turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part
|
||||||
m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale + m_szLocaleID.Right(2);
|
m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale + m_szLocaleID.Right(2);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ATL::CStringW& CConfigParser::GetLocale()
|
|
||||||
{
|
|
||||||
CacheINILocaleLazy();
|
|
||||||
return m_szLocaleID;
|
|
||||||
}
|
|
||||||
|
|
||||||
INT CConfigParser::GetLocaleSize()
|
|
||||||
{
|
|
||||||
return m_cchLocaleSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString)
|
UINT CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString)
|
||||||
|
|
Loading…
Reference in a new issue