本文整理汇总了C++中Tstring::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Tstring::insert方法的具体用法?C++ Tstring::insert怎么用?C++ Tstring::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tstring
的用法示例。
在下文中一共展示了Tstring::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
virtual size_t read(void * buf, size_t maxLength)
{
size_t const lLength = MvStoreSerialization::PrimitivesOutDbg::mymin(mLength - mSeek, maxLength);
if ( lLength == 0 ) return 0 ;
for (size_t i = 0; i < lLength; i++)
((char*)buf)[i] = getCharAt(mSeek + i, mStartChar);
// Algorithm below assumes read is only called once (it could be fixed
// if this is found not to be the case)
if ( rndm < maxLength )
{
//insert my search string at the offset rndm in the stream
//(i.e. 0 for begining).
Tstring tmpString = srchString;
tmpString.insert(0," ");
tmpString += " " ;
// If this fails we are about to do a buffer overrun because we need to insert the
// string too near the end of the buffer. This is just a unlikely bug in the test
assert( rndm + tmpString.length() < maxLength ) ;
// memcpy instread of string copy so that the string terminator isn't copied
memcpy((char*)buf+rndm,tmpString.c_str(), tmpString.length());
}
else
{
// Need to add it in a later call to read
rndm -= maxLength ;
}
mSeek += lLength; // Position for the next read calls
return lLength;
}