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