FACT++  1.0
void WindowLog::AddAttr ( int  m)
private

Add attributes to the stream according to the attribute. If fWindow is not set this is an ANSI code, otherwise the window's output attributes are set. It is also added to the backlog. Access to the backlog is encapsulated into its mutex.

Definition at line 362 of file WindowLog.cc.

References kReset.

Referenced by operator<<().

363 {
364  if (!fWindow)
365  // We don't have to flush here, because the attributes are simply
366  // part of the stream
367  *this << GetAnsiAttr(m);
368  else
369  {
370  // Before we change the attributes we have to flush the screen
371  // otherwise we would have to buffer them until we flush the
372  // contents
373  flush();
374  m==kReset ? wattrset(fWindow, 0) : wattron(fWindow, m);
375  }
376 
377  fMuxBacklog.lock();
378  m==kReset ?
379  fAttributes[fBacklog.size()] = -1 :
380  fAttributes[fBacklog.size()] |= m;
381  fMuxBacklog.unlock();
382 }
std::vector< char > fBacklog
Pointer to an ncurses Window.
Definition: WindowLog.h:65
static std::string GetAnsiAttr(int m)
Definition: WindowLog.cc:301
WINDOW * fWindow
Pointer to end of buffer.
Definition: WindowLog.h:63
std::map< int, int > fAttributes
Backlog storage.
Definition: WindowLog.h:66
std::mutex fMuxBacklog
Switch to toggle storage in the backlog on or off.
Definition: WindowLog.h:73
Reset all attributes.
Definition: WindowLog.h:29

+ Here is the caller graph for this function: