ROSE  0.11.96.11
Public Member Functions | List of all members
Sawyer::Document::Markup::Reflow Class Reference

Description

A class that can reflow and indent paragraphs.

This class acts as an input stream in that it processes calls to its function operator to accumulate text. The accumulated text is indented according to the current indentation level, and reflowed so that it fills the current page width. Isolated linefeeds are ignored, and consecutive linefeeds (no matter how many) result in a single blank line in the output.

Definition at line 327 of file DocumentMarkup.h.

#include <DocumentMarkup.h>

Public Member Functions

 Reflow (size_t pageWidth=80)
 Construct a reflow filter. More...
 
ReflowlineBreak ()
 Insert a line break. More...
 
Reflowoperator() (const std::string &s)
 Insert text. More...
 
std::string toString ()
 Extract the reflowed string. More...
 
size_t pageWidth () const
 Property: Page width. More...
 
ReflowpageWidth (size_t n)
 Property: Page width. More...
 
const std::string & indentationString () const
 Property: Indentation string. More...
 
ReflowindentationString (const std::string &s)
 Property: Indentation string. More...
 
Reflowoperator++ ()
 Increase or decrease indentation. More...
 
Reflowoperator-- ()
 Increase or decrease indentation. More...
 

Constructor & Destructor Documentation

◆ Reflow()

Sawyer::Document::Markup::Reflow::Reflow ( size_t  pageWidth = 80)
inlineexplicit

Construct a reflow filter.

This reflow filter will use the specified page width, measured in characters.

Definition at line 341 of file DocumentMarkup.h.

Member Function Documentation

◆ pageWidth() [1/2]

size_t Sawyer::Document::Markup::Reflow::pageWidth ( ) const
inline

Property: Page width.

The page width is usually set in the constructor, but it can also be modified through this property. Modifying the page width during operation is allowed, but will only affect data streamed in after the change. A minimum page width of 20 columns is enforced.

Definition at line 351 of file DocumentMarkup.h.

◆ pageWidth() [2/2]

Reflow& Sawyer::Document::Markup::Reflow::pageWidth ( size_t  n)
inline

Property: Page width.

The page width is usually set in the constructor, but it can also be modified through this property. Modifying the page width during operation is allowed, but will only affect data streamed in after the change. A minimum page width of 20 columns is enforced.

Definition at line 352 of file DocumentMarkup.h.

◆ indentationString() [1/2]

const std::string& Sawyer::Document::Markup::Reflow::indentationString ( ) const
inline

Property: Indentation string.

This is the string emitted for each level of indentation. The default is four spaces. TAB characters should be avoided since they may interfere with column calculations.

Definition at line 361 of file DocumentMarkup.h.

◆ indentationString() [2/2]

Reflow& Sawyer::Document::Markup::Reflow::indentationString ( const std::string &  s)
inline

Property: Indentation string.

This is the string emitted for each level of indentation. The default is four spaces. TAB characters should be avoided since they may interfere with column calculations.

Definition at line 362 of file DocumentMarkup.h.

◆ operator++()

Reflow& Sawyer::Document::Markup::Reflow::operator++ ( )

Increase or decrease indentation.

Indentation is always increased or decreased one level at a time. The indentation level will never go below zero.

If the indentation is changed in the middle of a line it will affect only subsequent lines.

◆ operator--()

Reflow& Sawyer::Document::Markup::Reflow::operator-- ( )

Increase or decrease indentation.

Indentation is always increased or decreased one level at a time. The indentation level will never go below zero.

If the indentation is changed in the middle of a line it will affect only subsequent lines.

◆ lineBreak()

Reflow& Sawyer::Document::Markup::Reflow::lineBreak ( )

Insert a line break.

A line break causes subsequent input to appear on the next line. Inserting multiple line breaks and/or paragraph separators (two or more consecutive linefeeds) does not produce extra blank lines in the output.

◆ operator()()

Reflow& Sawyer::Document::Markup::Reflow::operator() ( const std::string &  s)

Insert text.

The specified string is inserted into the reflow engine.

◆ toString()

std::string Sawyer::Document::Markup::Reflow::toString ( )

Extract the reflowed string.

Returns the text that has been inserted so far.


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