ROSE  0.9.10.91
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback Class Reference

Description

Base class for printing table cells.

Three kinds of callback are defined:

  1. A callback to print the table heading and separator
  2. A callback to print the data content
  3. A callback invoked before and after the entire table

Subclasses almost always override the data content callback, but seldom override the others. The default heading and separator callback knows how to print a properly formatted column heading, and the default before and after callback does nothing, but could be used to print keys, footnotes, etc.

If a callback has no column name and zero width, then its header and content callback is not invoked; its content callback is still invoked but should not produce any output.

Definition at line 326 of file AsmFunctionIndex.h.

#include <AsmFunctionIndex.h>

Inheritance diagram for Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback:
Collaboration graph
[legend]

Classes

struct  BeforeAfterArgs
 Arguments for before-and after. More...
 
struct  DataArgs
 Arguments for column cells. More...
 
struct  GeneralArgs
 Base class for callback arguments. More...
 
struct  HeadingArgs
 Arguments for column heading callbacks. More...
 

Public Member Functions

 OutputCallback (const std::string &name, size_t width, const std::string description="")
 Constructor. More...
 
void set_prefix (const std::string &header, const std::string &separator=" ", const std::string &data=" ")
 Set prefix characters. More...
 
virtual bool operator() (bool enabled, const BeforeAfterArgs &)
 Callback for before and after the table. More...
 
virtual bool operator() (bool enabled, const HeadingArgs &)
 Callback to print a column heading. More...
 
virtual bool operator() (bool enabled, const DataArgs &)
 Callback to print data for a table cell. More...
 

Protected Member Functions

std::string center (const std::string &, size_t width)
 Center s in a string of length width. More...
 

Protected Attributes

std::string name
 Column name used when printing table headers. More...
 
std::string desc
 Optional description to appear in footnote. More...
 
size_t width
 Minimum width of column header or data. More...
 
std::string header_prefix
 Character(s) to print before headings. More...
 
std::string separator_prefix
 Character(s) to print before line separators. More...
 
std::string data_prefix
 Character(s) to print before data cells. More...
 

Constructor & Destructor Documentation

Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::OutputCallback ( const std::string &  name,
size_t  width,
const std::string  description = "" 
)
inline

Constructor.

Every column must have a name and non-zero width. If a column is given a description then the column name will reference a footnote containing the description. The footnote is added by the default HeadingArgs callback, so subclasses should take care to add their own footnote if necessary.

Definition at line 363 of file AsmFunctionIndex.h.

Member Function Documentation

void Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::set_prefix ( const std::string &  header,
const std::string &  separator = " ",
const std::string &  data = " " 
)

Set prefix characters.

virtual bool Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::operator() ( bool  enabled,
const BeforeAfterArgs  
)
virtual

Callback for before and after the table.

The default does nothing, but subclasses can override this to do things like print descriptions, footnotes, etc.

Reimplemented in Rose::BinaryAnalysis::AsmFunctionIndex::FootnotesCallback.

virtual bool Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::operator() ( bool  enabled,
const HeadingArgs  
)
virtual

Callback to print a column heading.

The base class implementation prints the column name using the specified column width. Subclasses probably don't need to override this method.

Reimplemented in Rose::BinaryAnalysis::AsmFunctionIndex::StackDeltaCallback, and Rose::BinaryAnalysis::AsmFunctionIndex::ReasonCallback.

virtual bool Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::operator() ( bool  enabled,
const DataArgs  
)
virtual
std::string Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::center ( const std::string &  ,
size_t  width 
)
protected

Center s in a string of length width.

Member Data Documentation

std::string Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::name
protected

Column name used when printing table headers.

Definition at line 388 of file AsmFunctionIndex.h.

std::string Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::desc
protected

Optional description to appear in footnote.

Definition at line 389 of file AsmFunctionIndex.h.

size_t Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::width
protected

Minimum width of column header or data.

Definition at line 390 of file AsmFunctionIndex.h.

std::string Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::header_prefix
protected

Character(s) to print before headings.

Definition at line 391 of file AsmFunctionIndex.h.

std::string Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::separator_prefix
protected

Character(s) to print before line separators.

Definition at line 392 of file AsmFunctionIndex.h.

std::string Rose::BinaryAnalysis::AsmFunctionIndex::OutputCallback::data_prefix
protected

Character(s) to print before data cells.

Definition at line 393 of file AsmFunctionIndex.h.


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