114 virtual void inform(std::string msg,
bool addType =
true);
129 virtual void clear();
157 inline std::string
build(
const std::string& msg,
bool addType) {
163 return "Warning: " + msg;
166 return "Error: " + msg;
169 return "Debug: " + msg;
172 return "GLDebug: " + msg;
239 #define WRITE_WARNING(msg) MsgHandler::getWarningInstance()->inform(msg); 240 #define WRITE_MESSAGE(msg) MsgHandler::getMessageInstance()->inform(msg); 241 #define PROGRESS_BEGIN_MESSAGE(msg) MsgHandler::getMessageInstance()->beginProcessMsg((msg) + std::string("...")); 242 #define PROGRESS_DONE_MESSAGE() MsgHandler::getMessageInstance()->endProcessMsg("done."); 243 #define PROGRESS_TIME_MESSAGE(before) MsgHandler::getMessageInstance()->endProcessMsg("done (" + toString(SysUtils::getCurrentMillis() - before) + "ms)."); 244 #define PROGRESS_FAILED_MESSAGE() MsgHandler::getMessageInstance()->endProcessMsg("failed."); 245 #define WRITE_ERROR(msg) MsgHandler::getErrorInstance()->inform(msg); 246 #define WRITE_DEBUG(msg) if(MsgHandler::writeDebugMessages()){MsgHandler::getDebugInstance()->inform(msg);}; 247 #define WRITE_GLDEBUG(msg) if(MsgHandler::writeDebugGLMessages()){MsgHandler::getGLDebugInstance()->inform(msg);}; MsgHandler & operator<<(const T &t)
Generic output operator.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
The message is only something to show.
static bool myWriteDebugGLMessages
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
MsgType myType
The type of the instance.
bool isRetriever(OutputDevice *retriever) const
Returns whether the given output device retrieves messages from the handler.
MsgHandler(MsgType type)
standard constructor
static MsgHandler * getGLDebugInstance()
Returns the instance to add GLdebug to.
static MsgHandler * myDebugInstance
The instance to handle debug.
static MsgHandler * myWarningInstance
The instance to handle warnings.
static bool writeDebugGLMessages()
check whether to enable/disable gl-debug messages
virtual void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
bool wasInformed() const
Returns the information whether any messages were added.
static void removeRetrieverFromAllInstances(OutputDevice *out)
ensure that that given output device is no longer used as retriever by any instance ...
static Factory myFactory
The function to call for new MsgHandlers, nullptr means use default constructor.
static bool myWriteDebugMessages
Flag to enable or disable debug GL Functions.
static void cleanupOnEnd()
Removes pending handler.
static MsgHandler * myGLDebugInstance
The instance to handle glDebug.
virtual ~MsgHandler()
destructor
static MsgHandler * getDebugInstance()
Returns the instance to add debug to.
virtual void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
virtual void beginProcessMsg(std::string msg, bool addType=true)
Begins a process information.
The message is a warning.
std::vector< OutputDevice * > myRetrievers
The list of retrievers that shall be informed about new messages or errors.
static bool writeDebugMessages()
check whether to enable/disable debug messages
static MsgHandler * myMessageInstance
The instance to handle normal messages.
static bool myAmProcessingProcess
Information whether a process information is printed to cout.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
MsgHandler & operator=(const MsgHandler &s)=delete
invalid assignment operator
std::string build(const std::string &msg, bool addType)
Builds the string which includes the mml-message type.
bool myWasInformed
information wehther an error occurred at all
static void enableDebugGLMessages(bool enable)
enable/disable gl-debug messages
static void enableDebugMessages(bool enable)
enable/disable debug messages
Static storage of an output device and its base (abstract) implementation.
static void setFactory(Factory func)
Sets the factory function to use for new MsgHandlers.
static MsgHandler * myErrorInstance
The instance to handle errors.
virtual void clear()
Clears information whether an error occurred previously.
static void initOutputOptions()
init output options
MsgHandler *(* Factory)(MsgType)
virtual void endProcessMsg(std::string msg)
Ends a process information.