本文整理汇总了C++中CIwGameString::setString方法的典型用法代码示例。如果您正苦于以下问题:C++ CIwGameString::setString方法的具体用法?C++ CIwGameString::setString怎么用?C++ CIwGameString::setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIwGameString
的用法示例。
在下文中一共展示了CIwGameString::setString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFileType
bool CIwGameFile::GetFileType(const char* file_path, CIwGameString& type)
{
int len = strlen(file_path) - 1;
const char* name_ptr = file_path + len;
// Scan backwards looking for dot
int index = 0;
while (len >= 0)
{
if (*name_ptr == '.')
{
type.setString(name_ptr + 1, index);
type.ToLower();
break;
}
else
if (len == 0)
{
type.setString(name_ptr, index + 1);
type.ToLower();
break;
}
name_ptr--;
index++;
len--;
}
return true;
}
示例2: GetNextMarkedStringAfterString
int CIwGameString::GetNextMarkedStringAfterString(const char* search_string, char start_mark, char end_mark, CIwGameString& out_string)
{
int pos = FindNext(search_string);
if (pos >= 0)
{
// Get the text label
int offset;
StepFindIndex(strlen(search_string));
int len = GetNextMarkedString(start_mark, end_mark, offset);
if (len > 0)
{
out_string.setString(getString() + offset, len);
return pos;
}
return -1;
}
return -1;
}
示例3: ExtractAdAdFonic
bool CIwGameAds::ExtractAdAdFonic(CIwGameAd& ad, CIwGameString& ad_body)
{
// We dont use a full on XML parser to parse the returned XML, instead we just search for the required info
int pos, offset, len;
ad.isHtml = false;
ad.isText = false;
ad.ImageURI = "";
ad.LinkURI = "";
ad.Text = "";
ad.AdTime = s3eTimerGetMs();
// Get Error Response
ad_body.FindReset();
pos = ad_body.FindNext("<status");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('>', '<', offset);
if (len > 0)
{
ErrorString.setString(ad_body.getString() + offset, len);
if (ErrorString == "error")
{
Error = ErrorInternalError;
return false;
}
else
Error = ErrorNone;
}
}
// Get Ad format
pos = ad_body.FindNext("<format");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('>', '<', offset);
if (len > 0)
{
CIwGameString format;
format.setString(ad_body.getString() + offset, len);
if (format == "banner")
ad.isText = false;
else
ad.isText = true;
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Format: ", ad.Text.c_str());
#endif // _DEBUG
}
}
// Get Ad text
pos = ad_body.FindNext("<![CDATA[");
if (pos >= 0)
{
int end_pos = ad_body.FindNext("]]>");
if (end_pos > 0)
{
ad.Text.setString(ad_body.getString() + pos + 9, end_pos - pos - 9);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Text: ", ad.Text.c_str());
#endif // _DEBUG
ad.isHtml = true;
}
}
ad_body.FindReset();
// Get Ad link
pos = ad_body.FindNext("url=");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('"', '"', offset);
if (len > 0)
{
ad.LinkURI.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Click URL: ", ad.LinkURI.c_str());
#endif // _DEBUG
}
}
// Get Ad image
pos = ad_body.FindNext("src=");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('"', '"', offset);
if (len > 0)
{
ad.ImageURI.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Image URL: ", ad.ImageURI.c_str());
#endif // _DEBUG
}
}
return true;
}