1 iostream |
1 /* |
|
2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. |
|
3 * |
|
4 * Copyright (c) 1999 |
|
5 * Silicon Graphics Computer Systems, Inc. |
|
6 * |
|
7 * Copyright (c) 1999 |
|
8 * Boris Fomitchev |
|
9 * |
|
10 * This material is provided "as is", with absolutely no warranty expressed |
|
11 * or implied. Any use is at your own risk. |
|
12 * |
|
13 * Permission to use or copy this software for any purpose is hereby granted |
|
14 * without fee, provided the above notices are retained on all copies. |
|
15 * Permission to modify the code and to distribute modified code is granted, |
|
16 * provided the above notices are retained, and a notice that the code was |
|
17 * modified is included with the above copyright notice. |
|
18 * |
|
19 */ |
|
20 |
|
21 #ifndef _STLP_IOSTREAM |
|
22 #define _STLP_IOSTREAM |
|
23 |
|
24 # ifndef _STLP_OUTERMOST_HEADER_ID |
|
25 # define _STLP_OUTERMOST_HEADER_ID 0x1037 |
|
26 # include <stl/_prolog.h> |
|
27 # endif |
|
28 |
|
29 # ifdef _STLP_PRAGMA_ONCE |
|
30 # pragma once |
|
31 # endif |
|
32 |
|
33 # if defined (_STLP_OWN_IOSTREAMS) |
|
34 |
|
35 #include <stl/_iosfwd.h> |
|
36 #include <stl/_istream.h> |
|
37 |
|
38 _STLP_BEGIN_NAMESPACE |
|
39 |
|
40 #ifndef _STLP_USE_NAMESPACES |
|
41 // in case of SGI iostreams, we have to rename our streams not to clash with those |
|
42 // provided in native lib |
|
43 # define cin _STLP_cin |
|
44 # define cout _STLP_cout |
|
45 # define cerr _STLP_cerr |
|
46 # define clog _STLP_clog |
|
47 #endif |
|
48 |
|
49 // Note: cin and wcin are both associated with stdio. The C standard |
|
50 // (Amendment 1, section 4.6.2.1) says that it is an error to mix |
|
51 // wide- and narrow-oriented I/O on the same stream. This implies |
|
52 // that it is an error to use both cin and wcin in the same C++ |
|
53 // program; the same applies to cout and wcout, and cerr/clog and |
|
54 // wcerr/wclog. |
|
55 #if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) |
|
56 _STLP_DECLSPEC ostream& GetCErrStream(); |
|
57 _STLP_DECLSPEC ostream& GetCoutStream(); |
|
58 _STLP_DECLSPEC ostream& GetClogStream(); |
|
59 _STLP_DECLSPEC istream& GetCinStream(); |
|
60 |
|
61 //#define std::cerr (std::GetCErrStream()) |
|
62 #define cerr GetCErrStream() |
|
63 //#define std::cin (std::GetCinStream()) |
|
64 #define cin GetCinStream() |
|
65 //#define std::cout (std::GetCoutStream()) |
|
66 #define cout GetCoutStream() |
|
67 //#define std::clog (std::GetClogStream()) |
|
68 #define clog GetClogStream() |
|
69 #else //__LIBSTD_CPP_SYMBIAN32_WSD__ |
|
70 extern _STLP_DECLSPEC istream cin; |
|
71 extern _STLP_DECLSPEC ostream cout; |
|
72 extern _STLP_DECLSPEC ostream cerr; |
|
73 extern _STLP_DECLSPEC ostream clog; |
|
74 #endif //__LIBSTD_CPP_SYMBIAN32_WSD__ |
|
75 |
|
76 # ifndef _STLP_NO_WCHAR_T |
|
77 # if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) |
|
78 _STLP_DECLSPEC wostream& GetWCErrStream(); |
|
79 _STLP_DECLSPEC wostream& GetWCoutStream(); |
|
80 _STLP_DECLSPEC wostream& GetWClogStream(); |
|
81 _STLP_DECLSPEC wistream& GetWCinStream(); |
|
82 |
|
83 #define wcerr GetWCErrStream() |
|
84 #define wcin GetWCinStream() |
|
85 #define wcout GetWCoutStream() |
|
86 #define wclog GetWClogStream() |
|
87 #else //__LIBSTD_CPP_SYMBIAN32_WSD__ |
|
88 extern _STLP_DECLSPEC wistream wcin; |
|
89 extern _STLP_DECLSPEC wostream wcout; |
|
90 extern _STLP_DECLSPEC wostream wcerr; |
|
91 extern _STLP_DECLSPEC wostream wclog; |
|
92 #endif //__LIBSTD_CPP_SYMBIAN32_WSD__ |
|
93 # endif |
|
94 |
|
95 # ifndef __LOCALE_INITIALIZED |
|
96 # define __LOCALE_INITIALIZED |
|
97 # if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) |
|
98 // Global initializer object, to ensure initialization of locale subsystem. |
|
99 static ios_base::_Loc_init _LocInit; |
|
100 # endif |
|
101 # endif |
|
102 |
|
103 # ifndef __IOS_BASE_INITIALIZED |
|
104 # define __IOS_BASE_INITIALIZED |
|
105 # if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) |
|
106 // Global initializer object, to ensure construction of static objects. |
|
107 static ios_base::Init _IosInit; |
|
108 # endif |
|
109 # endif |
|
110 |
|
111 _STLP_END_NAMESPACE |
|
112 |
|
113 # elif defined ( _STLP_USE_NO_IOSTREAMS ) |
|
114 # include <stl/_null_stream.h> |
|
115 # else |
|
116 |
|
117 # include <wrap_std/iostream> |
|
118 |
|
119 # endif /* STL_USE_NO_IOSTREAMS */ |
|
120 |
|
121 # if (_STLP_OUTERMOST_HEADER_ID == 0x1037) |
|
122 # include <stl/_epilog.h> |
|
123 # undef _STLP_OUTERMOST_HEADER_ID |
|
124 # endif |
|
125 |
|
126 #endif /* _STLP_IOSTREAM */ |
|
127 |
|
128 // Local Variables: |
|
129 // mode:C++ |
|
130 // End: |