本文整理汇总了C++中Istream::readBeginList方法的典型用法代码示例。如果您正苦于以下问题:C++ Istream::readBeginList方法的具体用法?C++ Istream::readBeginList怎么用?C++ Istream::readBeginList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Istream
的用法示例。
在下文中一共展示了Istream::readBeginList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: firstToken
void Foam::HashPtrTable<T, Key, Hash>::read(Istream& is, const INew& inewt)
{
is.fatalCheck("HashPtrTable<T, Key, Hash>::read(Istream&, const INew&)");
token firstToken(is);
is.fatalCheck
(
"HashPtrTable<T, Key, Hash>::read(Istream&, const INew&) : "
"reading first token"
);
if (firstToken.isLabel())
{
label s = firstToken.labelToken();
// Read beginning of contents
char delimiter = is.readBeginList("HashPtrTable<T, Key, Hash>");
if (s)
{
if (2*s > this->tableSize_)
{
this->resize(2*s);
}
if (delimiter == token::BEGIN_LIST)
{
for (label i=0; i<s; i++)
{
Key key;
is >> key;
this->insert(key, inewt(key, is).ptr());
is.fatalCheck
(
"HashPtrTable<T, Key, Hash>::"
"read(Istream&, const INew&) : reading entry"
);
}
}
else
{
FatalIOErrorIn
(
"HashPtrTable<T, Key, Hash>::read(Istream&, const INew&)",
is
) << "incorrect first token, '(', found " << firstToken.info()
<< exit(FatalIOError);
}
}
示例2: firstToken
void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
{
is.fatalCheck
(
"LPtrList<LListBase, T>::read(Istream&, const INew&)"
);
token firstToken(is);
is.fatalCheck
(
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
"reading first token"
);
if (firstToken.isLabel())
{
label s = firstToken.labelToken();
// Read beginning of contents
char delimiter = is.readBeginList("LPtrList<LListBase, T>");
if (s)
{
if (delimiter == token::BEGIN_LIST)
{
for (label i=0; i<s; ++i)
{
this->append(iNew(is).ptr());
is.fatalCheck
(
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
"reading entry"
);
}
}
else
{
T* tPtr = iNew(is).ptr();
this->append(tPtr);
is.fatalCheck
(
"LPtrList<LListBase, T>::read(Istream&, const INew&) : "
"reading entry"
);
for (label i=1; i<s; ++i)
{
this->append(tPtr->clone().ptr());
}
}
}
// Read end of contents
is.readEndList("LPtrList<LListBase, T>");
}
else if (firstToken.isPunctuation())
{
if (firstToken.pToken() != token::BEGIN_LIST)
{
FatalIOErrorIn
(
"LPtrList<LListBase, T>::read(Istream&, const INew&)",
is
) << "incorrect first token, '(', found " << firstToken.info()
<< exit(FatalIOError);
}
token lastToken(is);
is.fatalCheck("LPtrList<LListBase, T>::read(Istream&, const INew&)");
while
(
!(
lastToken.isPunctuation()
&& lastToken.pToken() == token::END_LIST
)
)
{
is.putBack(lastToken);
this->append(iNew(is).ptr());
is >> lastToken;
is.fatalCheck
(
"LPtrList<LListBase, T>::read(Istream&, const INew&)"
);
}
}
else
{