Skip to content
Snippets Groups Projects
Select Git revision
  • 84d90b1b3a3aa33680f464d1b51a9414cb4ed765
  • master default protected
2 results

webpack.common.js

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_;
    }