- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# Print Class Reference

Search for all occurrences

## 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.

`#include <adskDebugPrint.h>`

List of all members.

## 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.
void | beginSection (const char *title)
| Begin a new indented section.
void | endSection ()
| Dump the standard indentation to the output stream.
eStyle | setSectionStyle (eStyle newStyle)
| Define the section style to be used for this object.
void | addFilter (const std::string &filterName, int filterValue)
| Add a new filter to the debug output.
void | removeFilter (const std::string &filterName)
| Remove an existing filter to the debug output.
bool | findFilter (const std::string &filterName, int &filterValue)
| Check for a filter's current value.
std::ostream & | doIndent ()
| Dump the standard indentation to the output stream.
bool | skipNextIndent (bool doSkip)
| Change the ability to skip the next indentation print.
int | indent (int relativeChange)
| Increment or decrement the current indentation level.
int | setIndent (int newIndent)
| Define a new indentation level, independently of the old one.
std::string | setIndentString (const std::string &newIndentString)
| Define a new indentation string.

## 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] | param | Value to be printed

Returns:
  Standard stream to use for further output

void beginSection | ( | const char * | title | ) |

Search for all occurrences

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] | title | Section title to be printed at the top

void endSection | ( |  | ) |

Search for all occurrences

Dump the standard indentation to the output stream.

Returns:
  Print object to use for chained output

Print::eStyle setSectionStyle | ( | Print::eStyle | newStyle | ) |

Search for all occurrences

Define the section style to be used for this object.

Parameters:

  [in] | newStyle | New section style to be used

Returns:
  The old style

void addFilter | ( | const std::string & | filterName,
|  | int | filterValue
| ) |  |

Search for all occurrences

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] | filterName | Name of the filter to be added
  [in] | filterValue | Value of the filter to be added

void removeFilter | ( | const std::string & | filterName | ) |

Search for all occurrences

Remove an existing filter to the debug output.

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

Parameters:

  [in] | filterName | Name of the filter to be removed

bool findFilter | ( | const std::string & | filterName,
|  | int & | filterValue
| ) |  |

Search for all occurrences

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] | filterName | Name of the filter to find
  [out] | filterValue | Value of the filter found, if it was found

Returns:
  true if the filter existed

std::ostream & doIndent | ( |  | ) |

Search for all occurrences

Dump the standard indentation to the output stream.

Returns:
  Print object to use for chained output

bool skipNextIndent | ( | bool | doSkip | ) |

Search for all occurrences

Change the ability to skip the next indentation print.

Parameters:

  [in] | doSkip | Should the next indent be skipped?

Returns:
  Old indentation level

int indent | ( | int | relativeChange | ) |

Search for all occurrences

Increment or decrement the current indentation level.

Parameters:

  [in] | relativeChange | Relative indentation level change

Returns:
  Old indentation level

int setIndent | ( | int | newIndent | ) |

Search for all occurrences

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

Parameters:

  [in] | newIndent | New current indentation level

Returns:
  The old indentation level

std::string setIndentString | ( | const std::string & | newIndentString | ) |

Search for all occurrences

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] | newIndentString | New current indentation string

Returns:
  The old indentation string

Print Print Print Print Print Print Print Print Print Print
Print Print Print Print Print Print Print Print Print Print