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

#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...

Constructor & Destructor Documentation

gmx::RstParagraphIterator::RstParagraphIterator ( const std::string &  text)

Initializes an iterator for given input text.

Does not throw.

Member Function Documentation

void gmx::RstParagraphIterator::getParagraphText ( std::string *  result) const

Returns the text.

[out]resultVariable to receive the paragraph text.
std::bad_allocif 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).

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