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; }