Use wchar_t as lyx::char_type if it is 32 bit wide.

No scons and cmake support! scons and cmake need to find out the size of
wchar_t and define this macro in config.h (example for 32bit wchar_t):

* The size of a `wchar_t', as computed by sizeof. */
#define SIZEOF_WCHAR_T 4

	* configure.ac: Test size of wchar_t

	* src/support/types.h: don't include docstring.h anymore.
	Use wchar_t as lyx::char_type if it is 32 bit wide.

	* src/support/docstring.h: Use lyx::char_type for defining docstring

	* src/metricsinfo.h: include support/docstring.h instead of
	support/types.h
	* src/lyxlex.h: ditto
	* src/frontends/font_metrics.h: ditto
	* src/frontends/qt4/qt_helpers.h: ditto
	* src/frontends/Painter.h: ditto
	* src/errorlist.h: ditto
	* src/support/lstrings.h: ditto
	* src/lyxfunc.h: ditto
	* src/LaTeX.h: ditto


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14991 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-09-13 21:13:49 +00:00
parent 59fdb31af3
commit 9080c44458
12 changed files with 27 additions and 27 deletions

View File

@ -147,6 +147,9 @@ AC_SUBST(AIKSAURUS_LIBS)
LYX_USE_INCLUDED_BOOST
# Needed for our char_type
AC_CHECK_SIZEOF(wchar_t)
### Setup libtool
dnl Dirty trick ahead: disable libtool checking for a fortran compiler
dnl see http://permalink.gmane.org/gmane.comp.gnu.libtool.general/6699

View File

@ -16,6 +16,8 @@
#include "outputparams.h"
#include "support/docstring.h"
#include <boost/utility.hpp>
#include <boost/signal.hpp>

View File

@ -12,7 +12,7 @@
#ifndef ERRORLIST_H
#define ERRORLIST_H
#include "support/types.h"
#include "support/docstring.h"
#include <vector>
#include <string>

View File

@ -15,9 +15,7 @@
#include "LColor.h"
#include "support/types.h"
#include <string>
#include "support/docstring.h"
class LyXFont;

View File

@ -13,9 +13,7 @@
#ifndef FONT_METRICS_H
#define FONT_METRICS_H
#include "support/types.h"
#include <string>
#include "support/docstring.h"
class LyXFont;

View File

@ -17,7 +17,7 @@
#include "lyxlength.h"
//#include "lengthcombo.h"
#include "support/types.h"
#include "support/docstring.h"
#include <vector>

View File

@ -18,7 +18,7 @@
#include "kbsequence.h"
#include "lfuns.h"
#include "support/types.h"
#include "support/docstring.h"
#include <boost/shared_ptr.hpp>
#include <boost/signals/trackable.hpp>

View File

@ -17,12 +17,11 @@
#ifndef LYXLEX_H
#define LYXLEX_H
#include "support/types.h"
#include "support/docstring.h"
#include <boost/utility.hpp>
#include <iosfwd>
#include <string>
///

View File

@ -13,9 +13,7 @@
#define METRICSINFO_H
#include "lyxfont.h"
#include "support/types.h"
#include <string>
#include "support/docstring.h"
class BufferView;

View File

@ -13,13 +13,14 @@
#ifndef LYX_DOCSTRING_H
#define LYX_DOCSTRING_H
#include <boost/cstdint.hpp>
#include "support/types.h"
#include <string>
namespace lyx {
/// String type for storing the main text in UCS4 encoding
typedef std::basic_string<boost::uint32_t> docstring;
typedef std::basic_string<char_type> docstring;
/// Creates a docstring from a C string of ASCII characters
docstring const from_ascii(char const *);
@ -60,7 +61,7 @@ lyx::docstring operator+(lyx::docstring const & l, char r);
lyx::docstring operator+(char l, lyx::docstring const & r);
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4
#if SIZEOF_WCHAR_T != 4 && defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4
// Missing char_traits methods in gcc 3.3 and older. Taken from gcc 4.2svn.
namespace std {

View File

@ -16,7 +16,7 @@
#ifndef LSTRINGS_H
#define LSTRINGS_H
#include "support/types.h"
#include "support/docstring.h"
#include <vector>

View File

@ -16,21 +16,22 @@
#ifndef LYX_TYPES_H
#define LYX_TYPES_H
#include "docstring.h"
#include <boost/cstdint.hpp>
#include <cstddef>
#include <string>
namespace lyx {
// The type used to hold characters in paragraphs
typedef boost::uint32_t char_type; // Possibly the ucs-4 type we will use
//typedef wchar_t char_type; // The wide char type CJK-LyX uses
//typedef char char_type; // Current narrow char type in use
//typedef std::wstring docstring;
/// The type used to hold characters in paragraphs
#if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4
// Prefer this if possible because GNU libstdc++ has usable
// std::ctype<wchar_t> locale facets but not
// std::ctype<boost::uint32_t>. gcc older than 3.4 is also missing
// usable std::char_traits<boost::uint32_t>.
typedef wchar_t char_type;
#else
typedef boost::uint32_t char_type;
#endif
/// a type for positions used in paragraphs
// needs to be signed for a while to hold the special value -1 that is