本文整理汇总了C++中CIwGameString::GetNextMarkedString方法的典型用法代码示例。如果您正苦于以下问题:C++ CIwGameString::GetNextMarkedString方法的具体用法?C++ CIwGameString::GetNextMarkedString怎么用?C++ CIwGameString::GetNextMarkedString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIwGameString
的用法示例。
在下文中一共展示了CIwGameString::GetNextMarkedString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractLinkAndImageFromtHTML
bool CIwGameAds::ExtractLinkAndImageFromtHTML(CIwGameAd& ad, CIwGameString& html)
{
int pos, offset;
// Check to see if the html has a clickable link
pos = html.Find("href=");
if (pos > 0)
{
// Get the click link
int idx = html.getFindIndex();
int len = html.GetNextMarkedString('"', '"', offset);
if (len < 0)
{
html.setFindIndex(idx);
len = html.GetNextMarkedString('\'', '\'', offset);
}
if (len > 0)
{
ad.LinkURI.setString(html.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Link URL: ", ad.LinkURI.c_str());
#endif // _DEBUG
// Check to see if the html has an image available
pos = html.Find("img ");
if (pos > 0)
{
// Grab the image url
pos = html.FindNext("src=");
if (pos > 0)
{
idx = html.getFindIndex();
len = html.GetNextMarkedString('"', '"', offset);
if (len < 0)
{
html.setFindIndex(idx);
len = html.GetNextMarkedString('\'', '\'', offset);
}
if (len > 0)
{
ad.ImageURI.setString(html.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Image URL: ", ad.ImageURI.c_str());
#endif // _DEBUG
return true;
}
}
}
}
}
return false;
}
示例2: ExtractAdAdModa
bool CIwGameAds::ExtractAdAdModa(CIwGameAd& ad, CIwGameString& ad_body)
{
int len, offset;
ad.isHtml = false;
ad.isText = false;
ad.ImageURI = "";
ad.LinkURI = "";
ad.Text = "";
ad.AdTime = s3eTimerGetMs();
ad_body.FindReset();
// Get Ad image
len = ad_body.GetNextMarkedString('|', '|', offset);
if (len > 0)
{
ad.ImageURI.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Image: ", ad.ImageURI.c_str());
#endif // _DEBUG
}
ad_body.StepFindIndex(-1);
// Get Ad link
len = ad_body.GetNextMarkedString('|', '|', offset);
if (len > 1)
{
ad.LinkURI.setString(ad_body.getString() + offset, len - 1);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Click URL: ", ad.LinkURI.c_str());
#endif // _DEBUG
}
if (ad.ImageURI.IsEmpty() || ad.LinkURI.IsEmpty())
return false;
return true;
}
示例3: ExtractAdInnerActive
bool CIwGameAds::ExtractAdInnerActive(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 = HtmlAds;
ad.isText = false;
ad.ImageURI = "";
ad.LinkURI = "";
ad.Text = "";
ad.AdTime = s3eTimerGetMs();
// Get Error Response
ad_body.FindReset();
pos = ad_body.FindNext("<tns:Response Error=");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('"', '"', offset);
if (len > 0)
{
ErrorFromResponse(ad_body.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Response: ", ErrorString.c_str());
#endif // _DEBUG
}
}
// Get Client ID (we store this for future ad requests during the same session)
pos = ad_body.FindNext("<tns:Client Id=");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('"', '"', offset);
if (len > 0)
{
ClientID.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Client ID: ", ClientID.c_str());
#endif // _DEBUG
}
}
// Get Ad text
pos = ad_body.FindNext("<tns:Text");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('>', '<', offset);
if (len > 0)
{
ad.Text.setString(ad_body.getString() + offset, len);
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Text: ", ad.Text.c_str());
#endif // _DEBUG
}
}
// Get Ad link
pos = ad_body.FindNext("<tns: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("<tns:Image");
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;
}
示例4: 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;
}
示例5: ExtractAdMobFox
bool CIwGameAds::ExtractAdMobFox(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("<request type=");
if (pos >= 0)
{
len = ad_body.GetNextMarkedString('"', '"', offset);
if (len > 0)
{
ErrorString.setString(ad_body.getString() + offset, len);
if (ErrorString == "noAd")
{
Error = ErrorNoAd;
return false;
}
else
Error = ErrorNone;
if (ErrorString == "textAd")
{
ad.isHtml = true;
ad.isText = true;
}
}
}
// Get Ad text
pos = ad_body.FindNext("<htmlString>");
if (pos >= 0)
{
// Find closeing tag
int end_pos = ad_body.FindNext("</htmlString>");
if (end_pos > 0)
{
ad.Text.setString(ad_body.getString() + pos, end_pos - pos);
ad.Text.ReplaceHTMLCodes();
#if defined(_DEBUG)
CIwGameError::LogError("Info: Ad Text: ", ad.Text.c_str());
#endif // _DEBUG
}
// If we can successfully extract the link and banner information from the text ad then unmark the ad as html/text
if (ExtractLinkAndImageFromtHTML(ad, ad.Text))
{
ad.isHtml = false;
ad.isText = false;
return true;
}
}
else
ad_body.FindReset();
// Get Ad link
pos = ad_body.FindNext("<clickurl");
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("<imageurl");
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;
}