SourceXtractorPlusPlus  0.14
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SourceXtractor::LogWidget Class Reference

Public Member Functions

 LogWidget (int display_height, int display_width, int display_y, int display_x, short bar_color, short ind_color)
 
virtual ~LogWidget ()
 
void write (const char *data, ssize_t nchars)
 
void resize (int display_height, int display_width)
 
void scrollText (int d)
 
void handleKeyPress (int key)
 
std::vector< std::stringgetText ()
 

Private Member Functions

void drawScroll () const
 
void drawLog () const
 

Private Attributes

WINDOW * m_pad
 
WINDOW * m_scroll
 
int m_display_height
 
int m_display_width
 
int m_display_y
 
int m_display_x
 
int m_written_lines
 
int m_active_line
 
int m_scroll_bar_color
 
int m_scroll_ind_color
 

Static Private Attributes

static const int BUFFER_INCREASE_STEP_SIZE = 10
 
static const int BUFFER_MAX_SIZE = 16384
 

Detailed Description

Widget into which the logging is redirected

Definition at line 297 of file ProgressNCurses.cpp.

Constructor & Destructor Documentation

SourceXtractor::LogWidget::LogWidget ( int  display_height,
int  display_width,
int  display_y,
int  display_x,
short  bar_color,
short  ind_color 
)
inline

Constructor

Parameters
display_heightDisplayed height on the screen. The actual pad height is handled internally.
display_widthDisplayed width on the screen.
display_yY position on the screen.
display_xX position on the screen.
bar_colorColor for the progress bar
ind_colorColor for the bar indicator

Definition at line 329 of file ProgressNCurses.cpp.

References m_pad.

virtual SourceXtractor::LogWidget::~LogWidget ( )
inlinevirtual

Destructor

Definition at line 340 of file ProgressNCurses.cpp.

References m_pad, and m_scroll.

Member Function Documentation

void SourceXtractor::LogWidget::drawLog ( ) const
inlineprivate

Draw log lines

Definition at line 473 of file ProgressNCurses.cpp.

References m_active_line, m_display_height, m_display_width, m_display_x, m_display_y, m_pad, and std::max().

Referenced by resize(), scrollText(), and write().

Here is the call graph for this function:

void SourceXtractor::LogWidget::drawScroll ( ) const
inlineprivate

Draw scroll marker

Definition at line 448 of file ProgressNCurses.cpp.

References m_active_line, m_display_height, m_display_width, m_display_x, m_display_y, m_scroll, m_scroll_bar_color, m_scroll_ind_color, m_written_lines, std::max(), and std::min().

Referenced by resize(), scrollText(), and write().

Here is the call graph for this function:

std::vector<std::string> SourceXtractor::LogWidget::getText ( )
inline

Dump into a vector the content of the buffer

Definition at line 427 of file ProgressNCurses.cpp.

References std::vector< T >::back(), std::vector< T >::data(), std::vector< T >::emplace_back(), std::string::empty(), std::vector< T >::empty(), m_display_width, m_pad, m_written_lines, and std::vector< T >::pop_back().

Here is the call graph for this function:

void SourceXtractor::LogWidget::handleKeyPress ( int  key)
inline

Handle key presses (scrolling)

Definition at line 407 of file ProgressNCurses.cpp.

References scrollText().

Referenced by SourceXtractor::ProgressNCurses::Dashboard::handleKeyPress().

Here is the call graph for this function:

void SourceXtractor::LogWidget::resize ( int  display_height,
int  display_width 
)
inline

Update the screen size

Definition at line 371 of file ProgressNCurses.cpp.

References drawLog(), drawScroll(), m_display_height, m_display_width, m_pad, and m_scroll.

Here is the call graph for this function:

void SourceXtractor::LogWidget::scrollText ( int  d)
inline

Allow to scroll the pad

Note
Scroll is a ncurses macro, so we can not use it as a name :(

Definition at line 389 of file ProgressNCurses.cpp.

References drawLog(), drawScroll(), m_active_line, m_display_height, m_pad, and m_written_lines.

Referenced by handleKeyPress().

Here is the call graph for this function:

void SourceXtractor::LogWidget::write ( const char *  data,
ssize_t  nchars 
)
inline

Write into the widget

Definition at line 348 of file ProgressNCurses.cpp.

References BUFFER_INCREASE_STEP_SIZE, BUFFER_MAX_SIZE, drawLog(), drawScroll(), m_active_line, m_display_width, m_pad, m_written_lines, and std::min().

Referenced by SourceXtractor::ProgressNCurses::Dashboard::handleSignal(), and SourceXtractor::ProgressNCurses::Dashboard::pipeToLog().

Here is the call graph for this function:

Member Data Documentation

const int SourceXtractor::LogWidget::BUFFER_INCREASE_STEP_SIZE = 10
staticprivate

Definition at line 310 of file ProgressNCurses.cpp.

Referenced by write().

const int SourceXtractor::LogWidget::BUFFER_MAX_SIZE = 16384
staticprivate

Definition at line 310 of file ProgressNCurses.cpp.

Referenced by write().

int SourceXtractor::LogWidget::m_active_line
private

Definition at line 306 of file ProgressNCurses.cpp.

Referenced by drawLog(), drawScroll(), scrollText(), and write().

int SourceXtractor::LogWidget::m_display_height
private

Definition at line 301 of file ProgressNCurses.cpp.

Referenced by drawLog(), drawScroll(), resize(), and scrollText().

int SourceXtractor::LogWidget::m_display_width
private

Definition at line 301 of file ProgressNCurses.cpp.

Referenced by drawLog(), drawScroll(), getText(), resize(), and write().

int SourceXtractor::LogWidget::m_display_x
private

Definition at line 302 of file ProgressNCurses.cpp.

Referenced by drawLog(), and drawScroll().

int SourceXtractor::LogWidget::m_display_y
private

Definition at line 302 of file ProgressNCurses.cpp.

Referenced by drawLog(), and drawScroll().

WINDOW* SourceXtractor::LogWidget::m_pad
private

Definition at line 299 of file ProgressNCurses.cpp.

Referenced by drawLog(), getText(), LogWidget(), resize(), scrollText(), write(), and ~LogWidget().

WINDOW * SourceXtractor::LogWidget::m_scroll
private

Definition at line 299 of file ProgressNCurses.cpp.

Referenced by drawScroll(), resize(), and ~LogWidget().

int SourceXtractor::LogWidget::m_scroll_bar_color
private

Definition at line 308 of file ProgressNCurses.cpp.

Referenced by drawScroll().

int SourceXtractor::LogWidget::m_scroll_ind_color
private

Definition at line 308 of file ProgressNCurses.cpp.

Referenced by drawScroll().

int SourceXtractor::LogWidget::m_written_lines
private

Definition at line 304 of file ProgressNCurses.cpp.

Referenced by drawScroll(), getText(), scrollText(), and write().


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