fix unicode cast

This commit is contained in:
gfgtdf 2014-10-23 20:04:05 +02:00
parent fa67d14571
commit 2ecf630ad3
2 changed files with 4 additions and 5 deletions

View file

@ -462,7 +462,7 @@ void hotkey_item::save(config& item) const
if (get_hat() >= 0) item["hat"] = get_hat();
if (get_value() >= 0) item["value"] = get_value();
if (get_keycode() >= 0) item["key"] = SDL_GetKeyName(SDLKey(get_keycode()));
if (get_character() >= 0) item["key"] = unicode_cast<utf8::string, ucs4::char_t>(get_character()); // Second template argument because get_character returns a signed int
if (get_character() >= 0) item["key"] = unicode_cast<utf8::string>(static_cast<ucs4::char_t>(get_character()));
if (get_mouse() >= 0) item["mouse"] = get_mouse();
if (get_button() >= 0) item["button"] = get_button();

View file

@ -92,13 +92,12 @@ typename ucs4_convert_impl::enableif<TD, typename TS::value_type>::type unicode_
input, a single character.
@return an instance of TD
*/
template<typename TD , typename TI>
//TD unicode_cast(const TI& onechar)
typename boost::enable_if<typename boost::is_arithmetic<TI>::type, TD >::type unicode_cast(const TI& onechar)
template<typename TD>
TD unicode_cast(ucs4::char_t onechar)
{
using namespace ucs4_convert_impl;
typedef typename convert_impl<typename TD::value_type>::type t_impl_writer;
typedef typename convert_impl<TI>::type t_impl_reader;
typedef convert_impl<ucs4::char_t>::type t_impl_reader;
typedef typename std::back_insert_iterator<TD> t_outputitor;
TD res;