本文整理汇总了C++中CGUIString::substr方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIString::substr方法的具体用法?C++ CGUIString::substr怎么用?C++ CGUIString::substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIString
的用法示例。
在下文中一共展示了CGUIString::substr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseNewAffector
//-----------------------------------------------------------------------
void CGUIParticleSystemManager::parseNewAffector(const CGUIString& type, DataStreamPtr& stream, CGUIParticleSystem* sys)
{
// Create new affector
CGUIParticleAffector* pAff = sys->addAffector(type);
// Parse affector details
CGUIString line;
while(!stream->eof())
{
line = stream->getLine();
// Ignore comments & blanks
if (!(line.length() == 0 || line.substr(0,2) == "//"))
{
if (line == "}")
{
// Finished affector
break;
}
else
{
// Attribute
StringUtil::toLowerCase(line);
parseAffectorAttrib(line, pAff);
}
}
}
}
示例2:
//------------------------------------------------------------------------------
std::vector<CGUIString> StringToVector(const CGUIString& rString )
{
std::vector<CGUIString> aListString;
CGUIString::size_type idx = 0;
while( idx < rString.size())
{
CGUIString::size_type ret = rString.find(",", idx);
aListString.push_back(rString.substr(idx, ret));
if( ret == CGUIString::npos )
{
break;
}
else
{
idx = ret+1;
}
}
return aListString;
}
示例3: parseScript
//-----------------------------------------------------------------------
void CGUIParticleSystemManager::parseScript(DataStreamPtr& stream, const CGUIString& groupName)
{
#if OGRE_USE_NEW_COMPILERS == 1
ScriptCompilerManager::getSingleton().parseScript(stream, groupName);
#else // OGRE_USE_NEW_COMPILERS
CGUIString line;
CGUIParticleSystem* pSys;
vector<CGUIString>::type vecparams;
pSys = 0;
while(!stream->eof())
{
line = stream->getLine();
// Ignore comments & blanks
if (!(line.length() == 0 || line.substr(0,2) == "//"))
{
if (pSys == 0)
{
// No current system
// So first valid data should be a system name
if (StringUtil::startsWith(line, "particle_system "))
{
// chop off the 'particle_system ' needed by new compilers
line = line.substr(16);
}
pSys = createTemplate(line, groupName);
pSys->_notifyOrigin(stream->getName());
// Skip to and over next {
skipToNextOpenBrace(stream);
}
else
{
// Already in a system
if (line == "}")
{
// Finished system
pSys = 0;
}
else if (line.substr(0,7) == "emitter")
{
// new emitter
// Get typename
vecparams = StringUtil::split(line, "\t ");
if (vecparams.size() < 2)
{
// Oops, bad emitter
LogManager::getSingleton().logMessage("Bad particle system emitter line: '"
+ line + "' in " + pSys->getName());
skipToNextCloseBrace(stream);
}
skipToNextOpenBrace(stream);
parseNewEmitter(vecparams[1], stream, pSys);
}
else if (line.substr(0,8) == "affector")
{
// new affector
// Get typename
vecparams = StringUtil::split(line, "\t ");
if (vecparams.size() < 2)
{
// Oops, bad affector
LogManager::getSingleton().logMessage("Bad particle system affector line: '"
+ line + "' in " + pSys->getName());
skipToNextCloseBrace(stream);
}
skipToNextOpenBrace(stream);
parseNewAffector(vecparams[1],stream, pSys);
}
else
{
// Attribute
parseAttrib(line, pSys);
}
}
}
}
#endif // OGRE_USE_NEW_COMPILERS
}