PandA-2024.02
Public Member Functions | Private Member Functions | Private Attributes
simple_indent Class Reference

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
 

Detailed Description

Very simple pretty printer functor.

Definition at line 60 of file simple_indent.hpp.

Constructor & Destructor Documentation

◆ simple_indent()

simple_indent::simple_indent ( char  o,
char  c,
unsigned int  d 
)

constructor

Utility include.

Parameters
ois the opening character used by simple_indent.
cis the closing character used by simple_indent.
dis the number of characters used to indent the code.

Header include

Definition at line 54 of file simple_indent.cpp.

◆ ~simple_indent()

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.

Member Function Documentation

◆ deindent()

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().

Here is the caller graph for this function:

◆ indent()

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().

Here is the caller graph for this function:

◆ operator()()

void simple_indent::operator() ( std::ostream &  os,
const std::string &  str 
)

pretty print functor

Parameters
isthe output stream
isthe 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().

Here is the call graph for this function:

◆ write_char()

void simple_indent::write_char ( std::ostream &  os,
const char &  c 
)
private

Write the current char.

Definition at line 159 of file simple_indent.cpp.

Referenced by operator()().

Here is the caller graph for this function:

◆ write_indent()

void simple_indent::write_indent ( std::ostream &  os)
private

Write the indent spaces.

Definition at line 151 of file simple_indent.cpp.

References indent_spaces.

Referenced by operator()().

Here is the caller graph for this function:

Field Documentation

◆ closing_char

char simple_indent::closing_char
private

char that increments the indent space by a delta

Definition at line 70 of file simple_indent.hpp.

Referenced by operator()().

◆ delta

unsigned int simple_indent::delta
private

delta indent space

Definition at line 73 of file simple_indent.hpp.

Referenced by deindent(), and indent().

◆ indent_spaces

unsigned int simple_indent::indent_spaces
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().

◆ is_line_start

bool simple_indent::is_line_start
private

Definition at line 75 of file simple_indent.hpp.

Referenced by operator()().

◆ opening_char

char simple_indent::opening_char
private

char that increments the indent space by a delta

Definition at line 67 of file simple_indent.hpp.

Referenced by operator()().


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

Generated on Mon Feb 12 2024 13:04:03 for PandA-2024.02 by doxygen 1.8.13