#include </home/zeitlin/src/wx/github/interface/wx/msgout.h>
Simple class allowing to write strings to various output channels.
wxMessageOutput is a low-level class and doesn't provide any of the conveniences of wxLog. It simply allows to write a message to some output channel: usually file or standard error but possibly also a message box. While use of wxLog and related functions is preferable in many cases sometimes this simple interface may be more convenient.
This class itself is an abstract base class for various concrete derived classes:
It also provides access to the global message output object which is created by wxAppTraits::CreateMessageOutput() which creates an object of class wxMessageOutputStderr in console applications and wxMessageOutputBest in the GUI ones but may be overridden in user-defined traits class.
Example of using this class:
wxMessageOutputDebug().Printf("name=%s, preparing to greet...", name); wxMessageOutput::Get()->Printf("Hello, %s!", name);
Public Member Functions | |
void | Printf (const wxString &format,...) |
Output a message. | |
virtual void | Output (const wxString &str)=0 |
Method called by Printf() to really output the text. | |
Static Public Member Functions | |
static wxMessageOutput * | Get () |
Return the global message output object. | |
static wxMessageOutput * | Set (wxMessageOutput *msgout) |
Sets the global message output object. |
static wxMessageOutput* wxMessageOutput::Get | ( | ) | [static] |
virtual void wxMessageOutput::Output | ( | const wxString & | str | ) | [pure virtual] |
Method called by Printf() to really output the text.
This method is overridden in various derived classes and is also the one you should override if you implement a custom message output object.
It may also be called directly instead of Printf(). This is especially useful when outputting a user-defined string because it can be simply called with this string instead of using
msgout.Printf("%s", str);
(notice that passing user-defined string to Printf() directly is, of course, a security risk).
void wxMessageOutput::Printf | ( | const wxString & | format, |
... | |||
) |
Output a message.
This function uses the same conventions as standard printf()
.
static wxMessageOutput* wxMessageOutput::Set | ( | wxMessageOutput * | msgout | ) | [static] |
Sets the global message output object.
Using this function may be a simpler alternative to changing the message output object used for your program than overriding wxAppTraits::CreateMessageOutput().
Remember to delete the returned pointer or restore it later with another call to Set().