Skip to content
Snippets Groups Projects
Select Git revision
  • b09ba9c74b209e87c8952ffdbd5ae4cb26c8722f
  • master default protected
  • tut_ring_allen
  • docs_furo
  • docs_reorder_cable_cell
  • docs_graphviz
  • docs_rtd_dev
  • ebrains_mirror
  • doc_recat
  • docs_spike_source
  • docs_sim_sample_clar
  • docs_pip_warn
  • github_template_updates
  • docs_fix_link
  • cv_default_and_doc_clarification
  • docs_add_numpy_req
  • readme_zenodo_05
  • install_python_fix
  • install_require_numpy
  • typofix_propetries
  • docs_recipe_lookup
  • v0.10.0
  • v0.10.1
  • v0.10.0-rc5
  • v0.10.0-rc4
  • v0.10.0-rc3
  • v0.10.0-rc2
  • v0.10.0-rc
  • v0.9.0
  • v0.9.0-rc
  • v0.8.1
  • v0.8
  • v0.8-rc
  • v0.7
  • v0.6
  • v0.5.2
  • v0.5.1
  • v0.5
  • v0.4
  • v0.3
  • v0.2.2
41 results

linearrewriter.hpp

Blame
  • textbuffer.cpp 1.14 KiB
    #include "textbuffer.hpp"
    
    /******************************************************************************
                                  TextBuffer
    ******************************************************************************/
    TextBuffer& TextBuffer::add_gutter() {
        text_ << gutter_;
        return *this;
    }
    void TextBuffer::add_line(std::string const& line) {
        text_ << gutter_ << line << std::endl;
    }
    void TextBuffer::add_line() {
        text_ << std::endl;
    }
    void TextBuffer::end_line(std::string const& line) {
        text_ << line << std::endl;
    }
    void TextBuffer::end_line() {
        text_ << std::endl;
    }
    
    std::string TextBuffer::str() const {
        return text_.str();
    }
    
    void TextBuffer::set_gutter(int width) {
        indent_ = width;
        gutter_ = std::string(indent_, ' ');
    }
    
    void TextBuffer::increase_indentation() {
        indent_ += indentation_width_;
        if(indent_<0) {
            indent_=0;
        }
        gutter_ = std::string(indent_, ' ');
    }
    void TextBuffer::decrease_indentation() {
        indent_ -= indentation_width_;
        if(indent_<0) {
            indent_=0;
        }
        gutter_ = std::string(indent_, ' ');
    }
    
    std::stringstream& TextBuffer::text() {
        return text_;
    }