From 59fdb31af390b57fba34b54b6f846e5de8706175 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Wed, 13 Sep 2006 17:11:39 +0000 Subject: [PATCH] s/boost::uint32_t/lyx::char_type/g except in the definition of lyx::docstring and lyx::char_type git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14990 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt3/QLPainter.C | 2 +- src/frontends/qt4/qt_helpers.C | 4 ++-- src/lyxlex_pimpl.C | 2 +- src/support/docstring.C | 2 +- src/support/unicode.C | 26 +++++++++++++------------- src/support/unicode.h | 25 +++++++++++++------------ 6 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/frontends/qt3/QLPainter.C b/src/frontends/qt3/QLPainter.C index be335513b7..550f87ceaf 100644 --- a/src/frontends/qt3/QLPainter.C +++ b/src/frontends/qt3/QLPainter.C @@ -222,7 +222,7 @@ void QLPainter::text(int x, int y, lyx::char_type const * s, size_t ls, // Brain-dead MSVC wants at(i) rather than operator[] str.at(i) = QChar(encoding->ucs(s[i])); #else - //std::vector in(s, s + ls); + //std::vector in(s, s + ls); //std::vector ucs2 = ucs4_to_ucs2(in); std::vector ucs2 = ucs4_to_ucs2(s, ls); ucs2.push_back(0); diff --git a/src/frontends/qt4/qt_helpers.C b/src/frontends/qt4/qt_helpers.C index 44fcf98e2f..3f419624f3 100644 --- a/src/frontends/qt4/qt_helpers.C +++ b/src/frontends/qt4/qt_helpers.C @@ -159,13 +159,13 @@ void qstring_to_ucs4(QString const & qstr, vector & ucs4) int const ls = qstr.size(); ucs4.clear(); for (int i = 0; i < ls; ++i) - ucs4.push_back(static_cast(qstr[i].unicode())); + ucs4.push_back(static_cast(qstr[i].unicode())); } char_type const qchar_to_ucs4(QChar const & qchar) { - return static_cast(qchar.unicode()); + return static_cast(qchar.unicode()); } diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index 415402b4cc..a3270e355d 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -73,7 +73,7 @@ string const LyXLex::Pimpl::getString() const lyx::docstring const LyXLex::Pimpl::getDocString() const { - std::vector res = utf8_to_ucs4(buff); + std::vector res = utf8_to_ucs4(buff); lyx::docstring dstr(res.begin(), res.end()); return dstr; } diff --git a/src/support/docstring.C b/src/support/docstring.C index 382612071a..aa0f43bfcc 100644 --- a/src/support/docstring.C +++ b/src/support/docstring.C @@ -40,7 +40,7 @@ docstring const from_ascii(std::string const & ascii) docstring const from_utf8(std::string const & utf8) { - std::vector const ucs4 = + std::vector const ucs4 = utf8_to_ucs4(utf8.data(), utf8.size()); return docstring(ucs4.begin(), ucs4.end()); } diff --git a/src/support/unicode.C b/src/support/unicode.C index 650962ab9b..4f4cf27980 100644 --- a/src/support/unicode.C +++ b/src/support/unicode.C @@ -124,60 +124,60 @@ iconv_convert(iconv_t * cd, } // anon namespace -std::vector utf8_to_ucs4(std::vector const & utf8str) +std::vector utf8_to_ucs4(std::vector const & utf8str) { return utf8_to_ucs4(&utf8str[0], utf8str.size()); } -std::vector +std::vector utf8_to_ucs4(char const * utf8str, size_t ls) { static iconv_t cd = (iconv_t)(-1); - return iconv_convert(&cd, ucs4_codeset, "UTF-8", + return iconv_convert(&cd, ucs4_codeset, "UTF-8", utf8str, ls); } -boost::uint32_t +lyx::char_type ucs2_to_ucs4(unsigned short c) { return ucs2_to_ucs4(&c, 1)[0]; } -std::vector +std::vector ucs2_to_ucs4(std::vector const & ucs2str) { return ucs2_to_ucs4(&ucs2str[0], ucs2str.size()); } -std::vector +std::vector ucs2_to_ucs4(unsigned short const * ucs2str, size_t ls) { static iconv_t cd = (iconv_t)(-1); - return iconv_convert(&cd, ucs4_codeset, ucs2_codeset, + return iconv_convert(&cd, ucs4_codeset, ucs2_codeset, ucs2str, ls); } unsigned short -ucs4_to_ucs2(boost::uint32_t c) +ucs4_to_ucs2(lyx::char_type c) { return ucs4_to_ucs2(&c, 1)[0]; } std::vector -ucs4_to_ucs2(std::vector const & ucs4str) +ucs4_to_ucs2(std::vector const & ucs4str) { return ucs4_to_ucs2(&ucs4str[0], ucs4str.size()); } std::vector -ucs4_to_ucs2(boost::uint32_t const * s, size_t ls) +ucs4_to_ucs2(lyx::char_type const * s, size_t ls) { static iconv_t cd = (iconv_t)(-1); return iconv_convert(&cd, ucs2_codeset, ucs4_codeset, @@ -186,7 +186,7 @@ ucs4_to_ucs2(boost::uint32_t const * s, size_t ls) std::vector -ucs4_to_utf8(boost::uint32_t c) +ucs4_to_utf8(lyx::char_type c) { static iconv_t cd = (iconv_t)(-1); return iconv_convert(&cd, "UTF-8", ucs4_codeset, &c, 1); @@ -194,14 +194,14 @@ ucs4_to_utf8(boost::uint32_t c) std::vector -ucs4_to_utf8(std::vector const & ucs4str) +ucs4_to_utf8(std::vector const & ucs4str) { return ucs4_to_utf8(&ucs4str[0], ucs4str.size()); } std::vector -ucs4_to_utf8(boost::uint32_t const * ucs4str, size_t ls) +ucs4_to_utf8(lyx::char_type const * ucs4str, size_t ls) { static iconv_t cd = (iconv_t)(-1); return iconv_convert(&cd, "UTF-8", ucs4_codeset, diff --git a/src/support/unicode.h b/src/support/unicode.h index 977ded6fd8..6af70074eb 100644 --- a/src/support/unicode.h +++ b/src/support/unicode.h @@ -13,7 +13,8 @@ #ifndef LYX_SUPPORT_UNICODE_H #define LYX_SUPPORT_UNICODE_H -#include +#include "support/types.h" + #include // utf8_to_ucs4 @@ -21,43 +22,43 @@ // A single codepoint conversion for utf8_to_ucs4 does not make // sense, so that function is left out. -std::vector +std::vector utf8_to_ucs4(std::vector const & utf8str); -std::vector +std::vector utf8_to_ucs4(char const * utf8str, size_t ls); // ucs2_to_ucs4 -boost::uint32_t +lyx::char_type ucs2_to_ucs4(unsigned short c); -std::vector +std::vector ucs2_to_ucs4(std::vector const & ucs2str); -std::vector +std::vector ucs2_to_ucs4(unsigned short const * ucs2str, size_t ls); // ucs4_to_ucs2 unsigned short -ucs4_to_ucs2(boost::uint32_t c); +ucs4_to_ucs2(lyx::char_type c); std::vector -ucs4_to_ucs2(std::vector const & ucs4str); +ucs4_to_ucs2(std::vector const & ucs4str); std::vector -ucs4_to_ucs2(boost::uint32_t const * s, size_t ls); +ucs4_to_ucs2(lyx::char_type const * s, size_t ls); // ucs4_to_utf8 std::vector -ucs4_to_utf8(boost::uint32_t c); +ucs4_to_utf8(lyx::char_type c); std::vector -ucs4_to_utf8(std::vector const & ucs4str); +ucs4_to_utf8(std::vector const & ucs4str); std::vector -ucs4_to_utf8(boost::uint32_t const * ucs4str, size_t ls); +ucs4_to_utf8(lyx::char_type const * ucs4str, size_t ls); #endif -- 2.39.5