当前位置: 首页>>代码示例>>C++>>正文


C++ tstring::size方法代码示例

本文整理汇总了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;
}
开发者ID:syzh120,项目名称:CCPDFConverter,代码行数:40,代码来源:PrinterInstall.cpp

示例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));
}
开发者ID:GlenDC,项目名称:tt--Engine,代码行数:9,代码来源:SpriteFont.cpp

示例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;
}
开发者ID:PhilColbert,项目名称:LK8000,代码行数:9,代码来源:devCProbe.cpp

示例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++;
	}
}
开发者ID:wyrover,项目名称:miranda-ng,代码行数:10,代码来源:std_string_utils.cpp


注:本文中的std::tstring::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。