4051
|
1 /* |
|
2 |
|
3 Copyright (C) 2002 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
4051
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_liboctave_sstream_h) |
|
25 #define octave_liboctave_sstream_h 1 |
|
26 |
4124
|
27 #if defined (__GNUG__) && __GNUC__ < 3 |
|
28 #undef HAVE_SSTREAM |
|
29 #endif |
|
30 |
4051
|
31 #ifdef HAVE_SSTREAM |
|
32 |
|
33 #include <sstream> |
|
34 |
|
35 #define STRINGSTREAMBUF std::stringbuf |
|
36 |
|
37 #define ISSTREAM std::istringstream |
|
38 |
|
39 #define OSSTREAM std::ostringstream |
|
40 #define OSSTREAM_STR(os) (os).str () |
4732
|
41 // XXX FIXME XXX -- how long is the temporary created by the str() |
|
42 // method guaranteed to exist? |
4051
|
43 #define OSSTREAM_C_STR(os) (os).str () . c_str () |
|
44 #define OSSTREAM_ENDS "" |
|
45 #define OSSTREAM_FREEZE(os) do { } while (0) |
|
46 |
|
47 #else |
|
48 |
|
49 #include <strstream> |
|
50 |
|
51 #define STRINGSTREAMBUF std::strstreambuf |
|
52 |
|
53 #define ISSTREAM std::istrstream |
|
54 |
|
55 #define OSSTREAM std::ostrstream |
|
56 #define OSSTREAM_STR(os) std::string ((os).str ()) |
|
57 #define OSSTREAM_C_STR(os) (os).str () |
|
58 #define OSSTREAM_ENDS std::ends |
|
59 #define OSSTREAM_FREEZE(os) do { (os).freeze (false); } while (0) |
|
60 |
|
61 #endif |
|
62 |
|
63 #endif |
|
64 |
|
65 /* |
|
66 ;;; Local Variables: *** |
|
67 ;;; mode: C++ *** |
|
68 ;;; End: *** |
|
69 */ |