IDL compiler front-end library
Public Member Functions | List of all members
BE::IndentedOut Class Reference

Output file stream with indentation. More...

#include <IndentedOut.h>

Inherits std::ofstream.

Public Member Functions

 IndentedOut ()
 Default constructor.
 
 IndentedOut (const std::filesystem::path &file)
 
 ~IndentedOut ()
 Destructor.
 
void open (const std::filesystem::path &file)
 Opens the file. More...
 
void close ()
 Closes the file.
 
void indent () noexcept
 Increase indentation.
 
void unindent () noexcept
 Decrease indentation.
 
void empty_line ()
 Ensure that empty line inserted at the current position.
 
unsigned indentation () const noexcept
 
char last_char () const noexcept
 
size_t size () const noexcept
 

Detailed Description

Output file stream with indentation.

Examples
Printer.cpp.

Definition at line 39 of file IndentedOut.h.

Constructor & Destructor Documentation

◆ IndentedOut()

BE::IndentedOut::IndentedOut ( const std::filesystem::path &  file)

Constructor.

Parameters
fileFile to open.
Exceptions
std::runtime_error

Member Function Documentation

◆ open()

void BE::IndentedOut::open ( const std::filesystem::path &  file)

Opens the file.

Also creates all parent directories.

Parameters
fileFile to open.
Exceptions
std::runtime_error

◆ indentation()

unsigned BE::IndentedOut::indentation ( ) const
inlinenoexcept
Returns
Current indentation.

Definition at line 87 of file IndentedOut.h.

◆ last_char()

char BE::IndentedOut::last_char ( ) const
inlinenoexcept
Returns
The last output character.

Definition at line 93 of file IndentedOut.h.

◆ size()

size_t BE::IndentedOut::size ( ) const
inlinenoexcept
Returns
The number of characters written.

Definition at line 99 of file IndentedOut.h.


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