]> git.lyx.org Git - lyx.git/blob - boost/boost/format/detail/workarounds_gcc-2.95.hpp
Boost 1.31.0
[lyx.git] / boost / boost / format / detail / workarounds_gcc-2.95.hpp
1 // -*- C++ -*-
2 //  Boost general library 'format'   ---------------------------
3 //  See http://www.boost.org for updates, documentation, and revision history.
4
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.
10
11
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.
20
21 #if  BOOST_WORKAROUND(__GNUC__, < 3) & defined(__STL_CONFIG_H) // nothing to do else
22
23 #ifndef BOOST_FORMAT_WORKAROUNDS_GCC295_H
24 #define BOOST_FORMAT_WORKAROUNDS_GCC295_H
25
26 #include <iostream> // SGI STL doesnt have <ostream> and others, we need iostream.
27
28
29 #ifndef BOOST_IO_STD
30 #  define BOOST_IO_STD std::
31 #endif
32
33
34
35 // *** 
36 // gcc's simple classes turned into standard-like template classes :
37
38 namespace std {
39
40
41 template <class Ch>
42 class char_traits : public string_char_traits<Ch> {
43 };
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.
47
48 template <class Ch, class Tr>
49 class basic_ios;
50
51 template <class Tr> 
52 class basic_ios<char, Tr> : virtual public ostream {
53 public:
54   char fill()  const { return ios::fill(); } // gcc returns wchar..
55   char fill(char c)  { return ios::fill(c); } // gcc takes wchar..
56 };
57
58 typedef ios ios_base;
59
60
61 template <class Ch, class Tr>
62 class basic_ostream;
63
64 template <class Tr> 
65 class basic_ostream<char, Tr> : public basic_ios<char, Tr>  {
66 public:
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; }
71 };
72
73
74 template <class Ch, class Tr>
75 class basic_streambuf;
76
77 template <class Tr> 
78 class basic_streambuf<char, Tr> : public streambuf {
79 };
80
81
82 } // namespace std
83
84
85 #endif // include guard
86
87 #endif // if workaround