11 #include "../externals/Queue.h" 50 class WindowLog :
public std::streambuf,
public std::ostream
100 WindowLog() :
std::ostream(this), fPPtr(fBase), fEPtr(fBase+fgBufferSize), fWindow(0), fIsNull(false), fEnableBacklog(true),
104 setp(&fBuffer, &fBuffer+1);
114 fQueueFile.
wait(
false);
121 bool OpenLogFile(
const std::string &filename,
bool append=
false);
127 void Display(
bool empty=
false);
std::mutex fMuxFile
Mutex securing backlog access.
Queue< std::string > fQueueFile
Mutex securing output to fWindow.
bool WriteFile(const std::string &)
std::vector< char > fBacklog
Pointer to an ncurses Window.
Set attribute Alternative charset.
bool fEnableBacklog
Switch to toggle off physical output to the screen.
static std::string GetAnsiAttr(int m)
std::mutex fMuxCout
Mutex securing file access.
WindowLog(WindowLog const &log)
void SetNullOutput(bool n=true)
Switch on or off any physical output to the screen (cout or fWindow)
void CloseLogFile()
Close a log-file.
char * fPPtr
Buffer to store the data in.
A C++ ostream to an ncurses window supporting attributes and colors.
void EmptyBacklog()
Empty backlog.
static const int fgBufferSize
WINDOW * fWindow
Pointer to end of buffer.
friend std::ostream & operator<<(std::ostream &lout, WindowLogColor m)
WindowLogColor
Stream manipulators to change the color of a WindowLog stream.
size_t GetSizeBacklog() const
Get the current size of the backlog in bytes.
int sync()
This is called to flush the buffer of the streaming devices.
std::string GetSizeStr() const
const char * fEPtr
Pointer to present position in buffer.
std::map< int, int > fAttributes
Backlog storage.
bool wait(bool abrt=false)
std::mutex fMuxBacklog
Switch to toggle storage in the backlog on or off.
bool fIsNull
Stream for redirection to a log-file.
char fBase[fgBufferSize+1]
void SetWindow(WINDOW *w)
Redirect the output to an ncurses WINDOW instead of cout.
std::mutex fMuxWindow
Mutex securing output to cout.
std::ofstream fLogFile
Storage for attributes (backlog)
void Display(bool empty=false)
Display backlog.
bool GetNullOutput() const
WindowLogAttrs
Stream manipulators to change the attributes of a WindowLog stream.
bool OpenLogFile(const std::string &filename, bool append=false)
Open a log-file.
void SetBacklog(bool n=true)
Switch on or off any storage in the backlog.