Planeshift
consoleout.h
Go to the documentation of this file.
1 /*
2  * consoleout.h - author: Matze Braun <matze@braunis.de>
3  *
4  * Copyright (C) 2001 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 #ifndef __CONSOLEOUT_H__
20 #define __CONSOLEOUT_H__
21 
22 #include <stdarg.h>
23 
24 #include <csutil/csstring.h>
25 
30 extern FILE * errorLog;
31 
36 {
37  CON_NONE = 0, // No output.
38  CON_CMDOUTPUT, // Used for server command output. Is always displayed.
39  CON_BUG, // A bug. Very important to show.
40  CON_ERROR, // Error
41  CON_WARNING, // Warning
42  CON_NOTIFY, // Notification
43  CON_DEBUG, // Debugging message
44  CON_SPAM // High volume spam used for detailed logging
45 };
46 
51 {
52 public:
56  static void Intern_Printf(ConsoleOutMsgClass con, const char *arg, ...);
57 
61  static void Intern_VPrintf(ConsoleOutMsgClass con, const char *arg, va_list ap);
62 
68  const char *arg, ...);
69 
75  const char *arg, va_list args);
76 
82  static void SetOutputFile (const char* filename, bool append);
83 
90 
97 
103  static void SetStringBuffer(csString *buffer)
104  {
105  strBuffer = buffer;
106  if (buffer)
107  buffer->Clear();
108  }
109 
113  static void SetPrompt(const char*format, ...);
114 
117 
118  static void Shift();
119  static void Unshift();
120 
121  static int shift;
122  static csString *strBuffer;
123  static bool atStartOfLine;
124  static bool promptDisplayed;
125 };
126 
130 #define CPrintf ConsoleOut::Intern_Printf
131 #define CVPrintf ConsoleOut::Intern_VPrintf
132 #define CPrintfLog ConsoleOut::Intern_Printf_LogOnly
133 #define CVPrintfLog ConsoleOut::Intern_VPrintf_LogOnly
134 #define CShift ConsoleOut::Shift
135 #define CUnshift ConsoleOut::Unshift
136 #define CPrompt ConsoleOut::SetPrompt
137 
140 #endif
141 
static void Intern_Printf(ConsoleOutMsgClass con, const char *arg,...)
Used to print things to the console.
static void Unshift()
static bool atStartOfLine
Definition: consoleout.h:123
static void SetMaximumOutputClassFile(ConsoleOutMsgClass con)
Set the maximum message class that we want to show on the output file.
static int shift
Definition: consoleout.h:121
static bool promptDisplayed
Definition: consoleout.h:124
static void SetMaximumOutputClassStdout(ConsoleOutMsgClass con)
Set the maximum message class that we want to show on standard output.
static void Shift()
static void Intern_VPrintf_LogOnly(ConsoleOutMsgClass con, const char *arg, va_list args)
Used to print things to the console.
static ConsoleOutMsgClass GetMaximumOutputClassStdout()
static ConsoleOutMsgClass GetMaximumOutputClassFile()
static void Intern_Printf_LogOnly(ConsoleOutMsgClass con, const char *arg,...)
Used to print things to the console.
Simple static class for controlled user output.
Definition: consoleout.h:50
static void SetStringBuffer(csString *buffer)
Set or clear the string buffer.
Definition: consoleout.h:103
static void SetOutputFile(const char *filename, bool append)
Setup the console to additionally write to some file instead of only stdout.
static void SetPrompt(const char *format,...)
Set the prompt to be used for stdout.
FILE * errorLog
ConsoleOutMsgClass
Different message classes.
Definition: consoleout.h:35
static void Intern_VPrintf(ConsoleOutMsgClass con, const char *arg, va_list ap)
Used to print things to the console.
static csString * strBuffer
Definition: consoleout.h:122