本文整理汇总了C++中NxsToken::StripWhitespace方法的典型用法代码示例。如果您正苦于以下问题:C++ NxsToken::StripWhitespace方法的具体用法?C++ NxsToken::StripWhitespace怎么用?C++ NxsToken::StripWhitespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxsToken
的用法示例。
在下文中一共展示了NxsToken::StripWhitespace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleFormat
//.........这里部分代码省略.........
missing = token.GetToken()[0];
ignoreCaseAssumed = true;
standardDataTypeAssumed = true;
}
else if (token.Equals("SYMBOLS") || token.Equals("SYMBOL"))
{
NxsDiscreteStateCell numDefStates;
unsigned maxNewStates;
switch(datatype)
{
case NxsCharactersBlock::dna:
case NxsCharactersBlock::rna:
case NxsCharactersBlock::nucleotide:
numDefStates = 4;
maxNewStates = NCL_MAX_STATES-4;
break;
case NxsCharactersBlock::protein:
numDefStates = 21;
maxNewStates = NCL_MAX_STATES-21;
break;
default:
numDefStates = 0; // replace symbols list for standard datatype
symbols[0] = '\0';
maxNewStates = NCL_MAX_STATES;
}
DemandEquals(token, "after keyword SYMBOLS");
// This should be the symbols list
token.SetLabileFlagBit(NxsToken::doubleQuotedToken);
token.GetNextToken();
token.StripWhitespace();
unsigned numNewSymbols = token.GetTokenLength();
if (numNewSymbols > maxNewStates)
{
errormsg = "SYMBOLS defines ";
errormsg += numNewSymbols;
errormsg += " new states but only ";
errormsg += maxNewStates;
errormsg += " new states allowed for this DATATYPE";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}
NxsString to = token.GetToken();
unsigned tlen = (unsigned)to.size();
NxsString processedS;
// Check to make sure user has not used any symbols already in the
// default symbols list for this data type
for (unsigned i = 0; i < tlen; i++)
{
if (IsInSymbols(to[i]))
{
errormsg = "The character ";
errormsg << to[i] << " defined in SYMBOLS is predefined for this DATATYPE and shoud not occur in a SYMBOLS subcommand of a FORMAT command.";
if (nexusReader)
{
nexusReader->NexusWarnToken(errormsg, NxsReader::SKIPPING_CONTENT_WARNING, token);
errormsg.clear();
}
}
else
processedS += to[i];
}