+1999-10-13 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * src/support/DebugStream.[Ch]: remove the explicit std:: before
+ streams classes and types, add the proper 'using' statements when
+ MODERN_STL is defined.
+
+ * src/debug.h: move the << operator definition after the inclusion
+ of DebugStream.h
+
+ * src/support/filetools.C: include "LAssert.h", which is needed
+ later.
+
+ * src/insets/Makefile.am, src/mathed/Makefile.am: add src/support
+ to includes.
+
+ * src/lyxfont.h, src/commandtags.h, src/mathed/math_defs.h:
+ include "debug.h" to define a proper ostream.
+
1999-10-12 Asger Alstrup Nielsen <alstrup@alstrup.galaxy.dk>
* src/sys*: Cleaned up the Systemcall stuff a bit. Added "kill(int)"
that is the intention. You can call it a no-op streambuffer, and
the ostream that uses it will be a no-op stream.
*/
-class nullbuf : public std::streambuf {
+class nullbuf : public streambuf {
protected:
///
virtual int sync() { return 0; }
///
- virtual std::streamsize xsputn(char const *, std::streamsize n) {
+ virtual streamsize xsputn(char const *, streamsize n) {
// fakes a purge of the buffer by returning n
return n;
}
/** A streambuf that sends the output to two different streambufs. These
can be any kind of streambufs.
*/
-class teebuf : public std::streambuf {
+class teebuf : public streambuf {
public:
///
- teebuf(std::streambuf * b1, std::streambuf * b2)
- : std::streambuf(), sb1(b1), sb2(b2) {}
+ teebuf(streambuf * b1, streambuf * b2)
+ : streambuf(), sb1(b1), sb2(b2) {}
protected:
///
virtual int sync() {
#endif
}
///
- virtual std::streamsize xsputn(char const * p, std::streamsize n) {
+ virtual streamsize xsputn(char const * p, streamsize n) {
#ifdef MODERN_STL
sb2->sputn(p, n);
return sb1->sputn(p, n);
}
private:
///
- std::streambuf * sb1;
+ streambuf * sb1;
///
- std::streambuf * sb2;
+ streambuf * sb2;
};
///
-class debugbuf : public std::streambuf {
+class debugbuf : public streambuf {
public:
///
- debugbuf(std::streambuf * b)
- : std::streambuf(), sb(b) {}
+ debugbuf(streambuf * b)
+ : streambuf(), sb(b) {}
protected:
///
virtual int sync() {
#endif
}
///
- virtual std::streamsize xsputn(char const * p, std::streamsize n) {
+ virtual streamsize xsputn(char const * p, streamsize n) {
#ifdef MODERN_STL
return sb->sputn(p, n);
#else
}
private:
///
- std::streambuf * sb;
+ streambuf * sb;
};
/// So that public parts of DebugStream does not need to know about filebuf
struct DebugStream::debugstream_internal {
/// Used when logging to file.
- std::filebuf fbuf;
+ filebuf fbuf;
};
/// Constructor, sets the debug level to t.
DebugStream::DebugStream(Debug::type t)
- : std::ostream(new debugbuf(std::cerr.rdbuf())),
+ : ostream(new debugbuf(cerr.rdbuf())),
dt(t), nullstream(new nullbuf), internal(0) {}
/// Constructor, sets the log file to f, and the debug level to t.
DebugStream::DebugStream(char const * f, Debug::type t)
- : std::ostream(new debugbuf(std::cerr.rdbuf())),
+ : ostream(new debugbuf(cerr.rdbuf())),
dt(t), nullstream(new nullbuf),
internal(new debugstream_internal)
{
- internal->fbuf.open(f, std::ios::out|std::ios::app);
- delete rdbuf(new teebuf(std::cerr.rdbuf(),
+ internal->fbuf.open(f, ios::out|ios::app);
+ delete rdbuf(new teebuf(cerr.rdbuf(),
&internal->fbuf));
}
} else {
internal = new debugstream_internal;
}
- internal->fbuf.open(f, std::ios::out|std::ios::app);
- delete rdbuf(new teebuf(std::cerr.rdbuf(),
+ internal->fbuf.open(f, ios::out|ios::app);
+ delete rdbuf(new teebuf(cerr.rdbuf(),
&internal->fbuf));
}
// support partial specialization. In egcs this should not be
// needed.
debugstream << "automatic " << &i
- << ", free store " << p << std::endl;
+ << ", free store " << p << endl;
delete p;
/*
for (int j = 0; j < 200000; ++j) {
DebugStream tmp;
- tmp << "Test" << std::endl;
+ tmp << "Test" << endl;
}
*/
}
#include <iostream>
#endif
+#ifdef MODERN_STL
+using std::ostream;
+using std::streambuf;
+using std::streamsize;
+using std::filebuf;
+using std::cerr;
+using std::ios;
+using std::endl;
+#endif
+
#ifdef TEST_DEBUGSTREAM
#include <string>
struct Debug {
debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
*/
-class DebugStream : public std::ostream {
+class DebugStream : public ostream {
public:
/// Constructor, sets the debug level to t.
DebugStream(Debug::type t = Debug::NONE);
current debug level otherwise the real debug stream
is used.
*/
- std::ostream & debug(Debug::type t = Debug::ANY) {
+ ostream & debug(Debug::type t = Debug::ANY) {
if (dt & t) return *this;
return nullstream;
}
/** This is an operator to give a more convenient use:
dbgstream[Debug::INFO] << "Info!\n";
*/
- std::ostream & operator[](Debug::type t) {
+ ostream & operator[](Debug::type t) {
return debug(t);
}
private:
/// The current debug level
Debug::type dt;
/// The no-op stream.
- std::ostream nullstream;
+ ostream nullstream;
struct debugstream_internal;
debugstream_internal * internal;
};