2 // Boost general library 'format' ---------------------------
3 // See http://www.boost.org for updates, documentation, and revision history.
5 // (C) Samuel Krempp 2003
6 // Permission to copy, use, modify, sell and
7 // distribute this software is granted provided this copyright notice appears
8 // in all copies. This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose.
12 // workarounds for gcc < 3.0 :
13 // . defines a few macros
14 // . supplies template classes basic_foo<char, Tr> where gcc only supplies foo :
15 // - basic_ios<char, Tr> from ios
16 // - basic_ostream<char, Tr> from ostream
17 // - basic_srteambuf<char, Tr> from streambuf
18 // of course, the traits type 'Tr' is not used at all,
19 // and you instantiating those template with a char type different than char fails.
21 #if BOOST_WORKAROUND(__GNUC__, < 3) & defined(__STL_CONFIG_H) // nothing to do else
23 #ifndef BOOST_FORMAT_WORKAROUNDS_GCC295_H
24 #define BOOST_FORMAT_WORKAROUNDS_GCC295_H
26 #include <iostream> // SGI STL doesnt have <ostream> and others, we need iostream.
30 # define BOOST_IO_STD std::
36 // gcc's simple classes turned into standard-like template classes :
42 class char_traits : public string_char_traits<Ch> {
44 // only problem : gcc's 'string' is a typedef for basic_string<char, string_char_traits<char> >,
45 // so strings built using char_traits wont match the type 'string'.
46 // so it's better to use string_char_traits directly.
48 template <class Ch, class Tr>
52 class basic_ios<char, Tr> : virtual public ostream {
54 char fill() const { return ios::fill(); } // gcc returns wchar..
55 char fill(char c) { return ios::fill(c); } // gcc takes wchar..
61 template <class Ch, class Tr>
65 class basic_ostream<char, Tr> : public basic_ios<char, Tr> {
67 basic_ostream(streambuf* sb) : ostream(sb) {}
68 basic_ostream() : ostream() {}
69 char widen(char c) { return c; }
70 char narrow(char c, char def) { return c; }
74 template <class Ch, class Tr>
75 class basic_streambuf;
78 class basic_streambuf<char, Tr> : public streambuf {
85 #endif // include guard
87 #endif // if workaround