Helper class for printing C/C++ code.  
 More...
Helper class for printing C/C++ code. 
This class provides common functionality required by code generation visitor to print C/C++/Cuda code. 
Definition at line 44 of file code_printer.hpp.
 
#include <code_printer.hpp>
◆ CodePrinter() [1/3]
  
  
      
        
          | nmodl::printer::CodePrinter::CodePrinter  | 
          ( | 
          std::unique_ptr< utils::Blame >  | 
          blame | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ CodePrinter() [2/3]
  
  
      
        
          | nmodl::printer::CodePrinter::CodePrinter  | 
          ( | 
          std::ostream &  | 
          stream,  | 
         
        
           | 
           | 
          std::unique_ptr< utils::Blame >  | 
          blame  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
 
◆ CodePrinter() [3/3]
      
        
          | nmodl::printer::CodePrinter::CodePrinter  | 
          ( | 
          const std::string &  | 
          filename,  | 
        
        
           | 
           | 
          std::unique_ptr< utils::Blame >  | 
          blame  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
◆ ~CodePrinter()
  
  
      
        
          | nmodl::printer::CodePrinter::~CodePrinter  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ add_indent()
      
        
          | void nmodl::printer::CodePrinter::add_indent  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ add_line()
template<typename... Args> 
  
  
      
        
          | void nmodl::printer::CodePrinter::add_line  | 
          ( | 
          Args &&...  | 
          args | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ add_multi_line()
      
        
          | void nmodl::printer::CodePrinter::add_multi_line  | 
          ( | 
          const std::string &  | 
          text | ) | 
           | 
        
      
 
 
◆ add_newline()
      
        
          | void nmodl::printer::CodePrinter::add_newline  | 
          ( | 
          std::size_t  | 
          n = 1 | ) | 
           | 
        
      
 
 
◆ add_text()
template<typename... Args> 
  
  
      
        
          | void nmodl::printer::CodePrinter::add_text  | 
          ( | 
          Args &&...  | 
          args | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ blame()
  
  
      
        
          | void nmodl::printer::CodePrinter::blame  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ chain_block()
      
        
          | void nmodl::printer::CodePrinter::chain_block  | 
          ( | 
          std::string const &  | 
          expression | ) | 
           | 
        
      
 
end a block and immediately start a new one (i.e. "[indent-1]} [expression] {\n") 
Definition at line 46 of file code_printer.cpp.
 
 
◆ decrease_indent()
  
  
      
        
          | void nmodl::printer::CodePrinter::decrease_indent  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ fmt_line()
template<typename... Args> 
  
  
      
        
          | void nmodl::printer::CodePrinter::fmt_line  | 
          ( | 
          Args &&...  | 
          args | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
fmt_line(x, y, z) is just shorthand for add_line(fmt::format(x, y, z)) 
Definition at line 96 of file code_printer.hpp.
 
 
◆ fmt_push_block()
template<typename... Args> 
  
  
      
        
          | void nmodl::printer::CodePrinter::fmt_push_block  | 
          ( | 
          Args &&...  | 
          args | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
fmt_push_block(args...) is just shorthand for push_block(fmt::format(args...)) 
Definition at line 102 of file code_printer.hpp.
 
 
◆ fmt_text()
template<typename... Args> 
  
  
      
        
          | void nmodl::printer::CodePrinter::fmt_text  | 
          ( | 
          Args &&...  | 
          args | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
fmt_text(args...) is just shorthand for add_text(fmt::format(args...)) 
Definition at line 108 of file code_printer.hpp.
 
 
◆ increase_indent()
  
  
      
        
          | void nmodl::printer::CodePrinter::increase_indent  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ indent_spaces()
  
  
      
        
          | int nmodl::printer::CodePrinter::indent_spaces  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ pop_block() [1/2]
      
        
          | void nmodl::printer::CodePrinter::pop_block  | 
          ( | 
           | ) | 
           | 
        
      
 
end of current block scope (i.e. end with "}") and adds one NL character 
Definition at line 98 of file code_printer.cpp.
 
 
◆ pop_block() [2/2]
      
        
          | void nmodl::printer::CodePrinter::pop_block  | 
          ( | 
          const std::string_view &  | 
          suffix,  | 
        
        
           | 
           | 
          std::size_t  | 
          num_newlines = 1  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
end a block with suffix before the newline(s) (i.e. [indent]}[suffix]
*num_newlines) 
Definition at line 109 of file code_printer.cpp.
 
 
◆ pop_block_nl()
      
        
          | void nmodl::printer::CodePrinter::pop_block_nl  | 
          ( | 
          std::size_t  | 
          num_newlines = 0 | ) | 
           | 
        
      
 
same as pop_block but control the number of NL characters (0 or more) with num_newlines parameter 
Definition at line 102 of file code_printer.cpp.
 
 
◆ push_block() [1/2]
      
        
          | void nmodl::printer::CodePrinter::push_block  | 
          ( | 
           | ) | 
           | 
        
      
 
start a block scope without indentation (i.e. "{\n") 
Definition at line 33 of file code_printer.cpp.
 
 
◆ push_block() [2/2]
      
        
          | void nmodl::printer::CodePrinter::push_block  | 
          ( | 
          const std::string &  | 
          expression | ) | 
           | 
        
      
 
start a block scope with an expression (i.e. "[indent][expression] {\n") 
Definition at line 39 of file code_printer.cpp.
 
 
◆ blame_printer
  
  
      
        
          | std::unique_ptr<utils::Blame> nmodl::printer::CodePrinter::blame_printer | 
         
       
   | 
  
private   | 
  
 
 
◆ current_line
  
  
      
        
          | size_t nmodl::printer::CodePrinter::current_line = 1 | 
         
       
   | 
  
private   | 
  
 
 
◆ indent_level
  
  
      
        
          | size_t nmodl::printer::CodePrinter::indent_level = 0 | 
         
       
   | 
  
private   | 
  
 
 
◆ NUM_SPACES
  
  
      
        
          | const size_t nmodl::printer::CodePrinter::NUM_SPACES = 4 | 
         
       
   | 
  
private   | 
  
 
 
◆ ofs
  
  
      
        
          | std::ofstream nmodl::printer::CodePrinter::ofs | 
         
       
   | 
  
private   | 
  
 
 
◆ result
  
  
      
        
          | std::unique_ptr<std::ostream> nmodl::printer::CodePrinter::result | 
         
       
   | 
  
private   | 
  
 
 
◆ sbuf
  
  
      
        
          | std::streambuf* nmodl::printer::CodePrinter::sbuf = nullptr | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: