84 void inform(std::string msg,
bool addType =
true);
131 inline std::string
build(
const std::string& msg,
bool addType) {
137 return "Warning: " + msg;
140 return "Error: " + msg;
200 #define WRITE_WARNING(msg) MsgHandler::getWarningInstance()->inform(msg); 201 #define WRITE_MESSAGE(msg) MsgHandler::getMessageInstance()->inform(msg); 202 #define PROGRESS_BEGIN_MESSAGE(msg) MsgHandler::getMessageInstance()->beginProcessMsg((msg) + std::string("...")); 203 #define PROGRESS_DONE_MESSAGE() MsgHandler::getMessageInstance()->endProcessMsg("done."); 204 #define PROGRESS_TIME_MESSAGE(before) MsgHandler::getMessageInstance()->endProcessMsg("done (" + toString(SysUtils::getCurrentMillis() - before) + "ms)."); 205 #define PROGRESS_FAILED_MESSAGE() MsgHandler::getMessageInstance()->endProcessMsg("failed."); 206 #define WRITE_ERROR(msg) MsgHandler::getErrorInstance()->inform(msg); bool isRetriever(OutputDevice *retriever) const
Returns whether the given output device retrieves messages from the handler.
MsgHandler & operator<<(const T &t)
Generic output operator.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
std::vector< OutputDevice * > RetrieverVector
Definition of the list of retrievers to inform.
The message is only something to show.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
MsgType myType
The type of the instance.
MsgHandler(MsgType type)
standard constructor
MsgHandler & operator=(const MsgHandler &s)
static MsgHandler * myWarningInstance
The instance to handle warnings.
An abstract class for encapsulating mutex implementations.
void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
static void assignLock(AbstractMutex *lock)
Sets the lock to use The lock will not be deleted.
RetrieverVector myRetrievers
The list of retrievers that shall be informed about new messages or errors.
static void cleanupOnEnd()
Removes pending handler.
static AbstractMutex * myLock
The lock if any has to be used The lock will not be deleted.
void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
bool wasInformed() const
Returns the information whether any messages were added.
void beginProcessMsg(std::string msg, bool addType=true)
Begins a process information.
The message is a warning.
static MsgHandler * myMessageInstance
The instance to handle normal messages.
static bool myAmProcessingProcess
Information whether a process information is printed to cout.
void inform(std::string msg, bool addType=true)
adds a new error to the list
std::string build(const std::string &msg, bool addType)
Builds the string which includes the mml-message type.
bool myWasInformed
information wehther an error occured at all
Static storage of an output device and its base (abstract) implementation.
static MsgHandler * myErrorInstance
The instance to handle errors.
void clear()
Clears information whether an error occured previously.
static void initOutputOptions()
void endProcessMsg(std::string msg)
Ends a process information.