本文整理汇总了C++中IFstream::good方法的典型用法代码示例。如果您正苦于以下问题:C++ IFstream::good方法的具体用法?C++ IFstream::good怎么用?C++ IFstream::good使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFstream
的用法示例。
在下文中一共展示了IFstream::good方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readTag
// Reads past -1 and reads element type
label readTag(IFstream& is)
{
string tag;
do
{
if (!is.good())
{
return -1;
}
string line;
is.getLine(line);
if (line.size() < 6)
{
return -1;
}
tag = line.substr(0, 6);
} while (tag == SEPARATOR);
return readLabel(IStringStream(tag)());
}
示例2: abort
bool Foam::meshReaders::STARCD::readHeader(IFstream& is, word fileSignature)
{
if (!is.good())
{
FatalErrorInFunction
<< abort(FatalError);
}
word header;
label majorVersion;
is >> header;
is >> majorVersion;
// skip the rest of the line
readToNewline(is);
// add other checks ...
if (header != fileSignature)
{
Info<< "header mismatch " << fileSignature << " " << is.name()
<< endl;
}
return true;
}
示例3: while
// Read up to line starting with cmd. Sets args to rest of line.
// Returns true if found, false if stream is not good anymore.
bool Foam::fileFormats::AC3DsurfaceFormatCore::cueTo
(
IFstream& is,
const string& cmd,
string& args
)
{
while (is.good())
{
string line;
is.getLine(line);
string::size_type space = line.find(' ');
if (space != string::npos)
{
if (line.substr(0, space) == cmd)
{
args = line.substr(space+1);
return true;
}
}
}
return false;
}
示例4: while
Foam::string Foam::fileFormats::surfaceFormatsCore::getLineNoComment
(
IFstream& is
)
{
string line;
do
{
is.getLine(line);
}
while ((line.empty() || line[0] == '#') && is.good());
return line;
}
示例5: skipSection
// Skip
void skipSection(IFstream& is)
{
Info<< "Skipping section at line " << is.lineNumber() << '.' << endl;
string line;
while (is.good())
{
is.getLine(line);
if (isSeparator(line))
{
break;
}
}
}
示例6: skipSection
// Skips till end of section. Returns false if end of file.
bool skipSection(IFstream& inFile)
{
string line;
do
{
inFile.getLine(line);
if (!inFile.good())
{
return false;
}
}
while (line.size() < 4 || line.substr(0, 4) != "$End");
return true;
}
示例7: readHeader
// Reads and prints header
void readHeader(IFstream& is)
{
string line;
while (is.good())
{
is.getLine(line);
if (isSeparator(line))
{
break;
}
else
{
Sout<< line << endl;
}
}
}
示例8: readCmd
static bool readCmd(IFstream& ACfile, string& cmd, string& args)
{
if (ACfile.good())
{
string line;
ACfile.getLine(line);
string::size_type space = line.find(' ');
if (space != string::npos)
{
cmd = line.substr(0, space);
args = line.substr(space+1);
return true;
}
}
return false;
}
示例9: IFstream
Foam::Istream* Foam::IOobject::objectStream(const fileName& fName)
{
if (fName.size())
{
IFstream* isPtr = new IFstream(fName);
if (isPtr->good())
{
return isPtr;
}
else
{
delete isPtr;
return NULL;
}
}
else
{
return NULL;
}
}
示例10: while
// Read up to line starting with cmd. Sets args to rest of line.
// Returns true if found, false if stream is not good anymore.
static bool readUpto
(
const string& cmd,
IFstream& ACfile,
string& args
)
{
while (ACfile.good())
{
string line;
ACfile.getLine(line);
string::size_type space = line.find(' ');
if (space != string::npos && line.substr(0, space) == cmd)
{
args = line.substr(space+1);
return true;
}
}
return false;
}
示例11: filePath
Foam::Istream* Foam::IOobject::objectStream()
{
fileName fName = filePath();
if (fName.size())
{
IFstream* isPtr = new IFstream(fName);
if (isPtr->good())
{
return isPtr;
}
else
{
delete isPtr;
return NULL;
}
}
else
{
return NULL;
}
}
示例12:
bool Foam::fileFormats::AC3DsurfaceFormatCore::readCmd
(
IFstream& is,
string& cmd,
string& args
)
{
if (is.good())
{
string line;
is.getLine(line);
string::size_type space = line.find(' ');
if (space != string::npos)
{
cmd = line.substr(0, space);
args = line.substr(space+1);
return true;
}
}
return false;
}