Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::Tab Class Reference

Keeps track of indentation level. More...

#include <thorin/util/print.h>

Public Member Functions

 Tab (std::string_view tab={" "}, size_t indent=0)
 
Getters
size_t indent () const
 
std::string_view tab () const
 
print

Wraps thorin::print to prefix it with indentation.

See also
Formatted Output
template<class... Args>
std::ostream & print (std::ostream &os, const char *s, Args &&... args)
 
template<class... Args>
std::ostream & lnprint (std::ostream &os, const char *s, Args &&... args)
 Same as Tab::print but prepends a std::endl to os.
 
template<class... Args>
std::ostream & println (std::ostream &os, const char *s, Args &&... args)
 Same as Tab::print but appends a std::endl to os.
 
Creates a new Tab
Tab operator++ (int)
 
Tab operator-- (int)
 
Tab operator+ (size_t indent) const
 
Tab operator- (size_t indent) const
 
Modifies this Tab
Taboperator++ ()
 
Taboperator-- ()
 
Taboperator+= (size_t indent)
 
Taboperator-= (size_t indent)
 
Taboperator= (size_t indent)
 
Taboperator= (std::string_view tab)
 

Detailed Description

Keeps track of indentation level.

Definition at line 184 of file print.h.

Constructor & Destructor Documentation

◆ Tab()

thorin::Tab::Tab ( std::string_view  tab = {"    "},
size_t  indent = 0 
)
inline

Definition at line 186 of file print.h.

Member Function Documentation

◆ indent()

size_t thorin::Tab::indent ( ) const
inline

Definition at line 192 of file print.h.

Referenced by operator+(), operator+=(), operator-(), operator-=(), and operator=().

◆ lnprint()

template<class... Args>
std::ostream & thorin::Tab::lnprint ( std::ostream &  os,
const char *  s,
Args &&...  args 
)
inline

Same as Tab::print but prepends a std::endl to os.

Definition at line 205 of file print.h.

References print().

◆ operator+()

Tab thorin::Tab::operator+ ( size_t  indent) const
inline

Definition at line 219 of file print.h.

References indent().

◆ operator++() [1/2]

Tab & thorin::Tab::operator++ ( )
inline

Definition at line 225 of file print.h.

◆ operator++() [2/2]

Tab thorin::Tab::operator++ ( int  )
inline

Definition at line 217 of file print.h.

◆ operator+=()

Tab & thorin::Tab::operator+= ( size_t  indent)
inline

Definition at line 227 of file print.h.

References indent().

◆ operator-()

Tab thorin::Tab::operator- ( size_t  indent) const
inline

Definition at line 220 of file print.h.

References indent().

◆ operator--() [1/2]

Tab & thorin::Tab::operator-- ( )
inline

Definition at line 226 of file print.h.

◆ operator--() [2/2]

Tab thorin::Tab::operator-- ( int  )
inline

Definition at line 218 of file print.h.

◆ operator-=()

Tab & thorin::Tab::operator-= ( size_t  indent)
inline

Definition at line 228 of file print.h.

References indent().

◆ operator=() [1/2]

Tab & thorin::Tab::operator= ( size_t  indent)
inline

Definition at line 229 of file print.h.

References indent().

◆ operator=() [2/2]

Tab & thorin::Tab::operator= ( std::string_view  tab)
inline

Definition at line 230 of file print.h.

References tab().

◆ print()

template<class... Args>
std::ostream & thorin::Tab::print ( std::ostream &  os,
const char *  s,
Args &&...  args 
)
inline

Definition at line 200 of file print.h.

References thorin::print().

Referenced by thorin::bootstrap(), thorin::ll::Emitter::finalize(), lnprint(), and println().

◆ println()

template<class... Args>
std::ostream & thorin::Tab::println ( std::ostream &  os,
const char *  s,
Args &&...  args 
)
inline

Same as Tab::print but appends a std::endl to os.

Definition at line 209 of file print.h.

References print().

◆ tab()

std::string_view thorin::Tab::tab ( ) const
inline

Definition at line 193 of file print.h.

Referenced by operator=().


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