Gromacs
2024.3
|
#include <gromacs/onlinehelp/rstparser.h>
Iterator over reStructuredText paragraphs.
After initialization, nextParagraph() needs to be called to access the first paragraph. Subsequence paragraphs can be accessed by repeated calls to nextParagraph(). After the last paragraph, nextParagraph() returns false
.
After each call to nextParagraph(), other methods can be called to query details of the current paragraph.
Public Member Functions | |
RstParagraphIterator (const std::string &text) | |
Initializes an iterator for given input text. More... | |
bool | nextParagraph () |
Advances the iterator to the next paragraph. More... | |
int | firstLineIndent () const |
Returns the indentation for first line of this paragraph. | |
int | indent () const |
Returns the indentation for subsequent lines of this paragraph. | |
void | getParagraphText (std::string *result) const |
Returns the text. More... | |
|
explicit |
Initializes an iterator for given input text.
Does not throw.
void gmx::RstParagraphIterator::getParagraphText | ( | std::string * | result | ) | const |
Returns the text.
[out] | result | Variable to receive the paragraph text. |
std::bad_alloc | if out of memory. |
Indentation and internal line breaks have been stripped from the paragraph text (except for literal blocks etc.). For literal blocks, the common indentation has been stripped and is returned in indent() instead.
Leading newlines are returned to indicate necessary separation from the preceding paragraph.
bool gmx::RstParagraphIterator::nextParagraph | ( | ) |
Advances the iterator to the next paragraph.
false
if there were no more paragraphs.Does not throw (except std::bad_alloc if std::string::compare() throws).