本文整理汇总了C++中Istream::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Istream::name方法的具体用法?C++ Istream::name怎么用?C++ Istream::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Istream
的用法示例。
在下文中一共展示了Istream::name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: rawFName
bool Foam::functionEntries::includeEntry::execute
(
dictionary& parentDict,
Istream& is
)
{
const fileName rawFName(is);
const fileName fName
(
includeFileName(is.name().path(), rawFName, parentDict)
);
IFstream ifs(fName);
if (ifs)
{
if (Foam::functionEntries::includeEntry::log)
{
Info<< fName << endl;
}
parentDict.read(ifs);
return true;
}
else
{
FatalIOErrorInFunction
(
is
) << "Cannot open include file "
<< (ifs.name().size() ? ifs.name() : rawFName)
<< " while reading dictionary " << parentDict.name()
<< exit(FatalIOError);
return false;
}
}
示例3: 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;
}
}
示例4: entry
Foam::primitiveEntry::primitiveEntry(const keyType& key, Istream& is)
:
entry(key),
ITstream
(
is.name() + '.' + key,
tokenList(10),
is.format(),
is.version()
)
{
readEntry(dictionary::null, is);
}
示例5: fName
Foam::fileName Foam::functionEntries::includeEntry::includeFileName
(
Istream& is
)
{
fileName fName(is);
fName.expand();
if (fName.empty() || fName.isAbsolute())
{
return fName;
}
else
{
// relative name
return fileName(is.name()).path()/fName;
}
}
示例6: mfIter
bool Foam::functionEntry::execute
(
const word& functionName,
const dictionary& parentDict,
primitiveEntry& entry,
Istream& is
)
{
is.fatalCheck
(
"functionEntry::execute"
"(const word&, const dictionary&, primitiveEntry&, Istream&)"
);
if (!executeprimitiveEntryIstreamMemberFunctionTablePtr_)
{
cerr<<"functionEntry::execute"
<< "(const word&, const dictionary&, primitiveEntry&, Istream&)"
<< " not yet initialized, function = "
<< functionName.c_str() << std::endl;
// return true to keep reading anyhow
return true;
}
executeprimitiveEntryIstreamMemberFunctionTable::iterator mfIter =
executeprimitiveEntryIstreamMemberFunctionTablePtr_->find(functionName);
if (mfIter == executeprimitiveEntryIstreamMemberFunctionTablePtr_->end())
{
FatalErrorIn
(
"functionEntry::execute"
"(const word&, const dictionary&, primitiveEntry&, Istream&)"
) << "Unknown functionEntry '" << functionName
<< "' in " << is.name() << " near line " << is.lineNumber()
<< endl << endl
<< "Valid functionEntries are :" << endl
<< executeprimitiveEntryIstreamMemberFunctionTablePtr_->toc()
<< exit(FatalError);
}
return mfIter()(parentDict, entry, is);
}
示例7: fName
Foam::fileName Foam::functionEntries::includeEntry::includeFileName
(
Istream& is,
const dictionary& dict
)
{
fileName fName(is);
// Substitute dictionary and environment variables. Allow empty
// substitutions.
stringOps::inplaceExpand(fName, dict, true, true);
if (fName.empty() || fName.isAbsolute())
{
return fName;
}
else
{
// relative name
return fileName(is.name()).path()/fName;
}
}
示例8: expand
bool Foam::functionEntries::ifeqEntry::execute
(
DynamicList<filePos>& stack,
dictionary& parentDict,
Istream& is
)
{
const label nNested = stack.size();
stack.append(filePos(is.name(), is.lineNumber()));
// Read first token and expand any string
token cond1(is);
cond1 = expand(parentDict, cond1);
// Read second token and expand any string
token cond2(is);
cond2 = expand(parentDict, cond2);
const bool equal = equalToken(cond1, cond2);
// Info<< "Using #" << typeName << " " << cond1
// << " == " << cond2
// << " at line " << stack.last().second()
// << " in file " << stack.last().first() << endl;
bool ok = ifeqEntry::execute(equal, stack, parentDict, is);
if (stack.size() != nNested)
{
FatalIOErrorInFunction(parentDict)
<< "Did not find matching #endif for condition starting"
<< " at line " << stack.last().second()
<< " in file " << stack.last().first() << exit(FatalIOError);
}
return ok;
}
示例9: firstToken
bool Foam::IOobject::readHeader(Istream& is)
{
if (IOobject::debug)
{
Info<< "IOobject::readHeader(Istream&) : reading header for file "
<< is.name() << endl;
}
// Check Istream not already bad
if (!is.good())
{
if (rOpt_ == MUST_READ || rOpt_ == MUST_READ_IF_MODIFIED)
{
FatalIOErrorIn("IOobject::readHeader(Istream&)", is)
<< " stream not open for reading essential object from file "
<< is.name()
<< exit(FatalIOError);
}
if (IOobject::debug)
{
SeriousIOErrorIn("IOobject::readHeader(Istream&)", is)
<< " stream not open for reading from file "
<< is.name() << endl;
}
return false;
}
token firstToken(is);
if
(
is.good()
&& firstToken.isWord()
&& firstToken.wordToken() == "FoamFile"
)
{
dictionary headerDict(is);
is.version(headerDict.lookup("version"));
is.format(headerDict.lookup("format"));
headerClassName_ = word(headerDict.lookup("class"));
const word headerObject(headerDict.lookup("object"));
if (IOobject::debug && headerObject != name())
{
IOWarningIn("IOobject::readHeader(Istream&)", is)
<< " object renamed from "
<< name() << " to " << headerObject
<< " for file " << is.name() << endl;
}
// The note entry is optional
headerDict.readIfPresent("note", note_);
}
else
{
SeriousIOErrorIn("IOobject::readHeader(Istream&)", is)
<< "First token could not be read or is not the keyword 'FoamFile'"
<< nl << nl << "Check header is of the form:" << nl << endl;
writeHeader(Info);
return false;
}
// Check stream is still OK
if (is.good())
{
objState_ = GOOD;
}
else
{
if (rOpt_ == MUST_READ || rOpt_ == MUST_READ_IF_MODIFIED)
{
FatalIOErrorIn("IOobject::readHeader(Istream&)", is)
<< " stream failure while reading header"
<< " on line " << is.lineNumber()
<< " of file " << is.name()
<< " for essential object" << name()
<< exit(FatalIOError);
}
if (IOobject::debug)
{
Info<< "IOobject::readHeader(Istream&) :"
<< " stream failure while reading header"
<< " on line " << is.lineNumber()
<< " of file " << is.name() << endl;
}
objState_ = BAD;
return false;
}
if (IOobject::debug)
{
Info<< " .... read" << endl;
//.........这里部分代码省略.........