* introduce globalWarningStream()
This commit is contained in:
parent
5bf0dd5243
commit
45a38ae48e
|
|
@ -96,6 +96,14 @@ inline TextOutputStream& globalOutputStream(){
|
|||
return GlobalOutputStream::instance().getOutputStream();
|
||||
}
|
||||
|
||||
class WarningStreamHolder : public OutputStreamHolder {};
|
||||
typedef Static<WarningStreamHolder> GlobalWarningStream;
|
||||
|
||||
/// \brief Returns the global warning stream. Used to display warning messages to the user.
|
||||
inline TextOutputStream& globalWarningStream(){
|
||||
return GlobalWarningStream::instance().getOutputStream();
|
||||
}
|
||||
|
||||
class ErrorStreamHolder : public OutputStreamHolder {};
|
||||
typedef Static<ErrorStreamHolder> GlobalErrorStream;
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ virtual void setError( bool error ) = 0;
|
|||
virtual bool getError() const = 0;
|
||||
|
||||
virtual TextOutputStream& getOutputStream() = 0;
|
||||
virtual TextOutputStream& getWarningStream() = 0;
|
||||
virtual TextOutputStream& getErrorStream() = 0;
|
||||
virtual DebugMessageHandler& getDebugMessageHandler() = 0;
|
||||
|
||||
|
|
@ -99,6 +100,7 @@ inline ModuleServer& globalModuleServer(){
|
|||
|
||||
inline void initialiseModule( ModuleServer& server ){
|
||||
GlobalErrorStream::instance().setOutputStream( server.getErrorStream() );
|
||||
GlobalWarningStream::instance().setOutputStream( server.getWarningStream() );
|
||||
GlobalOutputStream::instance().setOutputStream( server.getOutputStream() );
|
||||
GlobalDebugMessageHandler::instance().setHandler( server.getDebugMessageHandler() );
|
||||
GlobalModuleServer::instance().set( server );
|
||||
|
|
|
|||
|
|
@ -253,12 +253,26 @@ std::size_t write( const char* buffer, std::size_t length ){
|
|||
}
|
||||
};
|
||||
|
||||
class SysPrintWarningStream : public TextOutputStream
|
||||
{
|
||||
public:
|
||||
std::size_t write( const char* buffer, std::size_t length ){
|
||||
return Sys_Print( SYS_WRN, buffer, length );
|
||||
}
|
||||
};
|
||||
|
||||
SysPrintOutputStream g_outputStream;
|
||||
|
||||
TextOutputStream& getSysPrintOutputStream(){
|
||||
return g_outputStream;
|
||||
}
|
||||
|
||||
SysPrintWarningStream g_warningStream;
|
||||
|
||||
TextOutputStream& getSysPrintWarningStream(){
|
||||
return g_warningStream;
|
||||
}
|
||||
|
||||
SysPrintErrorStream g_errorStream;
|
||||
|
||||
TextOutputStream& getSysPrintErrorStream(){
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
std::size_t Sys_Print( int level, const char* buf, std::size_t length );
|
||||
class TextOutputStream;
|
||||
TextOutputStream& getSysPrintOutputStream();
|
||||
TextOutputStream& getSysPrintWarningStream();
|
||||
TextOutputStream& getSysPrintErrorStream();
|
||||
|
||||
typedef struct _GtkWidget GtkWidget;
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ typedef Static<PopupDebugMessageHandler> GlobalPopupDebugMessageHandler;
|
|||
|
||||
void streams_init(){
|
||||
GlobalErrorStream::instance().setOutputStream( getSysPrintErrorStream() );
|
||||
GlobalWarningStream::instance().setOutputStream( getSysPrintWarningStream() );
|
||||
GlobalOutputStream::instance().setOutputStream( getSysPrintOutputStream() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ bool getError() const {
|
|||
TextOutputStream& getOutputStream(){
|
||||
return globalOutputStream();
|
||||
}
|
||||
TextOutputStream& getWarningStream(){
|
||||
return globalWarningStream();
|
||||
}
|
||||
TextOutputStream& getErrorStream(){
|
||||
return globalErrorStream();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user