本文整理汇总了C++中TextStream::seek方法的典型用法代码示例。如果您正苦于以下问题:C++ TextStream::seek方法的具体用法?C++ TextStream::seek怎么用?C++ TextStream::seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextStream
的用法示例。
在下文中一共展示了TextStream::seek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readNextDeclaration
void PovRay::readNextDeclaration(TextStream& textStream, Data::PovRay* povray)
{
// looks for '#declare TextureName = '
const QRegExp declare("^#declare\\s+(\\S+)\\s?=");
QString line(textStream.nextLine());
if (!line.contains(declare)) line = textStream.seek(declare);
if (!textStream.atEnd() && declare.indexIn(line) > -1) {
QString name(declare.cap(1));
// remove the initial IQmol_Texture_
name.remove(0,14);
name.replace("_", " ");
line = textStream.nextBlock();
povray->addTexture(name,line);
}
}
示例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;
}