本文整理汇总了C++中ogre::String::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ String::clear方法的具体用法?C++ String::clear怎么用?C++ String::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::String
的用法示例。
在下文中一共展示了String::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitBaseFilename
//-----------------------------------------------------------------------
void StringUtil::splitBaseFilename(const Ogre::String& fullName,
Ogre::String& outBasename, Ogre::String& outExtention)
{
size_t i = fullName.find_last_of(".");
if (i == Ogre::String::npos)
{
outExtention.clear();
outBasename = fullName;
}
else
{
outExtention = fullName.substr(i+1);
outBasename = fullName.substr(0, i);
}
}
示例2: position
//.........这里部分代码省略.........
}
else // if quote is open already
{
// check if it is the matching character to close it
if(current_quote == ch)
{
// close quote and reset the quote character
quoted = false;
current_quote = 0;
// don't add the quote-char to the token
add_char = false;
}
}
}
}
// if the delimiter isn't preserved
if(delimiters.empty() == false && escaped == false && quoted == false)
{
// if a delimiter is provided and the char isn't protected by
// quote or escape char
if(delimiters.find_first_of(ch) != std::string::npos)
{
// if ch is a delimiter and the token string isn't empty
// the token is complete
if(token.empty() == false)
{
token_complete = true;
}
// don't add the delimiter to the token
add_char = false;
}
}
// if the delimiter is preserved - add it as a token
bool add_delimiter = false;
if(delimiters_preserve.empty() == false && escaped == false && quoted == false)
{
// if a delimiter which will be preserved is provided and the
// char isn't protected by quote or escape char
if(delimiters_preserve.find_first_of(ch) != std::string::npos)
{
// if ch is a delimiter and the token string isn't empty the token is complete
if(token.empty() == false)
{
token_complete = true;
}
// don't add the delimiter to the token
add_char = false;
// add the delimiter
delimiter = ch;
add_delimiter = true;
}
}
// add the character to the token
if(add_char == true)
{
// add the current char
token.push_back(ch);
}
// add the token if it is complete
if(token_complete == true && token.empty() == false)
{
// add the token string
ret.push_back(token);
// clear the contents
token.clear();
// build the next token
token_complete = false;
}
// add the delimiter
if(add_delimiter == true)
{
// the next token is the delimiter
Ogre::String delim_token;
delim_token.push_back(delimiter);
ret.push_back(delim_token);
}
// repeat for the next character
++pos;
}
// add the final token
if(token.empty() == false)
{
ret.push_back(token);
}
return ret;
}