PandA-2024.02
|
Very simple pretty printer functor. More...
#include <simple_indent.hpp>
Public Member Functions | |
void | operator() (std::ostream &os, const std::string &str) |
pretty print functor More... | |
simple_indent (char o, char c, unsigned int d) | |
constructor More... | |
~simple_indent () | |
destructor More... | |
void | indent () |
Manually increase the indenting of the code. More... | |
void | deindent () |
Manually reduce the indenting of the code. More... | |
Private Member Functions | |
void | write_indent (std::ostream &os) |
Write the indent spaces. More... | |
void | write_char (std::ostream &os, const char &c) |
Write the current char. More... | |
Private Attributes | |
unsigned int | indent_spaces |
number of spaces used to indent after a new line print More... | |
char | opening_char |
char that increments the indent space by a delta More... | |
char | closing_char |
char that increments the indent space by a delta More... | |
unsigned int | delta |
delta indent space More... | |
bool | is_line_start |
Very simple pretty printer functor.
Definition at line 60 of file simple_indent.hpp.
simple_indent::simple_indent | ( | char | o, |
char | c, | ||
unsigned int | d | ||
) |
constructor
Utility include.
o | is the opening character used by simple_indent. |
c | is the closing character used by simple_indent. |
d | is the number of characters used to indent the code. |
Header include
Definition at line 54 of file simple_indent.cpp.
simple_indent::~simple_indent | ( | ) |
destructor
This corresponds to a THROW_ASSERT, however it is against C++ rules throw an error inside a destructor
Definition at line 59 of file simple_indent.cpp.
References indent_spaces, and indentation.
void simple_indent::deindent | ( | ) |
Manually reduce the indenting of the code.
Definition at line 145 of file simple_indent.cpp.
References delta, indent_spaces, and THROW_ASSERT.
Referenced by operator()(), and flopoco_wrapper::outputWrapVHDL().
void simple_indent::indent | ( | ) |
Manually increase the indenting of the code.
Definition at line 140 of file simple_indent.cpp.
References delta, and indent_spaces.
Referenced by operator()(), and flopoco_wrapper::outputWrapVHDL().
void simple_indent::operator() | ( | std::ostream & | os, |
const std::string & | str | ||
) |
pretty print functor
is | the output stream |
is | the string to be printed |
Specified whether the first character of the string we are going to write must be indented or not
Definition at line 70 of file simple_indent.cpp.
References closing_char, deindent(), indent(), is_line_start, opening_char, STD_CLOSING_CHAR, STD_OPENING_CHAR, write_char(), and write_indent().
|
private |
Write the current char.
Definition at line 159 of file simple_indent.cpp.
Referenced by operator()().
|
private |
Write the indent spaces.
Definition at line 151 of file simple_indent.cpp.
References indent_spaces.
Referenced by operator()().
|
private |
char that increments the indent space by a delta
Definition at line 70 of file simple_indent.hpp.
Referenced by operator()().
|
private |
delta indent space
Definition at line 73 of file simple_indent.hpp.
Referenced by deindent(), and indent().
|
private |
number of spaces used to indent after a new line print
Definition at line 64 of file simple_indent.hpp.
Referenced by deindent(), indent(), write_indent(), and ~simple_indent().
|
private |
Definition at line 75 of file simple_indent.hpp.
Referenced by operator()().
|
private |
char that increments the indent space by a delta
Definition at line 67 of file simple_indent.hpp.
Referenced by operator()().