本文整理汇总了C++中Istream::eof方法的典型用法代码示例。如果您正苦于以下问题:C++ Istream::eof方法的具体用法?C++ Istream::eof怎么用?C++ Istream::eof使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Istream
的用法示例。
在下文中一共展示了Istream::eof方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool Foam::entry::getKeyword(keyType& keyword, Istream& is)
{
token keywordToken;
// Read the next valid token discarding spurious ';'s
do
{
if
(
is.read(keywordToken).bad()
|| is.eof()
|| !keywordToken.good()
)
{
return false;
}
}
while (keywordToken == token::END_STATEMENT);
// If the token is a valid keyword set 'keyword' return true...
if (keywordToken.isWord())
{
keyword = keywordToken.wordToken();
return true;
}
else if (keywordToken.isString())
{
// Enable wildcards
keyword = keywordToken.stringToken();
return true;
}
// If it is the end of the dictionary or file return false...
else if (keywordToken == token::END_BLOCK || is.eof())
{
return false;
}
// Otherwise the token is invalid
else
{
cerr<< "--> FOAM Warning : " << std::endl
<< " From function "
<< "entry::getKeyword(keyType&, Istream&)" << std::endl
<< " in file " << __FILE__
<< " at line " << __LINE__ << std::endl
<< " Reading " << is.name().c_str() << std::endl
<< " found " << keywordToken << std::endl
<< " expected either " << token::END_BLOCK << " or EOF"
<< std::endl;
return false;
}
}
示例2: if
void Foam::functionEntries::ifeqEntry::skipUntil
(
DynamicList<filePos>& stack,
const dictionary& parentDict,
const word& endWord,
Istream& is
)
{
while (!is.eof())
{
token t;
readToken(t, is);
if (t.isWord())
{
if (t.wordToken() == "#if" || t.wordToken() == "#ifeq")
{
stack.append(filePos(is.name(), is.lineNumber()));
skipUntil(stack, parentDict, "#endif", is);
stack.remove();
}
else if (t.wordToken() == endWord)
{
return;
}
}
}
FatalIOErrorInFunction(parentDict)
<< "Did not find matching " << endWord << exit(FatalIOError);
}
示例3: schemeName
tmp<limitedSurfaceInterpolationScheme<Type> >
limitedSurfaceInterpolationScheme<Type>::New
(
const fvMesh& mesh,
const surfaceScalarField& faceFlux,
Istream& schemeData
)
{
if (surfaceInterpolation::debug)
{
Info<< "limitedSurfaceInterpolationScheme<Type>::New"
"(const fvMesh&, const surfaceScalarField&, Istream&) : "
"constructing limitedSurfaceInterpolationScheme<Type>"
<< endl;
}
if (schemeData.eof())
{
FatalIOErrorIn
(
"limitedSurfaceInterpolationScheme<Type>::New"
"(const fvMesh&, const surfaceScalarField&, Istream&)",
schemeData
) << "Discretisation scheme not specified"
<< endl << endl
<< "Valid schemes are :" << endl
<< MeshConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
word schemeName(schemeData);
typename MeshFluxConstructorTable::iterator constructorIter =
MeshFluxConstructorTablePtr_->find(schemeName);
if (constructorIter == MeshFluxConstructorTablePtr_->end())
{
FatalIOErrorIn
(
"limitedSurfaceInterpolationScheme<Type>::New"
"(const fvMesh&, const surfaceScalarField&, Istream&)",
schemeData
) << "Unknown discretisation scheme " << schemeName
<< endl << endl
<< "Valid schemes are :" << endl
<< MeshFluxConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return constructorIter()(mesh, faceFlux, schemeData);
}
示例4: schemeName
tmp<lnGradScheme<Type> > lnGradScheme<Type>::New
(
const faMesh& mesh,
Istream& schemeData
)
{
if (fa::debug)
{
Info<< "lnGradScheme<Type>::New(const faMesh&, Istream&)"
" : constructing lnGradScheme<Type>"
<< endl;
}
if (schemeData.eof())
{
FatalIOErrorIn
(
"lnGradScheme<Type>::New(const faMesh&, Istream&)",
schemeData
) << "Discretisation scheme not specified"
<< endl << endl
<< "Valid schemes are :" << endl
<< MeshConstructorTablePtr_->toc()
<< exit(FatalIOError);
}
word schemeName(schemeData);
typename MeshConstructorTable::iterator constructorIter =
MeshConstructorTablePtr_->find(schemeName);
if (constructorIter == MeshConstructorTablePtr_->end())
{
FatalIOErrorIn
(
"lnGradScheme<Type>::New(const faMesh&, Istream&)",
schemeData
) << "Unknown discretisation scheme " << schemeName
<< endl << endl
<< "Valid schemes are :" << endl
<< MeshConstructorTablePtr_->toc()
<< exit(FatalIOError);
}
return constructorIter()(mesh, schemeData);
}
示例5: while
void Foam::functionEntries::ifeqEntry::readToken(token& t, Istream& is)
{
// Skip dummy tokens - avoids entry::getKeyword consuming #else, #endif
do
{
if
(
is.read(t).bad()
|| is.eof()
|| !t.good()
)
{
return;
}
}
while (t == token::END_STATEMENT);
}
示例6: schemeName
tmp<divScheme<Type> > divScheme<Type>::New
(
const fvMesh& mesh,
Istream& schemeData
)
{
if (fv::debug)
{
Info<< "divScheme<Type>::New(const fvMesh&, Istream&) : "
"constructing divScheme<Type>"
<< endl;
}
if (schemeData.eof())
{
FatalIOErrorIn
(
"divScheme<Type>::New(const fvMesh&, Istream&)",
schemeData
) << "Div scheme not specified" << endl << endl
<< "Valid div schemes are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
const word schemeName(schemeData);
typename IstreamConstructorTable::iterator cstrIter =
IstreamConstructorTablePtr_->find(schemeName);
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalIOErrorIn
(
"divScheme<Type>::New(const fvMesh&, Istream&)",
schemeData
) << "unknown div scheme "
<< schemeName << nl << nl
<< "Valid div schemes are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return cstrIter()(mesh, schemeData);
}
示例7: schemeName
tmp<convectionScheme<Type> > convectionScheme<Type>::New
(
const fvMesh& mesh,
const surfaceScalarField& faceFlux,
Istream& schemeData
)
{
if (fv::debug)
{
Info<< "convectionScheme<Type>::New"
"(const fvMesh&, const surfaceScalarField&, Istream&) : "
"constructing convectionScheme<Type>"
<< endl;
}
if (schemeData.eof())
{
FatalIOErrorInFunction
(
schemeData
) << "Convection scheme not specified" << endl << endl
<< "Valid convection schemes are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
const word schemeName(schemeData);
typename IstreamConstructorTable::iterator cstrIter =
IstreamConstructorTablePtr_->find(schemeName);
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalIOErrorInFunction
(
schemeData
) << "Unknown convection scheme " << schemeName << nl << nl
<< "Valid convection schemes are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return cstrIter()(mesh, faceFlux, schemeData);
}
示例8: schemeName
tmp<laplacianScheme<Type, GType> > laplacianScheme<Type, GType>::New
(
const fvMesh& mesh,
Istream& schemeData
)
{
if (fv::debug)
{
Info<< "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&) : "
"constructing laplacianScheme<Type, GType>"
<< endl;
}
if (schemeData.eof())
{
FatalIOErrorIn
(
"laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
schemeData
) << "Laplacian scheme not specified" << endl << endl
<< "Valid laplacian schemes are :" << endl
<< IstreamConstructorTablePtr_->toc()
<< exit(FatalIOError);
}
word schemeName(schemeData);
typename IstreamConstructorTable::iterator cstrIter =
IstreamConstructorTablePtr_->find(schemeName);
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalIOErrorIn
(
"laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
schemeData
) << "unknown laplacian scheme " << schemeName << endl << endl
<< "Valid laplacian schemes are :" << endl
<< IstreamConstructorTablePtr_->toc()
<< exit(FatalIOError);
}
return cstrIter()(mesh, schemeData);
}
示例9: schemeName
tmp<snGradScheme<Type>> snGradScheme<Type>::New
(
const fvMesh& mesh,
Istream& schemeData
)
{
if (fv::debug)
{
InfoInFunction << "Constructing snGradScheme<Type>" << endl;
}
if (schemeData.eof())
{
FatalIOErrorInFunction
(
schemeData
) << "Discretisation scheme not specified"
<< endl << endl
<< "Valid schemes are :" << endl
<< MeshConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
const word schemeName(schemeData);
typename MeshConstructorTable::iterator constructorIter =
MeshConstructorTablePtr_->find(schemeName);
if (constructorIter == MeshConstructorTablePtr_->end())
{
FatalIOErrorInFunction
(
schemeData
) << "Unknown discretisation scheme "
<< schemeName << nl << nl
<< "Valid schemes are :" << endl
<< MeshConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return constructorIter()(mesh, schemeData);
}