本文整理汇总了C++中CIwGameString类的典型用法代码示例。如果您正苦于以下问题:C++ CIwGameString类的具体用法?C++ CIwGameString怎么用?C++ CIwGameString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CIwGameString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: IwGxGetScreenWidth
//
//
//
// AdFonic specific implementation
//
//
//
bool CIwGameAds::RequestAdAdFonic()
{
// Get device surface dimensions
Width = IwGxGetScreenWidth();
Height = IwGxGetScreenHeight();
CIwGameString urlencoded;
RequestURI = "http://adfonic.net/ad/";
RequestURI += ApplicationID;
RequestURI += "?";
RequestURI += "r.id=";
urlencoded.URLEncode(CIwGameString(UDID).c_str());
RequestURI += urlencoded;
RequestURI += "&s.test=0";
RequestURI += "&t.format=xml";
if (!ExtraInfo.IsEmpty())
{
RequestURI += ExtraInfo;
}
AdRequest.setGET();
AdRequest.setURI(RequestURI.c_str());
AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
AdRequest.SetHeader("User-Agent", UserAgent.c_str());
AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
AdRequest.setBody("");
IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);
return true;
}
示例3: s3eDebugOutputString
void CIwGameXmlParser::ShowError(eXMLParserError error, int pos) const
{
#ifdef SHOW_ERRORS
s3eDebugOutputString(GetErrorString(error));
s3eDebugOutputString(" at line ");
CIwGameString num = CIwGameString(m_pDataInput->GetLineNumber(pos));
s3eDebugOutputString(num.c_str());
#endif
}
示例4: getParameter2
//
//
//
//
// CIwGameCommandIfVar Implementation
//
//
//
//
bool CIwGameCommandIfVar::Execute(float dt)
{
if (!IIwGameCommandExecutor::Execute(dt))
return false;
CIwGame* game = NULL;
CIwGameScene* scene = NULL;
CIwGameActor* actor = NULL;
unsigned int class_hash = Program->getManager()->getParent()->getClassTypeHash();
if (class_hash == CIwGameXomlNames::Game_Hash)
game = (CIwGame*)Program->getManager()->getParent();
else
if (class_hash == CIwGameXomlNames::Scene_Hash)
scene = (CIwGameScene*)Program->getManager()->getParent();
if (game != NULL)
scene = game->findScene(Params[3].getHash());
IIwGameXomlResource* cont = (actor != NULL) ? (IIwGameXomlResource*)actor : (IIwGameXomlResource*)scene;
CIwGameXomlVariable* var = CIwGameXomlVariable::GetVariable(Params[0], scene);
if (var != NULL)
{
CIwGameString op = getParameter2(cont);
op.ToLower();
if (op == "==")
ReturnValue = (int)var->checkCondition(CO_Equal, getParameter3(cont));
else
if (op == "!=")
ReturnValue = (int)var->checkCondition(CO_NotEqual, getParameter3(cont));
else
if (op == "gt")
ReturnValue = (int)var->checkCondition(CO_Greater, getParameter3(cont));
else
if (op == "lt")
ReturnValue = (int)var->checkCondition(CO_Less, getParameter3(cont));
else
if (op == "gte")
ReturnValue = (int)var->checkCondition(CO_GreaterEqual, getParameter3(cont));
else
if (op == "lte")
ReturnValue = (int)var->checkCondition(CO_LessEqual, getParameter3(cont));
else
if (op == "and")
ReturnValue = (int)var->checkCondition(CO_And, getParameter3(cont));
else
CIwGameError::LogError("Warning: IfVar command - operator invalid - ", op.c_str());
}
else
CIwGameError::LogError("Warning: IfVar command - variable not found - ", Params[0].c_str());
return false;
}
示例5: CIwGameString
//
//
//
// MillennialMedia specific implementation
//
//
//
bool CIwGameAds::RequestAdMillennialMedia()
{
// Build M2M request URI string
//RequestURI = "http://ads.mp.mydas.mobi/getAd.php5?";
RequestURI = "http://ads.mydas.mobi/getAd?";
CIwGameString urlencoded;
RequestURI += "apid=";
RequestURI += ApplicationID;
RequestURI += "&auid=";
RequestURI += CIwGameString(UDID);
RequestURI += "&ua=";
urlencoded.URLEncode(UserAgent.c_str());
RequestURI += urlencoded;
// RequestURI += "&mode=test";
// RequestURI += "&uip=";
// RequestURI += IW_GAME_HTTP_MANAGER->getIPAddress();
if (UserAge != 0)
{
RequestURI += "&age=";
RequestURI += CIwGameString(UserAge);
}
if (UserGender != GenderInvalid)
{
if (UserGender == GenderFemale)
RequestURI += "&gender=female";
else
RequestURI += "&gender=male";
}
if (!ExtraInfo.IsEmpty())
{
RequestURI += ExtraInfo;
}
AdRequest.setGET();
AdRequest.setURI(RequestURI.c_str());
AdRequest.setContentAvailableCallback(&AdInfoRetrievedCallback, NULL);
AdRequest.SetHeader("User-Agent", UserAgent.c_str());
AdRequest.SetHeader("Accept", "application/xml");
AdRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
AdRequest.SetHeader("Content-Length", "0");
AdRequest.setBody("");
IW_GAME_HTTP_MANAGER->AddRequest(&AdRequest);
BusyTimer.setDuration(IW_GAME_ADS_TIMEOUT);
return true;
}
示例6: defined
bool CIwGameUITextView::InitView(bool native_res, float min_scale, float max_scale)
{
TextActor->setTappable(false);
#if defined(_DEBUG)
CIwGameString name = Name;
name += "text";
TextActor->setName(name.c_str());
#endif // _DEBUG
Area = TextActor->getSize();
MinZoom = min_scale;
MaxZoom = max_scale;
return true;
}
示例7:
bool CIwGameString::operator== (const CIwGameString &op)
{
if (Data == NULL)
return false;
if (AutoHash && op.isAutohash())
{
if (DataHash == op.getHash())
return true;
}
else
{
if (strcmp(op.c_str(), Data) == 0)
return true;
}
return false;
}
示例8: UpdateAttribute
void CIwGameXmlNode::UpdateAttribute(CIwGameString& name, const char* value)
{
CIwGameXmlAttribute* old_attribute = GetAttribute(name.c_str());
if (old_attribute == NULL)
{
// Attribute was not present so add
CIwGameXmlAttribute* attribute = CIwGameXmlParser::AllocAttribute();
attribute->setName((char*)name.c_str(), name.GetLength());
attribute->setValue((char*)value, strlen(value));
Attributes.push_back(attribute);
}
else
{
// Attribute was present so update it
old_attribute->setName((char*)name.c_str(), name.GetLength());
old_attribute->setValue((char*)value, strlen(value));
}
}
示例9: SplitFilename
bool CIwGameString::SplitFilename(CIwGameString& filename, CIwGameString& ext)
{
int index = 0;
// Find the dot
for (int t = GetLength() - 1; t != 0; t--)
{
if (*(Data + t) == '.')
{
index = t;
break;
}
}
if (index == 0) return false;
filename.Copy(Data, 0, index);
ext.Copy(Data, index + 1, GetLength() - index - 1);
return true;
}
示例10: IwHashString
CIwGameString::CIwGameString(const CIwGameString &string)
{
FindIndex = 0;
Data = NULL;
AutoHash = true;
if (string.c_str() == NULL)
{
Length = 0;
Size = 0;
}
else
{
int len = (int)strlen(string.c_str());
allocString(len);
Length = len;
strcpy(Data, string.c_str());
if (AutoHash)
DataHash = IwHashString(Data);
}
}
示例11: setProperty
bool CIwGameUITextView::setProperty(unsigned int element_name, CIwGameString& data, bool delta)
{
if (CIwGameUIBase::setProperty(element_name, data, delta))
return true;
if (element_name == CIwGameXomlNames::MinZoom_Hash)
{
if (delta)
setMinZoom(MinZoom + data.GetAsFloat());
else
setMinZoom(data.GetAsFloat());
}
else
if (element_name == CIwGameXomlNames::MaxZoom_Hash)
{
if (delta)
setMaxZoom(MaxZoom + data.GetAsFloat());
else
setMaxZoom(data.GetAsFloat());
}
else
if (element_name == CIwGameXomlNames::Zoom_Hash)
{
if (delta)
setZoom(Zoom + data.GetAsFloat());
else
setZoom(data.GetAsFloat());
}
else
return false;
return true;
}
示例12: while
CIwGameXmlStringList* CIwGameXmlAttribute::GetValueAsList()
{
CIwGameXmlStringList* pList = new CIwGameXmlStringList;
// Separate Value by commas
int len = Value.GetLength();
const char* text = Value.c_str();
char c;
while ((c = *text++) != 0)
{
// Find a none white space
if (c != ' ' && c != '\t' && c != '\n' && c != ',')
{
int count = 0;
const char* found = text;
// Find end of string
while (count++ < 63)
{
c = *text;
if (c == '\n' || c == ',' || c == 0)
break;
text++;
}
int len = text - found;
if (len > 0)
{
CIwGameString *pString = new CIwGameString();
pString->Copy((char*)found, 0, len);
pList->push_back(pString);
}
}
}
return pList;
}
示例13: setProperty
bool CIwGameUISlider::setProperty(unsigned int element_name, CIwGameString& data, bool delta)
{
if (CIwGameUIBase::setProperty(element_name, data, delta))
return true;
float float_pool[8];
if (element_name == CIwGameXomlNames::SliderSize_Hash)
{
SliderSize = data.GetAsInt();
}
else
if (element_name == CIwGameXomlNames::Value_Hash)
{
Value = data.GetAsFloat();
}
else
if (element_name == CIwGameXomlNames::ValueRange_Hash)
{
data.GetAsListOfFloat(float_pool);
ValueRange.x = float_pool[0];
ValueRange.y = float_pool[1];
}
else
if (element_name == CIwGameXomlNames::SliderType_Hash)
{
unsigned int type_hash = data.getHash();
if (type_hash == IW_GAME_HASH("vertical"))
SliderType = SliderType_Vertical;
else
SliderType = SliderType_Horizontal;
}
else
return false;
return true;
}
示例14: 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;
}
示例15: 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;
}