1
/*************************************************************************
4
** This file is part of dvisvgm -- the DVI to SVG converter **
5
** Copyright (C) 2005-2014 Martin Gieseking <martin.gieseking@uos.de> **
7
** This program is free software; you can redistribute it and/or **
8
** modify it under the terms of the GNU General Public License as **
9
** published by the Free Software Foundation; either version 3 of **
10
** the License, or (at your option) any later version. **
12
** This program is distributed in the hope that it will be useful, but **
13
** WITHOUT ANY WARRANTY; without even the implied warranty of **
14
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
15
** GNU General Public License for more details. **
17
** You should have received a copy of the GNU General Public License **
18
** along with this program; if not, see <http://www.gnu.org/licenses/>. **
19
*************************************************************************/
21
#ifndef DVISVGM_MESSAGE_H
22
#define DVISVGM_MESSAGE_H
40
MessageStream (std::ostream &os);
44
MessageStream& operator << (const T &obj) {
45
std::ostringstream oss;
51
MessageStream& operator << (const char *str);
52
MessageStream& operator << (const char &c);
53
MessageStream& operator << (const std::string &str) {return (*this) << str.c_str();}
55
void indent (int level) {_indent = std::max(0, level*2);}
56
void indent (bool reset=false);
57
void outdent (bool all=false);
61
void putChar (const char c, std::ostream &os);
62
std::ostream* os () {return _os;}
66
bool _nl; ///< true if previous character was a newline
67
int _col; ///< current terminal column
68
int _indent; ///< indentation width (number of columns/characters)
75
Color () : foreground(-1), background(-1) {}
76
Color (Int8 fgcolor) : foreground(fgcolor), background(-1) {}
77
Color (Int8 fgcolor, bool light) : foreground(fgcolor + (light ? 8 : 0)), background(-1) {}
78
Color (Int8 fgcolor, Int8 bgcolor) : foreground(fgcolor), background(bgcolor) {}
97
static MessageStream& mstream (bool prefix=false, MessageClass mclass=MC_MESSAGE);
98
static MessageStream& estream (bool prefix=false);
99
static MessageStream& wstream (bool prefix=false);
101
enum {ERRORS=1, WARNINGS=2, MESSAGES=4};
103
static bool COLORIZE;
110
static Color _classColors[];
111
static bool _initialized;