Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::CaptureListModel Class Referencefinal

List model implementation which can capture output streams from std::cout, std::clog and std::cerr by assigning the stream buffer. The stream buffer can also be used to assign to a custom std::ostream. More...

#include <CaptureListModel.h>

Inheritance diagram for sf::CaptureListModel:
Collaboration diagram for sf::CaptureListModel:

Public Types

enum  StreamSource : unsigned { ssStdCout = 1u << 0u , ssStdClog = 1u << 1u , ssStdCerr = 1u << 2u }
 Stream sources to capture. More...
 

Public Member Functions

 CaptureListModel (QObject *parent=nullptr)
 Constructor.
 
 ~CaptureListModel () override
 Destructor.
 
bool append (const QString &str)
 Append string to the end of the list.
 
std::streambuf * getStreamBuffer () const
 Gets the internal stream buffer. Used for attaching to a std::ostream instance.
 
unsigned setSource (unsigned ss)
 
unsigned source () const
 Reports the stream being captured.
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 Overridden from base class.
 
int rowCount (const QModelIndex &parent) const override
 Overridden from base class.
 
QVariant data (const QModelIndex &index, int role) const override
 Overridden from base class.
 

Detailed Description

List model implementation which can capture output streams from std::cout, std::clog and std::cerr by assigning the stream buffer. The stream buffer can also be used to assign to a custom std::ostream.

auto _capture = CaptureListModel(ui->lvMyListView);
std::ostream os(_capture.getStreamBuffer());
// After construction
os.rdbuf(_capture.getStreamBuffer());
//
os << Write
List model implementation which can capture output streams from std::cout, std::clog and std::cerr by...
Definition CaptureListModel.h:24

Member Enumeration Documentation

◆ StreamSource

Stream sources to capture.

Enumerator
ssStdCout 

Captures the std::cout stream.

ssStdClog 

Captures the std::clog stream.

ssStdCerr 

Captures the std::cerr stream.

Constructor & Destructor Documentation

◆ CaptureListModel()

sf::CaptureListModel::CaptureListModel ( QObject *  parent = nullptr)
explicit

Constructor.

◆ ~CaptureListModel()

sf::CaptureListModel::~CaptureListModel ( )
override

Destructor.

Member Function Documentation

◆ append()

bool sf::CaptureListModel::append ( const QString &  str)

Append string to the end of the list.

◆ data()

QVariant sf::CaptureListModel::data ( const QModelIndex &  index,
int  role 
) const
override

Overridden from base class.

◆ getStreamBuffer()

std::streambuf * sf::CaptureListModel::getStreamBuffer ( ) const

Gets the internal stream buffer. Used for attaching to a std::ostream instance.

◆ headerData()

QVariant sf::CaptureListModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

Overridden from base class.

◆ rowCount()

int sf::CaptureListModel::rowCount ( const QModelIndex &  parent) const
override

Overridden from base class.

◆ setSource()

unsigned sf::CaptureListModel::setSource ( unsigned  ss)

Sets the Std stream to be captured.

◆ source()

unsigned sf::CaptureListModel::source ( ) const

Reports the stream being captured.


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