From 4a35906da709af9a1e7cb28484f45340937a83f4 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Thu, 8 Nov 2007 06:05:19 +0000 Subject: [PATCH] Fix problems with odocstream on "exotic" systems caused by the strfwd gimmick. * src/support/docstream.{cpp,h}: Move insertion operator for char types from docstream.h to docstream.cpp and compile it only when USE_WCHAR_T is not defined. * src/support/strfwd.h: Implement forward declarations in standard C++ way. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21513 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/docstream.cpp | 9 +++++++ src/support/docstream.h | 7 ----- src/support/strfwd.h | 57 +++++++++++++-------------------------- 3 files changed, 27 insertions(+), 46 deletions(-) diff --git a/src/support/docstream.cpp b/src/support/docstream.cpp index 6c5dd8bed0..cc44c13722 100644 --- a/src/support/docstream.cpp +++ b/src/support/docstream.cpp @@ -339,6 +339,15 @@ odocstream & operator<<(odocstream & os, SetEnc e) return os; } + +#if ! defined(USE_WCHAR_T) +odocstream & operator<<(odocstream & os, char c) +{ + os.put(c); + return os; +} +#endif + } #if ! defined(USE_WCHAR_T) && defined(__GNUC__) diff --git a/src/support/docstream.h b/src/support/docstream.h index c3db04c58a..ed49a726cf 100644 --- a/src/support/docstream.h +++ b/src/support/docstream.h @@ -70,13 +70,6 @@ typedef std::basic_istringstream idocstringstream; /// UCS4 output stringstream typedef std::basic_ostringstream odocstringstream; -inline -odocstream & operator<<(odocstream & os, char c) -{ - os.put(c); - return os; -} - /// Helper struct for changing stream encoding struct SetEnc { SetEnc(std::string const & e) : encoding(e) {} diff --git a/src/support/strfwd.h b/src/support/strfwd.h index 32a8248118..370af754f5 100644 --- a/src/support/strfwd.h +++ b/src/support/strfwd.h @@ -1,14 +1,14 @@ // -*- C++ -*- - -// Heavily inspired by /usr/include/c++/4.1/bits -// -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. +/** + * \file strfwd.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author André Pönitz + * \author Enrico Forestieri + * + * Full author contact details are available in file CREDITS. + */ #ifndef STRFWD_H #define STRFWD_H @@ -28,43 +28,22 @@ namespace lyx { typedef boost::uint32_t char_type; } #endif - -namespace std { - -template struct char_traits; -template<> struct char_traits; -#ifdef USE_WCHAR_T -template<> struct char_traits; -#endif - -template class allocator; - -template class basic_string; - -typedef basic_string, allocator > string; - -template class basic_istream; -template class basic_ostream; - -typedef basic_istream > istream; -typedef basic_ostream > ostream; - -} - +#include namespace lyx { -typedef std::basic_string, - std::allocator > docstring; +/// String type for storing the main text in UCS4 encoding +typedef std::basic_string docstring; /// Base class for UCS4 input streams -typedef std::basic_istream > - idocstream; +typedef std::basic_istream idocstream; /// Base class for UCS4 output streams -typedef std::basic_ostream > - odocstream; +typedef std::basic_ostream odocstream; +#if ! defined(USE_WCHAR_T) +extern odocstream & operator<<(odocstream &, char); +#endif } // namespace lyx -- 2.39.2