2 * This file includes definitions for OpenStranded output mapping
4 * Copyright (C) 2009 David Kolossa
6 * This file is part of OpenStranded.
8 * OpenStranded is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * OpenStranded is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with OpenStranded. If not, see <http://www.gnu.org/licenses/>.
27 * This is the class for OpenStranded output to either cout or cerr.
35 void (*printer
)(std::string
);
38 Printer(void (*printer
)(std::string
));
47 operator<<(std::string msg
);
50 operator<<(const char *msg
);
65 operator<<(short msg
);
71 operator<<(long long msg
);
80 operator<<(unsigned int msg
);
83 operator<<(unsigned short msg
);
86 operator<<(unsigned long msg
);
89 operator<<(unsigned long long msg
);
98 operator<<(float msg
);
101 operator<<(double msg
);
110 vprintf(const char *format
, va_list args
);
113 printf(const char *format
, ...);
119 * These flags determine which messages are displayed and which
125 * These flags indicate whether a printer has not finished its
128 static int isWriting
;
131 * Print fatal error message to stderr.
135 fatalPrinter(std::string msg
);
138 * Print common error message to stderr.
142 errorPrinter(std::string msg
);
145 * Print warning message to stderr.
149 warningPrinter(std::string msg
);
152 * Print a common message to stdout.
153 * Note that these messages can't be shut off.
157 msgPrinter(std::string msg
);
160 * Print a debug message.
164 debugPrinter(std::string msg
);
170 static Printer fatal
;
175 static Printer error
;
178 * The warning stream.
180 static Printer warning
;
190 static Printer debug
;
192 static const int FATAL
= 1;
193 static const int ERROR
= 2;
194 static const int WARNING
= 4;
195 static const int DEBUG
= 8;
196 static const int MSG
= 16; // only used internally
198 static const char endl
= '\n';
204 * @return The current mode flags.
211 * @param newflags The new mode flags.
214 setFlags(int newflags
);