本文整理汇总了C++中StringBuilder::parseInt方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuilder::parseInt方法的具体用法?C++ StringBuilder::parseInt怎么用?C++ StringBuilder::parseInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuilder
的用法示例。
在下文中一共展示了StringBuilder::parseInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
bool ParseData::parse(StringBuilder& sb)
{
if( sb.size() < 107 )
return false;
phi = (short)sb.parseInt(5,4);
psi = (short)sb.parseInt(10,4);
ASSERT(
180 >= phi &&
-180 <= phi &&
180 >= psi &&
-180 <= psi,
ParseException, "Phi/Psi range error");
rotID.setTo(sb, 24, 7 );
rotID.removeAll(' ');
ASSERT(rotID.size() == 4, ParseException, "RotID is bad");
probability = (float)sb.parseDouble(33, 8);
float chi;
chis.clear();
chi = (float)sb.parseDouble( 42, 7 );
if( chi != 0.0 ) // As a coder, this line makes me vomit, but unfortunatly their library is written this way. Eugh!
chis.push_back(chi);
chi = (float)sb.parseDouble( 50, 7 );
if( chi != 0.0 ) // Why could they not have a gap, or at least use NULL or something ?!?
chis.push_back(chi);
chi = (float)sb.parseDouble( 58, 7 );
if( chi != 0.0 )
chis.push_back(chi);
chi = (float)sb.parseDouble( 66, 7 );
if( chi != 0.0 )
chis.push_back(chi);
return true;
}
示例2: readDefinition
void RotLibConvert_Dunbrack_BBInd::readDefinition( StringBuilder& sb, RotamerLibrary& _RotLib ) const
{
ASSERT( sb.size() >= 67, ParseException, "String too short to parse!!");
StringBuilder resname(3);
resname.setTo( sb, 0, 3 );
sb.TruncateLeftBy(18);
int pdbCount = sb.parseInt(0,7);
if( pdbCount == 0 )
return;
double probability = sb.parseDouble(7,8);
sb.TruncateLeftBy(37);
std::vector<double> importChis;
std::vector<std::string> parts = sb.tokenise();
ASSERT( (parts.size() % 2 == 0), ParseException, "Unexpected element count");
for( size_t i = 0; i < parts.size(); i+=2 )
{
double chi;
ASSERT( 0 == str2double( parts[i], chi ), ParseException, "Error parsing chi def");
importChis.push_back(Maths::DegToRad(chi));
}
ASSERT( importChis.size() != 0, ParseException, "No chis found!!");
_RotLib.addRotamer( resname.toString(), importChis, ConstantProbability( probability ) );
}