Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::LineBuffer Class Reference

Special std::streambuf class for capturing lines. More...

#include <LineBuffer.h>

Inheritance diagram for sf::LineBuffer:
Collaboration diagram for sf::LineBuffer:

Public Types

typedef TClosure< void, LineBuffer *, const std::string * > handler_type
 Closure handler type to handle buffer changes. When the std:string line argument is a nullptr the buffer it signals clearing the viewer.
 

Public Member Functions

 LineBuffer (unsigned max_lines)
 Constructor settings the maximum lines the buffer can hold.
 
 ~LineBuffer () override
 Overridden virtual destructor.
 
std::string getLine (unsigned line) const
 Returns requested line in the buffer.
 
int lineCount () const
 
int totalLineCount () const
 Returns the total lines passed through the fifo buffer.
 
void clear ()
 
void setMaxLines (unsigned max_lines)
 Sets the maximum lines the stream can hold. Flushes all lines first.
 
void setNewLineHandler (const handler_type &event)
 When a new line is added this event is triggered.
 
const handler_typenewLineHandler ()
 Returns the new line handler.
 

Static Public Attributes

static constexpr std::streambuf::char_type clearChar = '\x12'
 Character which clears the buffer when it is encountered.
 

Detailed Description

Special std::streambuf class for capturing lines.

Member Typedef Documentation

◆ handler_type

typedef TClosure<void, LineBuffer* , const std::string* > sf::LineBuffer::handler_type

Closure handler type to handle buffer changes. When the std:string line argument is a nullptr the buffer it signals clearing the viewer.

Constructor & Destructor Documentation

◆ LineBuffer()

sf::LineBuffer::LineBuffer ( unsigned  max_lines)
explicit

Constructor settings the maximum lines the buffer can hold.

◆ ~LineBuffer()

sf::LineBuffer::~LineBuffer ( )
override

Overridden virtual destructor.

Member Function Documentation

◆ clear()

void sf::LineBuffer::clear ( )

Clears the current line buffer.

◆ getLine()

std::string sf::LineBuffer::getLine ( unsigned  line) const

Returns requested line in the buffer.

◆ lineCount()

int sf::LineBuffer::lineCount ( ) const

Returns the amount of lines in the buffer.

◆ newLineHandler()

const handler_type & sf::LineBuffer::newLineHandler ( )

Returns the new line handler.

Returns
the Handler.

◆ setMaxLines()

void sf::LineBuffer::setMaxLines ( unsigned  max_lines)

Sets the maximum lines the stream can hold. Flushes all lines first.

◆ setNewLineHandler()

void sf::LineBuffer::setNewLineHandler ( const handler_type event)

When a new line is added this event is triggered.

◆ totalLineCount()

int sf::LineBuffer::totalLineCount ( ) const

Returns the total lines passed through the fifo buffer.

Member Data Documentation

◆ clearChar

constexpr std::streambuf::char_type sf::LineBuffer::clearChar = '\x12'
staticconstexpr

Character which clears the buffer when it is encountered.


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