Provide optional trimmed version of Lexer::getString and getDocString

Prerequisite to fix #9518
This commit is contained in:
Juergen Spitzmueller 2015-05-19 10:15:34 +02:00
parent 9f55ce9b04
commit cf44bb842b
2 changed files with 6 additions and 6 deletions

View File

@ -695,23 +695,23 @@ double Lexer::getFloat() const
}
string const Lexer::getString() const
string const Lexer::getString(bool trim) const
{
lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
if (lastReadOk_)
return pimpl_->getString();
return trim ? support::trim(pimpl_->getString(), "\t ") : pimpl_->getString();
return string();
}
docstring const Lexer::getDocString() const
docstring const Lexer::getDocString(bool trim) const
{
lastReadOk_ = pimpl_->status == LEX_DATA || pimpl_->status == LEX_TOKEN;
if (lastReadOk_)
return pimpl_->getDocString();
return trim ? support::trim(pimpl_->getDocString(), "\t ") : pimpl_->getDocString();
return docstring();
}

View File

@ -137,9 +137,9 @@ public:
///
double getFloat() const;
///
std::string const getString() const;
std::string const getString(bool trim = false) const;
///
docstring const getDocString() const;
docstring const getDocString(bool trim = false) const;
/** Get a long string, ended by the tag `endtag'.
This string can span several lines. The first line
serves as a template for how many spaces the lines