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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_liboctave_sstream_h) |
|
24 #define octave_liboctave_sstream_h 1 |
|
25 |
4124
|
26 #if defined (__GNUG__) && __GNUC__ < 3 |
|
27 #undef HAVE_SSTREAM |
|
28 #endif |
|
29 |
4051
|
30 #ifdef HAVE_SSTREAM |
|
31 |
|
32 #include <sstream> |
|
33 |
|
34 #define STRINGSTREAMBUF std::stringbuf |
|
35 |
|
36 #define ISSTREAM std::istringstream |
|
37 |
|
38 #define OSSTREAM std::ostringstream |
|
39 #define OSSTREAM_STR(os) (os).str () |
4732
|
40 // XXX FIXME XXX -- how long is the temporary created by the str() |
|
41 // method guaranteed to exist? |
4051
|
42 #define OSSTREAM_C_STR(os) (os).str () . c_str () |
|
43 #define OSSTREAM_ENDS "" |
|
44 #define OSSTREAM_FREEZE(os) do { } while (0) |
|
45 |
|
46 #else |
|
47 |
|
48 #include <strstream> |
|
49 |
|
50 #define STRINGSTREAMBUF std::strstreambuf |
|
51 |
|
52 #define ISSTREAM std::istrstream |
|
53 |
|
54 #define OSSTREAM std::ostrstream |
|
55 #define OSSTREAM_STR(os) std::string ((os).str ()) |
|
56 #define OSSTREAM_C_STR(os) (os).str () |
|
57 #define OSSTREAM_ENDS std::ends |
|
58 #define OSSTREAM_FREEZE(os) do { (os).freeze (false); } while (0) |
|
59 |
|
60 #endif |
|
61 |
|
62 #endif |
|
63 |
|
64 /* |
|
65 ;;; Local Variables: *** |
|
66 ;;; mode: C++ *** |
|
67 ;;; End: *** |
|
68 */ |