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
This commit is contained in:
Enrico Forestieri 2007-11-08 06:05:19 +00:00
parent 14f7e7fffe
commit 4a35906da7
3 changed files with 27 additions and 46 deletions

View File

@ -339,6 +339,15 @@ odocstream & operator<<(odocstream & os, SetEnc e)
return os; 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__) #if ! defined(USE_WCHAR_T) && defined(__GNUC__)

View File

@ -70,13 +70,6 @@ typedef std::basic_istringstream<char_type> idocstringstream;
/// UCS4 output stringstream /// UCS4 output stringstream
typedef std::basic_ostringstream<char_type> odocstringstream; typedef std::basic_ostringstream<char_type> odocstringstream;
inline
odocstream & operator<<(odocstream & os, char c)
{
os.put(c);
return os;
}
/// Helper struct for changing stream encoding /// Helper struct for changing stream encoding
struct SetEnc { struct SetEnc {
SetEnc(std::string const & e) : encoding(e) {} SetEnc(std::string const & e) : encoding(e) {}

View File

@ -1,14 +1,14 @@
// -*- C++ -*- // -*- C++ -*-
/**
// Heavily inspired by /usr/include/c++/4.1/bits * \file strfwd.h
// * This file is part of LyX, the document processor.
// Copyright (C) 2001, 2002 Free Software Foundation, Inc. * Licence details can be found in the file COPYING.
// *
// This file is part of the GNU ISO C++ Library. This library is free * \author André Pönitz
// software; you can redistribute it and/or modify it under the * \author Enrico Forestieri
// terms of the GNU General Public License as published by the *
// Free Software Foundation; either version 2, or (at your option) * Full author contact details are available in file CREDITS.
// any later version. */
#ifndef STRFWD_H #ifndef STRFWD_H
#define STRFWD_H #define STRFWD_H
@ -28,43 +28,22 @@ namespace lyx { typedef boost::uint32_t char_type; }
#endif #endif
#include<iosfwd>
namespace std {
template<typename Char> struct char_traits;
template<> struct char_traits<char>;
#ifdef USE_WCHAR_T
template<> struct char_traits<wchar_t>;
#endif
template<typename Alloc> class allocator;
template<typename Char, typename Traits, typename Alloc> class basic_string;
typedef basic_string<char, char_traits<char>, allocator<char> > string;
template<class Char, class Traits> class basic_istream;
template<class Char, class Traits> class basic_ostream;
typedef basic_istream<char, char_traits<char> > istream;
typedef basic_ostream<char, char_traits<char> > ostream;
}
namespace lyx { namespace lyx {
typedef std::basic_string<char_type, std::char_traits<char_type>, /// String type for storing the main text in UCS4 encoding
std::allocator<char_type> > docstring; typedef std::basic_string<char_type> docstring;
/// Base class for UCS4 input streams /// Base class for UCS4 input streams
typedef std::basic_istream<char_type, std::char_traits<char_type> > typedef std::basic_istream<char_type> idocstream;
idocstream;
/// Base class for UCS4 output streams /// Base class for UCS4 output streams
typedef std::basic_ostream<char_type, std::char_traits<char_type> > typedef std::basic_ostream<char_type> odocstream;
odocstream;
#if ! defined(USE_WCHAR_T)
extern odocstream & operator<<(odocstream &, char);
#endif
} // namespace lyx } // namespace lyx