FACT++  1.0
WindowLog Class Reference

A C++ ostream to an ncurses window supporting attributes and colors. More...

#include <WindowLog.h>

+ Inheritance diagram for WindowLog:
+ Collaboration diagram for WindowLog:

Public Member Functions

 WindowLog ()
 
 WindowLog (WindowLog const &log)
 
 ~WindowLog ()
 
void SetWindow (WINDOW *w)
 Redirect the output to an ncurses WINDOW instead of cout. More...
 
bool OpenLogFile (const std::string &filename, bool append=false)
 Open a log-file. More...
 
void CloseLogFile ()
 Close a log-file. More...
 
void Display (bool empty=false)
 Display backlog. More...
 
void EmptyBacklog ()
 Empty backlog. More...
 
size_t GetSizeBacklog () const
 Get the current size of the backlog in bytes. More...
 
std::string GetSizeStr () const
 
void SetNullOutput (bool n=true)
 Switch on or off any physical output to the screen (cout or fWindow) More...
 
bool GetNullOutput () const
 
void SetBacklog (bool n=true)
 Switch on or off any storage in the backlog. More...
 
bool GetBacklog () const
 

Private Member Functions

void AddAttr (int m)
 
void AddColor (int m)
 
bool WriteFile (const std::string &)
 
void WriteBuffer ()
 
int sync ()
 This is called to flush the buffer of the streaming devices. More...
 
int overflow (int i)
 

Static Private Member Functions

static std::string GetAnsiAttr (int m)
 

Private Attributes

char fBuffer
 
char fBase [fgBufferSize+1]
 
char * fPPtr
 Buffer to store the data in. More...
 
const char * fEPtr
 Pointer to present position in buffer. More...
 
WINDOWfWindow
 Pointer to end of buffer. More...
 
std::vector< char > fBacklog
 Pointer to an ncurses Window. More...
 
std::map< int, int > fAttributes
 Backlog storage. More...
 
std::ofstream fLogFile
 Storage for attributes (backlog) More...
 
bool fIsNull
 Stream for redirection to a log-file. More...
 
bool fEnableBacklog
 Switch to toggle off physical output to the screen. More...
 
std::mutex fMuxBacklog
 Switch to toggle storage in the backlog on or off. More...
 
std::mutex fMuxFile
 Mutex securing backlog access. More...
 
std::mutex fMuxCout
 Mutex securing file access. More...
 
std::mutex fMuxWindow
 Mutex securing output to cout. More...
 
Queue< std::string > fQueueFile
 Mutex securing output to fWindow. More...
 

Static Private Attributes

static const int fgBufferSize = 160
 

Friends

std::ostream & operator<< (std::ostream &lout, WindowLogColor m)
 
std::ostream & operator<< (std::ostream &lout, WindowLogAttrs m)
 

Detailed Description

A C++ ostream to an ncurses window supporting attributes and colors.

References

Todo:
improve docu
Examples:
chatserv.cc.

Definition at line 50 of file WindowLog.h.


The documentation for this class was generated from the following files: