SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
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 ()
 
 LogWidget (const LogWidget &)=delete
 
const LogWidgetoperator= (const LogWidget &)=delete
 
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

WINDOWm_pad
 
WINDOWm_scroll
 
int m_display_height
 
int m_display_width
 
int m_display_y
 
int m_display_x
 
int m_written_lines = 0
 
int m_active_line = 0
 
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 301 of file ProgressNCurses.cpp.

Constructor & Destructor Documentation

◆ LogWidget() [1/2]

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 338 of file ProgressNCurses.cpp.

References m_pad.

◆ ~LogWidget()

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

Destructor

Definition at line 349 of file ProgressNCurses.cpp.

References m_pad, and m_scroll.

◆ LogWidget() [2/2]

SourceXtractor::LogWidget::LogWidget ( const LogWidget & )
delete

Member Function Documentation

◆ drawLog()

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

Draw log lines

Definition at line 489 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:

◆ drawScroll()

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

Draw scroll marker

Definition at line 463 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:

◆ getText()

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

Dump into a vector the content of the buffer

Definition at line 442 of file ProgressNCurses.cpp.

References m_display_width, m_pad, and m_written_lines.

◆ handleKeyPress()

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

Handle key presses (scrolling)

Definition at line 420 of file ProgressNCurses.cpp.

References scrollText().

Here is the call graph for this function:

◆ operator=()

const LogWidget & SourceXtractor::LogWidget::operator= ( const LogWidget & )
delete

◆ resize()

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

Update the screen size

Definition at line 384 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:

◆ scrollText()

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 402 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:

◆ write()

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

Write into the widget

Definition at line 360 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::pipeToLog().

Here is the call graph for this function:

Member Data Documentation

◆ BUFFER_INCREASE_STEP_SIZE

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

Definition at line 318 of file ProgressNCurses.cpp.

Referenced by write().

◆ BUFFER_MAX_SIZE

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

Definition at line 319 of file ProgressNCurses.cpp.

Referenced by write().

◆ m_active_line

int SourceXtractor::LogWidget::m_active_line = 0
private

Definition at line 313 of file ProgressNCurses.cpp.

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

◆ m_display_height

int SourceXtractor::LogWidget::m_display_height
private

Definition at line 306 of file ProgressNCurses.cpp.

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

◆ m_display_width

int SourceXtractor::LogWidget::m_display_width
private

Definition at line 307 of file ProgressNCurses.cpp.

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

◆ m_display_x

int SourceXtractor::LogWidget::m_display_x
private

Definition at line 309 of file ProgressNCurses.cpp.

Referenced by drawLog(), and drawScroll().

◆ m_display_y

int SourceXtractor::LogWidget::m_display_y
private

Definition at line 308 of file ProgressNCurses.cpp.

Referenced by drawLog(), and drawScroll().

◆ m_pad

WINDOW* SourceXtractor::LogWidget::m_pad
private

Definition at line 303 of file ProgressNCurses.cpp.

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

◆ m_scroll

WINDOW* SourceXtractor::LogWidget::m_scroll
private

Definition at line 304 of file ProgressNCurses.cpp.

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

◆ m_scroll_bar_color

int SourceXtractor::LogWidget::m_scroll_bar_color
private

Definition at line 315 of file ProgressNCurses.cpp.

Referenced by drawScroll().

◆ m_scroll_ind_color

int SourceXtractor::LogWidget::m_scroll_ind_color
private

Definition at line 316 of file ProgressNCurses.cpp.

Referenced by drawScroll().

◆ m_written_lines

int SourceXtractor::LogWidget::m_written_lines = 0
private

Definition at line 311 of file ProgressNCurses.cpp.

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


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