diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index 114af7dc2e..43b327b801 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -23,6 +23,10 @@ #include using std::endl; +using std::map; +using std::make_pair; +using std::string; +using std::vector; namespace { @@ -193,13 +197,13 @@ namespace { template -std::vector +vector iconv_convert(IconvProcessor & processor, InType const * buf, size_t buflen) { if (buflen == 0) - return std::vector(); + return vector(); char const * inbuf = reinterpret_cast(buf); size_t inbytesleft = buflen * sizeof(InType); @@ -212,33 +216,33 @@ iconv_convert(IconvProcessor & processor, if (bytes <= 0) // Conversion failed // FIXME Maybe throw an exception and handle that in the caller? - return std::vector(); + return vector(); RetType const * tmp = reinterpret_cast(out); - return std::vector(tmp, tmp + bytes / sizeof(RetType)); + return vector(tmp, tmp + bytes / sizeof(RetType)); } } // anon namespace -std::vector utf8_to_ucs4(std::vector const & utf8str) +vector utf8_to_ucs4(vector const & utf8str) { if (utf8str.empty()) - return std::vector(); + return vector(); return utf8_to_ucs4(&utf8str[0], utf8str.size()); } -std::vector +vector utf8_to_ucs4(char const * utf8str, size_t ls) { static IconvProcessor processor(ucs4_codeset, "UTF-8"); - return iconv_convert(processor, utf8str, ls); + return iconv_convert(processor, utf8str, ls); } -std::vector +vector utf16_to_ucs4(unsigned short const * s, size_t ls) { static IconvProcessor processor(ucs4_codeset, utf16_codeset); @@ -246,7 +250,7 @@ utf16_to_ucs4(unsigned short const * s, size_t ls) } -std::vector +vector ucs4_to_utf16(char_type const * s, size_t ls) { static IconvProcessor processor(utf16_codeset, ucs4_codeset); @@ -254,51 +258,51 @@ ucs4_to_utf16(char_type const * s, size_t ls) } -std::vector -ucs4_to_utf8(lyx::char_type c) +vector +ucs4_to_utf8(char_type c) { static IconvProcessor processor("UTF-8", ucs4_codeset); return iconv_convert(processor, &c, 1); } -std::vector -ucs4_to_utf8(std::vector const & ucs4str) +vector +ucs4_to_utf8(vector const & ucs4str) { if (ucs4str.empty()) - return std::vector(); + return vector(); return ucs4_to_utf8(&ucs4str[0], ucs4str.size()); } -std::vector -ucs4_to_utf8(lyx::char_type const * ucs4str, size_t ls) +vector +ucs4_to_utf8(char_type const * ucs4str, size_t ls) { static IconvProcessor processor("UTF-8", ucs4_codeset); return iconv_convert(processor, ucs4str, ls); } -std::vector -eightbit_to_ucs4(char const * s, size_t ls, std::string const & encoding) +vector +eightbit_to_ucs4(char const * s, size_t ls, string const & encoding) { - static std::map processors; + static map processors; if (processors.find(encoding) == processors.end()) { IconvProcessor processor(ucs4_codeset, encoding.c_str()); - processors.insert(std::make_pair(encoding, processor)); + processors.insert(make_pair(encoding, processor)); } return iconv_convert(processors[encoding], s, ls); } -std::vector -ucs4_to_eightbit(lyx::char_type const * ucs4str, size_t ls, std::string const & encoding) +vector +ucs4_to_eightbit(char_type const * ucs4str, size_t ls, string const & encoding) { - static std::map processors; + static map processors; if (processors.find(encoding) == processors.end()) { IconvProcessor processor(encoding.c_str(), ucs4_codeset); - processors.insert(std::make_pair(encoding, processor)); + processors.insert(make_pair(encoding, processor)); } return iconv_convert(processors[encoding], ucs4str, ls); }