本文整理汇总了C++中mautil::String::append方法的典型用法代码示例。如果您正苦于以下问题:C++ String::append方法的具体用法?C++ String::append怎么用?C++ String::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mautil::String
的用法示例。
在下文中一共展示了String::append方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EscapeHelper
/**
* Helper function that escapes a string.
*/
static MAUtil::String EscapeHelper(const MAUtil::String& str)
{
// The encoded string.
MAUtil::String result = "";
char buf[8];
for (int i = 0; i < str.length(); ++i)
{
char c = str[i];
if ((48 <= c && c <= 57) || // 0-9
(65 <= c && c <= 90) || // a..z
(97 <= c && c <= 122)) // A..Z
{
result.append(&str[i], 1);
}
else
{
result += "%";
sprintf(buf, "%02X", str[i]);
result += buf;
}
}
return result;
}
示例2: getPropertyString
/**
* Widget override.
* Get a widget property as a string, setting also the result code.
*/
MAUtil::String FacebookWebView::getPropertyString( const MAUtil::String& property ) const
{
char *buffer = new char[BUFFER_SIZE];
int result = maWidgetGetProperty(this->getWidgetHandle(), property.c_str(), buffer, BUFFER_SIZE);
MAUtil::String temp;
if( result == MAW_RES_INVALID_STRING_BUFFER_SIZE)
{
delete []buffer;
int newBufferSize = 2*BUFFER_SIZE;
buffer = new char[newBufferSize];
result = maWidgetGetProperty(this->getWidgetHandle(), property.c_str(), buffer, newBufferSize);
}
if( result == RES_OK)
{
temp.append(buffer, BUFFER_SIZE);
}
delete []buffer;
return temp;
}
示例3: _readSettings
/**
* \brief This function is used for reading the settings from the settings file
*/
void SettingsManager::_readSettings()
{
char settingsFileContent[Model::BUFF_SIZE];
MAUtil::String content;
int fileSize = maFileSize(_settingsFile);
maFileRead(_settingsFile, settingsFileContent, fileSize);
content.append(settingsFileContent, strlen(settingsFileContent));
int offset = 0;
int position = content.find("|", offset);
_coin = content.substr(offset, position); //read the coin
offset = position + 1;
position = content.find("|", offset);
int day = MAUtil::stringToInteger(content.substr(offset, position - offset), 10); //read the reset day
offset = position + 1;
position = content.find("|", offset);
MAUtil::String dateString = content.substr(offset, position - offset); //read the dateString
offset = position + 1;
position = content.find("|", offset);
MAUtil::String binaryMask = content.substr(offset, position - offset); //read the binary mask
offset = position + 1;
_debtValue = MAUtil::stringToDouble(content.substr(offset, content.length() - offset));
if(binaryMask == "100")
{
_showAll = true;
_showMonthly = false;
_showFromDate = false;
}
else if(binaryMask == "010")
{
_showAll = false;
_showMonthly = true;
_showFromDate = false;
}
else if(binaryMask == "001")
{
_showAll = false;
_showMonthly = false;
_showFromDate = true;
}
if(_showMonthly)
{
_date._day = day;
struct tm * dateTime = new tm;
split_time(maTime(), dateTime);
_date._mounth = dateTime->tm_mon + 1;
_date._year = dateTime->tm_year + 1900;
delete dateTime;
}
else if(_showFromDate)
{
offset = 0;
position = dateString.find("-", offset);
_date._year = MAUtil::stringToInteger(dateString.substr(offset, position), 10);
offset = position + 1;
position = dateString.find("-", offset);
_date._mounth = MAUtil::stringToInteger(dateString.substr(offset, position - offset), 10);
offset = position + 1;
_date._day = MAUtil::stringToInteger(dateString.substr(offset, dateString.length() - offset), 10);
}
else if(_showAll)
{
_date._day = 1;
_date._mounth = 1;
_date._year = 1601;
}
}