本文整理汇总了C++中std::tstring::size方法的典型用法代码示例。如果您正苦于以下问题:C++ tstring::size方法的具体用法?C++ tstring::size怎么用?C++ tstring::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::tstring
的用法示例。
在下文中一共展示了tstring::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConcatPaths
/**
@param sFolder Folder to combine
@param sPathname Path to combine (probably relative to sFolder)
@param bAllowAbsoluteOverride true to allow sPathname to have an absolute path, false to make sure it's relative
@return The combined path
*/
std::tstring ConcatPaths(const std::tstring& sFolder, const std::tstring& sPathname, bool bAllowAbsoluteOverride /* = true */)
{
// Do we have a folder?
if (sFolder.empty())
// No, return the second part alone
return sPathname;
// Do we have a path?
if (sPathname.empty())
// No, return the first part alone
return sFolder;
// Allow overriding paths by using a drive letter and colon (c:) or a UNC path (\\)
if (bAllowAbsoluteOverride)
if ((sPathname.size() > 2) && (sPathname[1] == ':') || ((sPathname[0] == '\\') && (sPathname[1] == '\\')))
return sPathname;
std::tstring sRet = sFolder;
// Make sure we have a slash at the end of the folder part
CHAR c = sFolder[sFolder.size()-1];
if ((c != '\\') && (c != '/'))
sRet += _T("\\");
// Make sure we don't have a slash at the beginning of the path part:
c = sPathname[0];
if ((c == '\\') || (c == '/'))
// We do, jump over it
sRet += sPathname.substr(1);
else
// Just add them
sRet += sPathname;
return sRet;
}
示例2: DrawText
void SpriteFont::DrawText(const std::tstring& text, tt::Vector2 position, const tt::Vector4& color)
{
if(m_NrOfCharsToDraw += text.size() > sc_MaxNrOfChars)
throw exception();
MyServiceLocator::GetInstance()->GetService<IGraphicsService>()->GetSpriteBatch()->AddSpriteFont(this);
m_TextQueue.push_back(TextData(text, position, color));
}
示例3: SetDeviceName
BOOL CDevCProbe::SetDeviceName( PDeviceDescriptor_t d, const std::tstring& strName ){
if (d && d->Com && strName.size() <= 15) {
d->Com->WriteString(TEXT("$PCPILOT,C,SET,"));
d->Com->WriteString(strName.c_str());
d->Com->WriteString(TEXT("\r\n"));
return GetDeviceName(d);
}
return FALSE;
}
示例4:
void utils::text::treplace_all(std::tstring* data, const std::tstring &from, const std::tstring &to)
{
std::tstring::size_type position = 0;
while ((position = data->find(from, position)) != std::tstring::npos)
{
data->replace(position, from.size(), to);
position++;
}
}