]> git.lyx.org Git - lyx.git/blob - src/support/strfwd.h
* layouttranslations.review - remove dupes
[lyx.git] / src / support / strfwd.h
1 // -*- C++ -*-
2
3 // Heavily inspired by /usr/include/c++/4.1/bits
4 //
5 // Copyright (C) 2001, 2002 Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library.  This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 2, or (at your option)
11 // any later version.
12
13 #ifndef STRFWD_H
14 #define STRFWD_H
15
16 // This includes does nothing but defining _LIBCPP_VERSION
17 // if libc++ is used (rather than libstdc++) - we first
18 // check if we have at least a c++03 standard before
19 // including the file
20 #if (__cplusplus > 19971L)
21 #include <ciso646>
22 #endif
23
24 #ifdef USE_WCHAR_T
25
26 // Prefer this if possible because GNU libstdc++ has usable
27 // std::ctype<wchar_t> locale facets but not
28 // std::ctype<boost::uint32_t>. gcc older than 3.4 is also missing
29 // usable std::char_traits<boost::uint32_t>.
30 namespace lyx { typedef wchar_t char_type; }
31
32 #else
33
34 #include <boost/cstdint.hpp>
35 namespace lyx { typedef boost::uint32_t char_type; }
36
37 #endif
38
39 // Forward definitions do not work with libc++
40 #ifdef  _LIBCPP_VERSION
41 #include <string>
42 #else
43
44 namespace std {
45
46 template<typename Alloc> class allocator;
47
48 template<typename Char> struct char_traits;
49 template<> struct char_traits<char>;
50 #ifdef USE_WCHAR_T
51 template<> struct char_traits<wchar_t>;
52 #endif
53
54 template<typename Char, typename Traits, typename Alloc> class basic_string;
55 typedef basic_string<char, char_traits<char>, allocator<char> > string;
56
57 template<class Char, class Traits> class basic_istream;
58 template<class Char, class Traits> class basic_ostream;
59 template<class Char, class Traits, class Allocator> class basic_ostringstream;
60
61 typedef basic_istream<char, char_traits<char> > istream;
62 typedef basic_ostream<char, char_traits<char> > ostream;
63 typedef basic_ostringstream<char, char_traits<char>, allocator<char> > ostringstream;
64
65 } // namepace std
66
67 #endif
68
69 namespace lyx {
70
71 /// String type for storing the main text in UCS4 encoding
72 typedef std::basic_string<char_type, std::char_traits<char_type>,
73         std::allocator<char_type> > docstring;
74
75 /// Base class for UCS4 input streams
76 typedef std::basic_istream<char_type, std::char_traits<char_type> > idocstream;
77
78 /// Base class for UCS4 output streams
79 typedef std::basic_ostream<char_type, std::char_traits<char_type> > odocstream;
80
81 /// UCS4 output stringstream
82 typedef std::basic_ostringstream<char_type, std::char_traits<char_type>, std::allocator<char_type> > odocstringstream;
83
84 #if ! defined(USE_WCHAR_T)
85 extern odocstream & operator<<(odocstream &, char);
86 #endif
87
88 // defined in lstrings.cpp
89 docstring const & empty_docstring();
90 std::string const & empty_string();
91 // defined in docstring.cpp
92 bool operator==(docstring const &, char const *);
93
94 } // namespace lyx
95
96 #endif