MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::Tab Class Reference

Keeps track of indentation level. More...

#include <mim/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 mim::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 195 of file print.h.

Constructor & Destructor Documentation

◆ Tab()

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

Definition at line 197 of file print.h.

Member Function Documentation

◆ indent()

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

Definition at line 203 of file print.h.

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

◆ lnprint()

template<class... Args>
std::ostream & mim::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 216 of file print.h.

References print().

◆ operator+()

Tab mim::Tab::operator+ ( size_t indent) const
inlinenodiscard

Definition at line 230 of file print.h.

References indent().

◆ operator++() [1/2]

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

Definition at line 236 of file print.h.

◆ operator++() [2/2]

Tab mim::Tab::operator++ ( int )
inlinenodiscard

Definition at line 228 of file print.h.

◆ operator+=()

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

Definition at line 238 of file print.h.

References indent().

◆ operator-()

Tab mim::Tab::operator- ( size_t indent) const
inlinenodiscard

Definition at line 231 of file print.h.

References indent().

◆ operator--() [1/2]

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

Definition at line 237 of file print.h.

◆ operator--() [2/2]

Tab mim::Tab::operator-- ( int )
inlinenodiscard

Definition at line 229 of file print.h.

◆ operator-=()

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

Definition at line 239 of file print.h.

References indent().

◆ operator=() [1/2]

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

Definition at line 240 of file print.h.

References indent().

◆ operator=() [2/2]

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

Definition at line 241 of file print.h.

References tab().

◆ print()

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

◆ println()

template<class... Args>
std::ostream & mim::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 220 of file print.h.

References print().

Referenced by mim::ast::DeclExpr::stream(), mim::ast::Import::stream(), and mim::ast::Module::stream().

◆ tab()

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

Definition at line 204 of file print.h.

Referenced by operator=().


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