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
This commit is contained in:
Georg Baum 2006-09-13 17:11:39 +00:00
parent a82ca1eed1
commit 59fdb31af3
6 changed files with 31 additions and 30 deletions

View File

@ -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<boost::uint32_t> in(s, s + ls);
//std::vector<lyx::char_type> in(s, s + ls);
//std::vector<unsigned short> ucs2 = ucs4_to_ucs2(in);
std::vector<unsigned short> ucs2 = ucs4_to_ucs2(s, ls);
ucs2.push_back(0);

View File

@ -159,13 +159,13 @@ void qstring_to_ucs4(QString const & qstr, vector<char_type> & ucs4)
int const ls = qstr.size();
ucs4.clear();
for (int i = 0; i < ls; ++i)
ucs4.push_back(static_cast<boost::uint32_t>(qstr[i].unicode()));
ucs4.push_back(static_cast<lyx::char_type>(qstr[i].unicode()));
}
char_type const qchar_to_ucs4(QChar const & qchar)
{
return static_cast<boost::uint32_t>(qchar.unicode());
return static_cast<lyx::char_type>(qchar.unicode());
}

View File

@ -73,7 +73,7 @@ string const LyXLex::Pimpl::getString() const
lyx::docstring const LyXLex::Pimpl::getDocString() const
{
std::vector<boost::uint32_t> res = utf8_to_ucs4(buff);
std::vector<lyx::char_type> res = utf8_to_ucs4(buff);
lyx::docstring dstr(res.begin(), res.end());
return dstr;
}

View File

@ -40,7 +40,7 @@ docstring const from_ascii(std::string const & ascii)
docstring const from_utf8(std::string const & utf8)
{
std::vector<boost::uint32_t> const ucs4 =
std::vector<lyx::char_type> const ucs4 =
utf8_to_ucs4(utf8.data(), utf8.size());
return docstring(ucs4.begin(), ucs4.end());
}

View File

@ -124,60 +124,60 @@ iconv_convert(iconv_t * cd,
} // anon namespace
std::vector<boost::uint32_t> utf8_to_ucs4(std::vector<char> const & utf8str)
std::vector<lyx::char_type> utf8_to_ucs4(std::vector<char> const & utf8str)
{
return utf8_to_ucs4(&utf8str[0], utf8str.size());
}
std::vector<boost::uint32_t>
std::vector<lyx::char_type>
utf8_to_ucs4(char const * utf8str, size_t ls)
{
static iconv_t cd = (iconv_t)(-1);
return iconv_convert<boost::uint32_t>(&cd, ucs4_codeset, "UTF-8",
return iconv_convert<lyx::char_type>(&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<boost::uint32_t>
std::vector<lyx::char_type>
ucs2_to_ucs4(std::vector<unsigned short> const & ucs2str)
{
return ucs2_to_ucs4(&ucs2str[0], ucs2str.size());
}
std::vector<boost::uint32_t>
std::vector<lyx::char_type>
ucs2_to_ucs4(unsigned short const * ucs2str, size_t ls)
{
static iconv_t cd = (iconv_t)(-1);
return iconv_convert<boost::uint32_t>(&cd, ucs4_codeset, ucs2_codeset,
return iconv_convert<lyx::char_type>(&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<unsigned short>
ucs4_to_ucs2(std::vector<boost::uint32_t> const & ucs4str)
ucs4_to_ucs2(std::vector<lyx::char_type> const & ucs4str)
{
return ucs4_to_ucs2(&ucs4str[0], ucs4str.size());
}
std::vector<unsigned short>
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<unsigned short>(&cd, ucs2_codeset, ucs4_codeset,
@ -186,7 +186,7 @@ ucs4_to_ucs2(boost::uint32_t const * s, size_t ls)
std::vector<char>
ucs4_to_utf8(boost::uint32_t c)
ucs4_to_utf8(lyx::char_type c)
{
static iconv_t cd = (iconv_t)(-1);
return iconv_convert<char>(&cd, "UTF-8", ucs4_codeset, &c, 1);
@ -194,14 +194,14 @@ ucs4_to_utf8(boost::uint32_t c)
std::vector<char>
ucs4_to_utf8(std::vector<boost::uint32_t> const & ucs4str)
ucs4_to_utf8(std::vector<lyx::char_type> const & ucs4str)
{
return ucs4_to_utf8(&ucs4str[0], ucs4str.size());
}
std::vector<char>
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<char>(&cd, "UTF-8", ucs4_codeset,

View File

@ -13,7 +13,8 @@
#ifndef LYX_SUPPORT_UNICODE_H
#define LYX_SUPPORT_UNICODE_H
#include <boost/cstdint.hpp>
#include "support/types.h"
#include <vector>
// 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<boost::uint32_t>
std::vector<lyx::char_type>
utf8_to_ucs4(std::vector<char> const & utf8str);
std::vector<boost::uint32_t>
std::vector<lyx::char_type>
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<boost::uint32_t>
std::vector<lyx::char_type>
ucs2_to_ucs4(std::vector<unsigned short> const & ucs2str);
std::vector<boost::uint32_t>
std::vector<lyx::char_type>
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<unsigned short>
ucs4_to_ucs2(std::vector<boost::uint32_t> const & ucs4str);
ucs4_to_ucs2(std::vector<lyx::char_type> const & ucs4str);
std::vector<unsigned short>
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<char>
ucs4_to_utf8(boost::uint32_t c);
ucs4_to_utf8(lyx::char_type c);
std::vector<char>
ucs4_to_utf8(std::vector<boost::uint32_t> const & ucs4str);
ucs4_to_utf8(std::vector<lyx::char_type> const & ucs4str);
std::vector<char>
ucs4_to_utf8(boost::uint32_t const * ucs4str, size_t ls);
ucs4_to_utf8(lyx::char_type const * ucs4str, size_t ls);
#endif