// Created by Lars Gullik Bjønnes
// Copyright 1999 Lars Gullik Bjønnes (larsbj@lyx.org)
-// Released under the Gnu General Public License
+// Released into the public domain.
// Implemented and tested on g++ 2.7.2.3
#ifndef DEBUGSTREAM_H
#define DEBUGSTREAM_H
-#ifdef _STANDARD_C_PLUS_PLUS
-#define MODERN_STL
-#endif
-
-#ifdef MODERN_STL
-#include <ostream>
-#else
-#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
+#include "LOstream.h"
#ifdef TEST_DEBUGSTREAM
#include <string>
/** A function to convert symbolic string names on debug levels
to their numerical value.
*/
- static Debug::type value(std::string const & val) {
+ static Debug::type value(string const & val) {
if (val == "NONE") return Debug::NONE;
if (val == "INFO") return Debug::INFO;
if (val == "WARN") return Debug::WARN;
debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
*/
-class DebugStream : public ostream {
+class DebugStream : public std::ostream {
public:
/// Constructor, sets the debug level to t.
- DebugStream(Debug::type t = Debug::NONE);
+ explicit DebugStream(Debug::type t = Debug::NONE);
/// Constructor, sets the log file to f, and the debug level to t.
+ explicit
DebugStream(char const * f, Debug::type t = Debug::NONE);
///
current debug level otherwise the real debug stream
is used.
*/
- ostream & debug(Debug::type t = Debug::ANY) {
+ std::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";
*/
- ostream & operator[](Debug::type t) {
+ std::ostream & operator[](Debug::type t) {
return debug(t);
}
private:
/// The current debug level
Debug::type dt;
/// The no-op stream.
- ostream nullstream;
+ std::ostream nullstream;
struct debugstream_internal;
debugstream_internal * internal;
};