C++ API 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. | |
Print & | operator= (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... | |
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.
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.
[in] | param | Value to be printed |
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.
[in] | title | Section title to be printed at the top |
void endSection | ( | ) |
Dump the standard indentation to the output stream.
Print::eStyle setSectionStyle | ( | Print::eStyle | newStyle | ) |
Define the section style to be used for this object.
[in] | newStyle | New section style to be used |
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.
[in] | filterName | Name of the filter to be added |
[in] | filterValue | Value 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.
[in] | filterName | Name 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.
[in] | filterName | Name of the filter to find |
[out] | filterValue | Value of the filter found, if it was found |
std::ostream & doIndent | ( | ) |
Dump the standard indentation to the output stream.
bool skipNextIndent | ( | bool | doSkip | ) |
Change the ability to skip the next indentation print.
[in] | doSkip | Should the next indent be skipped? |
int indent | ( | int | relativeChange | ) |
Increment or decrement the current indentation level.
[in] | relativeChange | Relative indentation level change |
int setIndent | ( | int | newIndent | ) |
Define a new indentation level, independently of the old one.
[in] | newIndent | New current 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.
[in] | newIndentString | New current indentation string |