/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 * 
 * utils.cpp
 *
 *      Author: pgess <v.melnychenko@xreate.org>
 */

#include "utils.h"
#include <boost/locale/encoding_utf.hpp>

using namespace xreate;

Config Config::__self = Config();

Config::Config()
: __storage{json_file{ "config/default.json" }}
{}

using boost::locale::conv::utf_to_utf;

std::wstring
utf8_to_wstring(const std::string& str)
{
    return utf_to_utf<wchar_t>(str.c_str(), str.c_str() + str.size());
}

std::string
wstring_to_utf8(const std::wstring& str)
{
    return utf_to_utf<char>(str.c_str(), str.c_str() + str.size());
}
