Tracer  v0.0.1
A platform independant stack trace generator
tracer::FilePrinter Class Reference

Prints file contents when line information is avaliable in the frame. More...

#include <FilePrinter.hpp>

+ Inheritance diagram for tracer::FilePrinter:
+ Collaboration diagram for tracer::FilePrinter:

Classes

struct  FileConfig
 User configuration. More...
 

Public Member Functions

fs::path findFile (std::string file)
 Searches a file. More...
 
void setFilePrinterConfig (FileConfig d)
 Sets the new configuration.
 
FileConfig getFilePrinterConfig ()
 Returns the current configuration.
 
- Public Member Functions inherited from tracer::DefaultPrinter
void setConfig (Config newCfg)
 Sets the new config.
 
Config getConfig () const
 Returns the current.
 
- Public Member Functions inherited from tracer::AbstractPrinter
 AbstractPrinter ()
 Default constructor.
 
std::string genStringPreFrame (size_t frameNum)
 Generates a string for the frame information (prefix) More...
 
std::string genStringForFrame (size_t frameNum)
 Generates a string for the frame information. More...
 
std::string genStringPostFrame (size_t frameNum)
 Generates a string for the frame information (suffix) More...
 
std::string generateString ()
 Generates a string for the complete stack trace. More...
 
void printToFile (std::string file, bool append=true)
 Prints the stack trace to a file. More...
 
void printToStdOut ()
 prints the stack trace to STDOUT
 
void printToStdErr ()
 prints the stack trace to STDERR
 
void enableColor ()
 Enables colored output (ANSI escape sequences)
 
void disableColor ()
 Disables colored output (ANSI escape sequences)
 
void setTrace (Tracer *t)
 Sets the trace to print. More...
 

Protected Member Functions

std::string genStringPostFrameIMPL (size_t frameNum) override
 Generate string for the frame info suffix. More...
 
- Protected Member Functions inherited from tracer::DefaultPrinter
std::string genStringForFrameIMPL (size_t frameNum) override
 Generate string for the frame info.
 
void setupTrace () override
 This function will be called when the trace is sets.
 
- Protected Member Functions inherited from tracer::AbstractPrinter
virtual std::string genStringPreFrameIMPL (size_t frameNum)
 Generate string for the frame info prefix. More...
 

Additional Inherited Members

- Protected Attributes inherited from tracer::AbstractPrinter
Tracertrace = nullptr
 Pointer to the trace.
 
bool disableColorB = false
 Whether to disable colored output or not.
 

Detailed Description

Prints file contents when line information is avaliable in the frame.

Definition at line 48 of file FilePrinter.hpp.

Member Function Documentation

◆ findFile()

fs::path FilePrinter::findFile ( std::string  file)

Searches a file.

Parameters
fileThe file to find

Searches the file recursively

Returns
The file if found or an empty path if not

Definition at line 73 of file FilePrinter.cpp.

◆ genStringPostFrameIMPL()

string FilePrinter::genStringPostFrameIMPL ( size_t  frameNum)
overrideprotectedvirtual

Generate string for the frame info suffix.

Default implementation.

Reimplemented from tracer::AbstractPrinter.

Definition at line 118 of file FilePrinter.cpp.


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