/*
 * ************************************************************************************************************
 * Author: Marcin Załęczny
 * Copyright (C)2010 Marcin Załęczny <mzaleczny@hotmail.com>
 * License: The GNU Lesser General Public License, version 3.0 (LGPLv3)
 * Library Name: mzstd
 * Version: 1.07
 * First release date:   2010-11-08
 * Current release date: 2011-03-04
 *
 *
 * This file is part of mzstd library
 * 
 * mzstd library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * mzstd library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************************************************
 */

#include "mzLocale.h"

PLocale userLocale = NULL;

CLocale::CLocale(CString localeName) {
    this->setRealClassName(L"CLocale");
	LPCWSTR lName = NULL;

	this->localeName = localeName;
	if (localeName == L"LOCALE_NAME_INVARIANT") {
		lName = LOCALE_NAME_INVARIANT;
	} else if (localeName == L"LOCALE_NAME_SYSTEM_DEFAULT") {
		lName = LOCALE_NAME_SYSTEM_DEFAULT;
	} else if (localeName == L"LOCALE_NAME_USER_DEFAULT") {
		lName = LOCALE_NAME_USER_DEFAULT;
	}

	LONG ret;
	typedef LONG (WINAPI *GLIEX)(__in LPCWSTR, __in LCTYPE, __out LPWSTR, __in LONG);
	GLIEX gliex;

	gliex = (GLIEX)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLocaleInfoW");
	if (gliex) {
		ret = gliex(lName, LOCALE_SDECIMAL, &this->locale_sdecimal[0], 4);
	} else {
		ret = GetLocaleInfoW((LCID)lName, LOCALE_SDECIMAL, &this->locale_sdecimal[0], 4);
	}
}

CLocale::~CLocale() {
}
