C++ API Reference
Print Class Reference

Class implementing debug printing operation. More...

#include <adskDebugPrint.h>

Public Member Functions

 Print (std::ostream &cdbg)
 Default constructor - sets up the stream taking the output.
 
 Print (const Print &rhs)
 Copy constructor - sets up the stream taking the output.
 
Printoperator= (const Print &rhs)
 Assignment operator.
 
 ~Print ()
 Default destructor - does nothing.
 
std::ostream & operator<< (const void *ptr)
 Output operators - print value with indentation and return the real stream. More...
 
void beginSection (const char *title)
 Begin a new indented section. More...
 
void endSection ()
 Dump the standard indentation to the output stream. More...
 
eStyle setSectionStyle (eStyle newStyle)
 Define the section style to be used for this object. More...
 
void addFilter (const std::string &filterName, int filterValue)
 Add a new filter to the debug output. More...
 
void removeFilter (const std::string &filterName)
 Remove an existing filter to the debug output. More...
 
bool findFilter (const std::string &filterName, int &filterValue)
 Check for a filter's current value. More...
 
std::ostream & doIndent ()
 Dump the standard indentation to the output stream. More...
 
bool skipNextIndent (bool doSkip)
 Change the ability to skip the next indentation print. More...
 
int indent (int relativeChange)
 Increment or decrement the current indentation level. More...
 
int setIndent (int newIndent)
 Define a new indentation level, independently of the old one. More...
 
std::string setIndentString (const std::string &newIndentString)
 Define a new indentation string. More...
 

Detailed Description

Class implementing debug printing operation.

While most debuggers provide a way to examine the interior of objects oftentimes a simple structural and content analysis is insufficient to discern what is happening within an object.

It's likewise more difficult to collect and compare information from several different locations over many iterations - dumping the data out to a stream provides the option of after-the-fact analysis.

This debug request type provides a simple output mechanism including an arbitrary stream and automatic indenting styles to make the formatting of the data more readable.

Member Function Documentation

std::ostream & operator<< ( const void *  param)

Output operators - print value with indentation and return the real stream.

We'd like to use this class the same way std::ostream is used while still enabling the indentation behaviour. This method provides the capability to enter a typical stream output sequence such as this:

cdbg << "This is the first line" << std::endl;

Since a std::ostream is returned this works the way you'd expect it to work.

Parameters
[in]paramValue to be printed
Returns
Standard stream to use for further output
void beginSection ( const char *  title)

Begin a new indented section.

Use the section style information to determine how the formatting should evolve inside a section. The two current options are C-Style with braces, and Python-Style relying solely on indentation.

Parameters
[in]titleSection title to be printed at the top
void endSection ( )

Dump the standard indentation to the output stream.

Returns
Print object to use for chained output
Print::eStyle setSectionStyle ( Print::eStyle  newStyle)

Define the section style to be used for this object.

Parameters
[in]newStyleNew section style to be used
Returns
The old style
void addFilter ( const std::string &  filterName,
int  filterValue 
)

Add a new filter to the debug output.

These filters are merely suggestions and it's up to the individual objects' debugging methods to respect them or not. If the filter already existed it will just get the new value.

Parameters
[in]filterNameName of the filter to be added
[in]filterValueValue of the filter to be added
void removeFilter ( const std::string &  filterName)

Remove an existing filter to the debug output.

If the filter didn't exist this will just silently succeed.

Parameters
[in]filterNameName of the filter to be removed
bool findFilter ( const std::string &  filterName,
int &  filterValue 
)

Check for a filter's current value.

If the filter exists then return true and set the value of the filter into the filterValue parameter, otherwise return false and the value of filterValue is undefined.

Parameters
[in]filterNameName of the filter to find
[out]filterValueValue of the filter found, if it was found
Returns
true if the filter existed
std::ostream & doIndent ( )

Dump the standard indentation to the output stream.

Returns
Print object to use for chained output
bool skipNextIndent ( bool  doSkip)

Change the ability to skip the next indentation print.

Parameters
[in]doSkipShould the next indent be skipped?
Returns
Old indentation level
int indent ( int  relativeChange)

Increment or decrement the current indentation level.

Parameters
[in]relativeChangeRelative indentation level change
Returns
Old indentation level
int setIndent ( int  newIndent)

Define a new indentation level, independently of the old one.

Parameters
[in]newIndentNew current indentation level
Returns
The old indentation level
std::string setIndentString ( const std::string &  newIndentString)

Define a new indentation string.

The indentation string is what's repeated at the beginning of any new output. It repeats "fIndentLevel" times.

Parameters
[in]newIndentStringNew current indentation string
Returns
The old indentation string

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