本文整理汇总了C++中TextStream::previousLine方法的典型用法代码示例。如果您正苦于以下问题:C++ TextStream::previousLine方法的具体用法?C++ TextStream::previousLine怎么用?C++ TextStream::previousLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextStream
的用法示例。
在下文中一共展示了TextStream::previousLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readEfpParamsSection
void QChemInput::readEfpParamsSection(TextStream& textStream)
{
EfpFragment parser;
while (!textStream.atEnd()) {
parser.loadNextFragment(textStream);
if (textStream.previousLine().contains("$end", Qt::CaseInsensitive)) break;
}
}
示例2: loadNextFragment
QString EfpFragment::loadNextFragment(TextStream& textStream)
{
QString line(textStream.previousLine());
if (!line.contains("fragment", Qt::CaseInsensitive)) {
line = textStream.seek("fragment", Qt::CaseInsensitive);
}
QStringList tokens(TextStream::tokenize(line));
QString name;
if (tokens.size() >= 2 && tokens[0].toLower() == "fragment") {
name = tokens[1];
}else {
return QString();
}
CartesianCoordinates parser;
Data::Geometry* geom(parser.parse(textStream));
if ( !geom || !parser.error().isEmpty()) {
m_errors.append("Invalid EFP file, no coordinates found");
delete geom;
return QString();
}
if (name.endsWith("_L", Qt::CaseInsensitive)) {
Data::EfpFragmentLibrary::instance().add(name, geom);
}else {
// We assume the fragment is not in the library and so we need to collect
// the additional guff so we can add it to the input file if required.
QString line;
QStringList guff;
while ( !textStream.atEnd() &&
!line.contains("fragment", Qt::CaseInsensitive) &&
!line.contains("$end", Qt::CaseInsensitive) ) {
guff << line;
}
Data::EfpFragmentLibrary::instance().add(name, geom, guff.join("\n"));
}
return name;
}