本文整理汇总了C++中CzString类的典型用法代码示例。如果您正苦于以下问题:C++ CzString类的具体用法?C++ CzString怎么用?C++ CzString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CzString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RequestAdAdFonic
//
//
//
// AdFonic specific implementation
//
//
//
bool CzAds::RequestAdAdFonic()
{
// Get device surface dimensions
Width = PLATFORM_DISPLAY->getCurrentWidth();
Height = PLATFORM_DISPLAY->getCurrentHeight();
CzString urlencoded;
RequestURI = "http://adfonic.net/ad/";
RequestURI += ApplicationID;
RequestURI += "?";
RequestURI += "r.id=";
urlencoded.URLEncode(CzString(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("");
CZ_HTTP_MANAGER->AddRequest(&AdRequest);
BusyTimer.setDuration(CZ_ADS_TIMEOUT);
return true;
}
示例2: printf
void CzUIWebView::setHtml(const char* html)
{
if (html == NULL)
return;
CzString h = html;
h.URLDecode();
printf("****************************************\n");
printf("%sn", h.c_str());
printf("****************************************\n");
if (!TempFilename.isEmpty())
{
CzFile::DeleteFile(TempFilename.c_str());
}
TempFilename = "ram://web_view_";
TempFilename += Name;
// TempFilename += CzString((int)(PLATFORM_SYS->getTimeUTC() & 0xffffffff)); // Ensure filename is unique
TempFilename += ".html";
CzFile file;
if (file.Open(TempFilename.c_str(), "wb"))
{
file.Write((void*)h.c_str(), h.getLength());
file.Close();
}
PLATFORM_UI->NavigateWebView(WebView, TempFilename.c_str());
}
示例3: FindReset
bool CzString::SplitVarIndex(CzString& var, int& index, CzString& vindex)
{
char* pData = Data;
index = -1;
FindReset();
// Split string at colon char and return value after colon
for (int t = 0; t < Length; t++)
{
if (*pData++ == ':')
{
var.setString(Data, t);
vindex.Copy(pData, 0, Length - t - 1);
if (CzString::IsNumber(*pData))
index = vindex.getAsInt();
return true;
}
}
// No split found so just copy this string to output
var = *this;
return true;
}
示例4: set
void CzString::set(const CzVec2& v)
{
FindIndex = 0;
CzString s = v.x;
s += ",";
s += v.y;
setString(s.c_str());
}
示例5: LoadFromXoml
int CzXomlLoad::LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node)
{
CzScene* scene = NULL;
if (parent->getClassTypeHash() == CzHashes::Scene_Hash)
scene = (CzScene*)parent;
CzString* file = NULL;
CzString* condition = NULL;
// Process LoadXoml specific attributes
for (CzXmlNode::_AttribIterator it = node->attribs_begin(); it != node->attribs_end(); it++)
{
unsigned int name_hash = (*it)->getName().getHash();
if (name_hash == CzHashes::File_Hash)
file = &(*it)->getValue();
else
if (name_hash == CzHashes::Condition_Hash)
condition = &(*it)->getValue();
}
if (condition != NULL)
{
// Find the condition variable
bool condition_not = false;
CzXomlVariable* var = NULL;
if (*(condition->c_str()) == '!')
{
condition_not = true;
CzString cond = condition->c_str() + 1;
var = CzXomlVariable::GetVariable(cond, scene);
}
else
var = CzXomlVariable::GetVariable(*condition, scene);
if (var != NULL)
{
bool res = var->isTrue();
if (condition_not)
res = !res;
if (!res)
return -1;
}
#if defined (_DEBUG)
else
CzDebug::Log(CZ_DEBUG_CHANNEL_WARNING, "LoadXOML - Condition variable not found - ", condition->c_str(), DebugInfo.c_str());
#endif // _DEBUG
}
if (file != NULL)
CZ_XOML->Process(parent, file->c_str(), false);
return -1;
}
示例6: getErrorString
void CzXmlParser::ShowError(eCzXmlParseError error, int pos) const
{
#ifdef SHOW_ERRORS
CzString out;
out += getErrorString(error);
out += " around line ";
// out += CzString(m_pDataInput->GetLineNumber(pos));
out += CzString(pos + 1);
CzDebug::Log(CZ_DEBUG_CHANNEL_ERROR, out.c_str());
#endif
}
示例7: getNextQuotedStringAsint
bool CzDataInput::getNextQuotedStringAsint(int *pNum)
{
CzString num;
if (getNextQuotedString(&num))
{
*pNum = num.getAsInt();
return true;
}
return false;
}
示例8: _setName
bool CzCamera::_setName(IzXomlResource* target, const CzXomlProperty& prop, bool add)
{
if (add)
{
CzString name = ((CzCamera*)target)->getName();
name += (const char*)prop.p_data;
((CzCamera*)target)->setName(name.c_str());
}
else
((CzCamera*)target)->setName((const char*)prop.p_data);
return true;
}
示例9: CzString
//
//
//
// VServ specific implementation
//
//
//
bool CzAds::RequestAdVServ()
{
// Get device surface dimensions
Width = PLATFORM_DISPLAY->getCurrentWidth();
Height = PLATFORM_DISPLAY->getCurrentHeight();
// Build M2M request URI string
RequestURI = "http://a.vserv.mobi/delivery/adapi.php?";
CzString urlencoded;
RequestURI += "zoneid=";
RequestURI += ApplicationID;
RequestURI += "&im=";
RequestURI += CzString(UDID);
RequestURI += "&lc=";
RequestURI += PLATFORM_SYS->getDeviceLocale();
RequestURI += "&app=1";
RequestURI += "&ts=1";
RequestURI += "&ua=";
urlencoded.URLEncode(UserAgent.c_str());
RequestURI += urlencoded;
if (Width != 0)
{
RequestURI += "&sw=";
RequestURI += CzString(Width);
}
if (Height != 0)
{
RequestURI += "&sh=";
RequestURI += CzString(Height);
}
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("");
CZ_HTTP_MANAGER->AddRequest(&AdRequest);
BusyTimer.setDuration(CZ_ADS_TIMEOUT);
return true;
}
示例10: _setVariable
bool CzUITextBox::_setVariable(IzXomlResource* target, const CzXomlProperty& prop, bool add)
{
CzUITextBox* actor = (CzUITextBox*)target;
if (add)
{
CzString s = actor->getTargetVariable();
s += (const char*)prop.p_data;
actor->setTargetVariable(s.c_str());
}
else
actor->setTargetVariable((const char*)prop.p_data);
return true;
}
示例11:
bool CzString::operator== (const CzString &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;
}
示例12: SaveAttributes
int CzXmlNode::SaveAttributes(CzFile* file)
{
for (CzXmlAttributeList::iterator i = Attributes.begin(); i != Attributes.end(); ++i)
{
CzString out;
out.allocString(512);
out = " ";
out += (*i)->Name.c_str();
out += "=\"";
out += (*i)->Value.c_str();
out += "\"";
if (!file->Write((void*)out.c_str(), out.getLength()))
return -1;
}
return 0;
}
示例13: SplitFilename
bool CzString::SplitFilename(CzString& filename, CzString& 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;
}
示例14: allocString
CzString::CzString(const CzString &string)
{
FindIndex = 0;
Data = NULL;
Length = 0;
Size = 0;
AutoHash = true;
if (string.c_str() == NULL)
return;
else
{
int len = (int)strlen(string.c_str());
allocString(len);
Length = len;
memcpy(Data, string.c_str(), Length + 1);
if (AutoHash)
DataHash = CzString::CalculateHash(Data);
}
}
示例15: while
CzStringList* CzXmlAttribute::getValueAsList()
{
CzStringList* pList = new CzStringList;
// 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)
{
CzString *pString = new CzString();
pString->Copy((char*)found, 0, len);
pList->push_back(pString);
}
if (c == 0) break;
}
text++;
}
return pList;
}