本文整理汇总了C++中mautil::String::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ String::resize方法的具体用法?C++ String::resize怎么用?C++ String::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mautil::String
的用法示例。
在下文中一共展示了String::resize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readStringFromResource
/*
* Read the only string from one string resource.
* Note: The parameter pos is used both for input and output
* of the position in the resource data.
* @param resID A valid resource id.
* @param pos In: The start position. Out: The position
* after the string in the resource.
* @param output The resulting string.
*/
bool ScreenImageSwiper::readStringFromResource(
MAHandle resID,
int& pos,
MAUtil::String& output) const
{
// Get all the characters on one read.
// Get the length of the string stored as a .pstring
// (Pascal string). The first byte contains the length.
byte stringLen = 0;
maReadData(resID, (void*) &stringLen, pos, sizeof(byte));
if (stringLen > maGetDataSize(resID) || stringLen <= 0)
{
return false;
}
// Read the string.
pos += sizeof(byte);
output.resize(stringLen);
maReadData(resID, (void*) output.c_str(), pos, stringLen);
// Update position to the byte after the string.
pos += stringLen;
return true;
}
示例2: getSystemProperty
int SettingsScreen::getSystemProperty(const char* key, MAUtil::String& dst) {
int size = maGetSystemProperty(key, NULL, 0);
printf("received size: %i", size);
if (size < 0)
return size;
dst.resize(size-1);
maGetSystemProperty(key, dst.pointer(), size);
return size;
}
示例3: next
int FileLister::next(MAUtil::String& dst) {
int len = maFileListNext(mList, NULL, 0);
if(len <= 0)
return len;
dst.resize(len);
len = maFileListNext(mList, dst.pointer(), len+1);
MAASSERT(len > 0);
return len;
}
示例4: getSystemProperty
int XML::getSystemProperty(const char* key, MAUtil::String& dst)
{
int size = maGetSystemProperty(key, NULL, 0);
if(size < 0)
return size;
dst.resize(size-1);
maGetSystemProperty(key, dst.pointer(), size);
return size;
}