/*
- * PROJECT: ReactOS Applications Manager
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: base/applications/rapps/misc.cpp
- * PURPOSE: Misc functions
- * PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
- * Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
- * Alexander Shaposhnikov (chaez.san@gmail.com)
+ * PROJECT: ReactOS Applications Manager
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * FILE: base/applications/rapps/misc.cpp
+ * PURPOSE: Misc functions
+ * COPYRIGHT: Copyright 2009 Dmitry Chapyshev (dmitry@reactos.org)
+ * Copyright 2015 Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
+ * Copyright 2017 Alexander Shaposhnikov (sanchaez@reactos.org)
*/
#include "defines.h"
}
// 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))
{
- // we don't have cached section strings for the current system language, create them, lazy
- CacheINILocaleLazy();
+ CacheINILocale();
}
ATL::CStringW CConfigParser::GetINIFullPath(const ATL::CStringW& FileName)
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
- GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
- m_szLocaleID.GetBuffer(m_cchLocaleSize), m_cchLocaleSize);
-
- m_szLocaleID.ReleaseBuffer();
- m_szCachedINISectionLocale = L"Section." + m_szLocaleID;
-
- // turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part
- m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale + m_szLocaleID.Right(2);
- }
-}
+ // TODO: Set default locale if call fails
+ // find out what is the current system lang code (e.g. "0a") and append it to SectionLocale
+ GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
+ m_szLocaleID.GetBuffer(m_cchLocaleSize), m_cchLocaleSize);
-const ATL::CStringW& CConfigParser::GetLocale()
-{
- CacheINILocaleLazy();
- return m_szLocaleID;
-}
+ m_szLocaleID.ReleaseBuffer();
+ m_szCachedINISectionLocale = L"Section." + m_szLocaleID;
-INT CConfigParser::GetLocaleSize()
-{
- return m_cchLocaleSize;
+ // turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part
+ m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale + m_szLocaleID.Right(2);
}
UINT CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString)