GTIRB-PPRINTER  v0.1.1
GrammaTech Intermediate Representation for Binaries: Pretty Printer
Public Member Functions | List of all members
gtirb_pprint::PrettyPrinter Class Reference

#include <PrettyPrinter.h>

Public Member Functions

 PrettyPrinter ()
 Construct a PrettyPrinter with the default configuration. More...
 
 PrettyPrinter (const PrettyPrinter &)=default
 
 PrettyPrinter (PrettyPrinter &&)=default
 
bool getDebug () const
 
const std::set< std::string > & getSkippedFunctions () const
 Set of functions to skip during printing. More...
 
const std::string & getSyntax () const
 Return the syntax that will be used for pretty printing. More...
 
void keepFunction (const std::string &functionName)
 
PrettyPrinteroperator= (const PrettyPrinter &)=default
 
PrettyPrinteroperator= (PrettyPrinter &&)=default
 
std::error_condition print (std::ostream &stream, gtirb::Context &context, gtirb::IR &ir) const
 
void setDebug (bool do_debug)
 
void setSyntax (const std::string &syntax)
 
void skipFunction (const std::string &functionName)
 

Detailed Description

The primary interface for pretty-printing GTIRB objects. The typical flow is to create a PrettyPrinter, configure it (e.g., set the output syntax, enable/disable debugging messages, etc.), then print one or more IR objects.

Constructor & Destructor Documentation

◆ PrettyPrinter() [1/3]

gtirb_pprint::PrettyPrinter::PrettyPrinter ( )

Construct a PrettyPrinter with the default configuration.

◆ PrettyPrinter() [2/3]

gtirb_pprint::PrettyPrinter::PrettyPrinter ( const PrettyPrinter )
default

◆ PrettyPrinter() [3/3]

gtirb_pprint::PrettyPrinter::PrettyPrinter ( PrettyPrinter &&  )
default

Member Function Documentation

◆ getDebug()

bool gtirb_pprint::PrettyPrinter::getDebug ( ) const

Indicates whether debugging messages are currently enable or disabled.

Returns
true if debugging messages are currently enabled, otherwise false.

◆ getSkippedFunctions()

const std::set< std::string > & gtirb_pprint::PrettyPrinter::getSkippedFunctions ( ) const

Set of functions to skip during printing.

◆ getSyntax()

const std::string & gtirb_pprint::PrettyPrinter::getSyntax ( ) const

Return the syntax that will be used for pretty printing.

◆ keepFunction()

void gtirb_pprint::PrettyPrinter::keepFunction ( const std::string &  functionName)

Do not skip the named function when printing.

Parameters
functionNamename of the function to keep

◆ operator=() [1/2]

PrettyPrinter& gtirb_pprint::PrettyPrinter::operator= ( const PrettyPrinter )
default

◆ operator=() [2/2]

PrettyPrinter& gtirb_pprint::PrettyPrinter::operator= ( PrettyPrinter &&  )
default

◆ print()

std::error_condition gtirb_pprint::PrettyPrinter::print ( std::ostream &  stream,
gtirb::Context &  context,
gtirb::IR &  ir 
) const

Pretty-print the IR to a stream.

Parameters
streamthe stream to print to
contextcontext to use for allocating AuxData objects if needed
irthe IR to pretty-print
Returns
a condition indicating if there was an error, or condition 0 if there were no errors.

◆ setDebug()

void gtirb_pprint::PrettyPrinter::setDebug ( bool  do_debug)

Enable or disable debugging messages inside the pretty-printed code.

Parameters
do_debugwhether to enable debugging messages

◆ setSyntax()

void gtirb_pprint::PrettyPrinter::setSyntax ( const std::string &  syntax)

Set the syntax with in which to pretty print. It is the caller's responsibility to ensure that the syntax name has been registered.

Parameters
syntaxname of the syntax to use

◆ skipFunction()

void gtirb_pprint::PrettyPrinter::skipFunction ( const std::string &  functionName)

Skip the named function when printing.

Parameters
functionNamename of the function to skip

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