Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::TextLineWrapperSettings Class Reference

#include <gromacs/utility/stringutil.h>

Description

Stores settings for line wrapping.

Methods in this class do not throw.

See Also
TextLineWrapper

Public Member Functions

 TextLineWrapperSettings ()
 Initializes default wrapper settings. More...
 
void setLineLength (int length)
 Sets the maximum length for output lines. More...
 
void setIndent (int indent)
 Sets the indentation for output lines. More...
 
void setFirstLineIndent (int indent)
 Sets the indentation for first output line after a line break. More...
 
void setKeepFinalSpaces (bool bKeep)
 Sets whether final spaces in input should be kept. More...
 
void setContinuationChar (char continuationChar)
 Sets a continuation marker for wrapped lines. More...
 
int lineLength () const
 Returns the maximum length set with setLineLength().
 
int indent () const
 Returns the indentation set with setIndent().
 
int firstLineIndent () const
 Returns the indentation set with setFirstLineIndent(). More...
 

Constructor & Destructor Documentation

gmx::TextLineWrapperSettings::TextLineWrapperSettings ( )

Initializes default wrapper settings.

Default settings are:

  • No maximum line width (only explicit line breaks).
  • No indentation.
  • No continuation characters.
  • Do not keep final spaces in input strings.

Member Function Documentation

int gmx::TextLineWrapperSettings::firstLineIndent ( ) const
inline

Returns the indentation set with setFirstLineIndent().

If setFirstLineIndent() has not been called or has been called with -1, indent() is returned.

void gmx::TextLineWrapperSettings::setContinuationChar ( char  continuationChar)
inline

Sets a continuation marker for wrapped lines.

Parameters
[in]continuationCharCharacter to use to mark continuation lines.

If set to non-zero character code, this character is added at the end of each line where a line break is added by TextLineWrapper (but not after lines produced by explicit line breaks). The default ('\0') is to not add continuation markers.

Note that currently, the continuation char may cause the output line length to exceed the value set with setLineLength() by at most two characters.

void gmx::TextLineWrapperSettings::setFirstLineIndent ( int  indent)
inline

Sets the indentation for first output line after a line break.

Parameters
[in]indentNumber of spaces to add for indentation.

If this method is not called, or called with indent equal to -1, the value set with setIndent() is used.

void gmx::TextLineWrapperSettings::setIndent ( int  indent)
inline

Sets the indentation for output lines.

Parameters
[in]indentNumber of spaces to add for indentation.

If this method is not called, the wrapper does not add indentation.

void gmx::TextLineWrapperSettings::setKeepFinalSpaces ( bool  bKeep)
inline

Sets whether final spaces in input should be kept.

Parameters
[in]bKeepWhether to keep spaces at the end of the input.

This means that wrapping a string that ends in spaces also keeps those spaces in the output. This allows using the wrapper for partial lines where the initial part of the line may end in a space. By default, all trailing whitespace is removed. Note that this option does not affect spaces before an explicit newline: those are always removed.

void gmx::TextLineWrapperSettings::setLineLength ( int  length)
inline

Sets the maximum length for output lines.

Parameters
[in]lengthMaximum length for the lines after wrapping.

If this method is not called, or is called with zero length, the wrapper has no maximum length (only wraps at explicit line breaks).


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