本文整理汇总了C++中NxsToken::SetEOFAllowed方法的典型用法代码示例。如果您正苦于以下问题:C++ NxsToken::SetEOFAllowed方法的具体用法?C++ NxsToken::SetEOFAllowed怎么用?C++ NxsToken::SetEOFAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxsToken
的用法示例。
在下文中一共展示了NxsToken::SetEOFAllowed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SwapEquivalentTaxaBlock
/*! Called internally when the NxsReader has found the correct NxsBlock to read
a block in a file.
`token` will be at the block ID.
`currBlockName` will be the block ID as a string.
`currentBlock` will be the block reader to be used
`sourceOfBlock` is the factory that created the block (or 0L). If sourceOfBlock
is not NULL then it will be alerted if the block is skipped (BlockSkipped() method)
or there was an error in the read (BlockError() method). The factory is expected
to delete the block instances in these cases (NxsReader will not refer to those
instances again).
The following steps occur:
- the EnteringBlock hook is called (if it returns false, the block will be skipped by calling
NxsReader::SkippingBlock
- NxsBlock::Reset() is called on the reader block
- NxsBlock::Read() method of the reader block is called
- If an exception is generated, the NexusError is called.
- If no exception is generated by Read then the block is processed:
- if NxsReader::cullIdenticalTaxaBlocks(true) has been called before Execute and this
is a repeated TAXA block, the block will be deleted.
- the BlockReadHook() will store all of the implied blocks
(by calling NxsBlock::GetImpliedBlocks()) and the block itself.
- if one of the implied blocks is a repeated TAXA block and
NxsReader::cullIdenticalTaxaBlocks(true) has been called, then
the blocks NxsBlock::SwapEquivalentTaxaBlock() method will determine
whether or not the duplicate taxa block can be deleted.
- each stored block will generate a call to NxsReader::AddBlockToUsedBlockList()
- ExitingBlock() is called
- PostBlockReadingHook() is called
*/
bool NxsReader::ExecuteBlock(NxsToken &token, const NxsString &currBlockName, NxsBlock *currentBlock, NxsBlockFactory * sourceOfBlock)
{
if (!EnteringBlock(currBlockName))
{
SkippingBlock(currBlockName);
if (sourceOfBlock)
{
sourceOfBlock->BlockSkipped(currentBlock);
}
if (!ReadUntilEndblock(token, currBlockName))
{
token.SetBlockName(0L);
token.SetEOFAllowed(true);
return false;
}
return true;
}
this->RemoveBlockFromUsedBlockList(currentBlock);
currentBlock->Reset();
// We need to back up currentBlock, because the Read statement might trigger
// a recursive call to Execute (if the block contains instructions to execute
// another file, then the same NxsReader object may be used and any member fields (e.g. currentBlock)
// could be trashed.
//
bool eofFound = false;
try
{
try
{
currentBlock->Read(token);
}
catch (NxsX_UnexpectedEOF &eofx)
{
if (!currentBlock->TolerateEOFInBlock())
{
throw eofx;
}
NxsString m;
m << "Unexpected End of file in " << currBlockName << "block";
currentBlock->WarnDangerousContent(m, token);
eofFound = true;
}
if (destroyRepeatedTaxaBlocks && currBlockName.EqualsCaseInsensitive("TAXA"))
{
NxsTaxaBlockAPI * oldTB = this->GetOriginalTaxaBlock((NxsTaxaBlockAPI *) currentBlock);
if (oldTB)
{
const std::string altTitle = currentBlock->GetTitle();
this->RegisterAltTitle(oldTB, altTitle);
if (sourceOfBlock)
{
sourceOfBlock->BlockError(currentBlock);
}
return true;
}
}
BlockReadHook(currBlockName, currentBlock, &token);
}
catch (NxsException &x)
{
NxsString m;
if (currentBlock->errormsg.length() > 0)
{
m = currentBlock->errormsg;
}
else
{
//.........这里部分代码省略.........
示例2: CoreExecutionTasks
/*! used internally to do most of the work of Execute() */
void NxsReader::CoreExecutionTasks(
NxsToken &token, /* the token object used to grab NxsReader tokens */
bool notifyStartStop) /* if true, ExecuteStarting and ExecuteStopping will be called */
{
unsigned numSigInts = NxsReader::getNumSignalIntsCaught();
const bool checkingSignals = NxsReader::getNCLCatchesSignals();
lastExecuteBlocksInOrder.clear();
currBlock = NULL;
NxsString errormsg;
token.SetEOFAllowed(true);
try
{
token.SetLabileFlagBit(NxsToken::saveCommandComments);
token.GetNextToken();
}
catch (NxsException x)
{
NexusError(token.errormsg, 0, 0, 0);
return;
}
if (token.Equals("#NEXUS"))
{
token.SetLabileFlagBit(NxsToken::saveCommandComments);
token.GetNextToken();
}
else
{
errormsg = "Expecting #NEXUS to be the first token in the file, but found ";
errormsg += token.GetToken();
errormsg += " instead";
/*mth changed this to a warning instead of an error because of the large number
of files that violate this requirement.
*/
NexusWarn(errormsg, NxsReader::AMBIGUOUS_CONTENT_WARNING, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
if (notifyStartStop)
{
ExecuteStarting();
}
bool keepReading = true;
for (; keepReading && !token.AtEOF(); )
{
if (checkingSignals && NxsReader::getNumSignalIntsCaught() != numSigInts)
{
throw NxsSignalCanceledParseException("Reading NEXUS content");
}
if (token.Equals("BEGIN"))
{
token.SetEOFAllowed(false); /*must exit the block before and EOF*/
token.GetNextToken();
token.SetBlockName(token.GetTokenReference().c_str());
for (currBlock = blockList; currBlock != NULL; currBlock = currBlock->next)
{
if (currBlock->CanReadBlockType(token))
{
break;
}
}
NxsString currBlockName = token.GetToken();
currBlockName.ToUpper();
NxsBlockFactory * sourceOfBlock = NULL;
if (currBlock == NULL)
{
try
{
currBlock = CreateBlockFromFactories(currBlockName, token, &sourceOfBlock);
}
catch (NxsException x)
{
NexusError(x.msg, x.pos, x.line, x.col);
token.SetBlockName(0L);
token.SetEOFAllowed(true);
return;
}
}
if (currBlock == NULL)
{
SkippingBlock(currBlockName);
if (!ReadUntilEndblock(token, currBlockName))
{
token.SetBlockName(0L);
token.SetEOFAllowed(true);
return;
}
}
else if (currBlock->IsEnabled())
{
keepReading = ExecuteBlock(token, currBlockName, currBlock, sourceOfBlock);
}
else
{
SkippingDisabledBlock(token.GetToken());
if (sourceOfBlock)
{
//.........这里部分代码省略.........