From a70382b0e8bed265a1d314d9f6aae8f2dd48d20b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 18:45:54 +0000 Subject: ex-protos moved to the Plugins folder git-svn-id: http://svn.miranda-ng.org/main/trunk@2545 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Quotes/src/Locale.cpp | 75 ----------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 protocols/Quotes/src/Locale.cpp (limited to 'protocols/Quotes/src/Locale.cpp') diff --git a/protocols/Quotes/src/Locale.cpp b/protocols/Quotes/src/Locale.cpp deleted file mode 100644 index c01f67148a..0000000000 --- a/protocols/Quotes/src/Locale.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "StdAfx.h" -#include "Locale.h" - -const std::locale GetSystemLocale() -{ - return std::locale(""); -} - -namespace -{ - tstring get_int_registry_value(LPCTSTR pszValueName) - { - tstring sResult; - HKEY hKey = NULL; - LONG lResult = ::RegOpenKeyEx(HKEY_CURRENT_USER, - _T("Control Panel\\International"),0,KEY_QUERY_VALUE,&hKey); - if ((ERROR_SUCCESS == lResult) && (NULL != hKey)) - { - DWORD dwType = 0; - DWORD dwSize = 0; - lResult = ::RegQueryValueEx(hKey,pszValueName,nullptr,&dwType,nullptr,&dwSize); - if ((ERROR_SUCCESS == lResult) && ((REG_SZ == dwType) || (REG_EXPAND_SZ == dwType))) - { - std::vector aBuffer(dwSize); - lResult = ::RegQueryValueEx(hKey,pszValueName,nullptr,nullptr,reinterpret_cast(&*aBuffer.begin()),&dwSize); - if(ERROR_SUCCESS == lResult) - { - std::copy(aBuffer.begin(),aBuffer.end(),std::back_inserter(sResult)); - } - } - } - - if(NULL != hKey) - { - lResult = ::RegCloseKey(hKey); - assert(ERROR_SUCCESS == lResult); - } - - return sResult; - } - - tstring date_win_2_boost(const tstring& sFrmt) - { - tstring sResult(_T("%d.%m.%y")); - if(sFrmt == _T("dd/MM/yy")) - { - sResult = _T("%d/%m/%y"); - } - else if(sFrmt == _T("yyyy-MM-dd")) - { - sResult = _T("%y-%m-%d"); - } - return sResult; - } - - tstring time_win_2_boost(const tstring& sFrmt) - { - tstring sResult = _T("%H:%M:%S"); - if(sFrmt == _T("H:mm") || sFrmt == _T("HH:mm")) - { - sResult = _T("%H:%M"); - } - return sResult; - } -} - -tstring Quotes_GetDateFormat(bool bShort) -{ - return date_win_2_boost(get_int_registry_value(bShort ? _T("sShortDate") : _T("sLongDate"))); -} - -tstring Quotes_GetTimeFormat(bool bShort) -{ - return time_win_2_boost(get_int_registry_value(bShort ? _T("sShortTime") : _T("sTimeFormat"))); -} \ No newline at end of file -- cgit v1.2.3