#include <gromacs/utility/stringutil.h>
Stores settings for line wrapping.
Methods in this class do not throw.
- See Also
- TextLineWrapper
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.
int gmx::TextLineWrapperSettings::firstLineIndent |
( |
| ) |
const |
|
inline |
void gmx::TextLineWrapperSettings::setContinuationChar |
( |
char |
continuationChar | ) |
|
|
inline |
Sets a continuation marker for wrapped lines.
- Parameters
-
[in] | continuationChar | Character 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] | indent | Number 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] | indent | Number 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] | bKeep | Whether 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] | length | Maximum 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: