本文整理汇总了C++中CCArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ CCArray::end方法的具体用法?C++ CCArray::end怎么用?C++ CCArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCArray
的用法示例。
在下文中一共展示了CCArray::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecurseSave
void RecurseSave(TiXmlNode * pParentNode, CCObject * pParentObj)
{
if (pParentObj->isOfClass(CCObject::ClassOfCCDictionary))
{
TiXmlElement * pDictElement = new TiXmlElement("dict");
pParentNode->LinkEndChild(pDictElement);
CCDictionary * pDict = (CCDictionary *)pParentObj;
for (CCDictionary::iterator it = pDict->begin(); it != pDict->end(); it++)
{
TiXmlElement * pKeyElement = new TiXmlElement("key");
{
TiXmlText * pKeyText = new TiXmlText(it->first.c_str());
pKeyElement->LinkEndChild(pKeyText);
}
pDictElement->LinkEndChild(pKeyElement);
CCObject * pObject = it->second;
RecurseSave(pDictElement, pObject);
}
}
else if (pParentObj->isOfClass(CCObject::ClassOfCCArray))
{
TiXmlElement * pArrayElement = new TiXmlElement("array");
pParentNode->LinkEndChild(pArrayElement);
CCArray * pValue = (CCArray *)pParentObj;
for (CCArray::iterator it = pValue->begin(); it != pValue->end(); it++)
{
CCObject * pObject = *it;
RecurseSave(pArrayElement, pObject);
}
}
else if (pParentObj->isOfClass(CCObject::ClassOfCCString))
{
CCString * pValue = (CCString *)pParentObj;
TiXmlElement * pValueElement = new TiXmlElement("string");
{
TiXmlText * pValueText = new TiXmlText(ConvertToAString(pValue->c_str()).c_str());
pValueElement->LinkEndChild(pValueText);
}
pParentNode->LinkEndChild(pValueElement);
}
else if (pParentObj->isOfClass(CCObject::ClassOfCCBool))
{
CCBool * pValue = (CCBool *)pParentObj;
TiXmlElement * pValueElement = new TiXmlElement(*pValue ? "true" : "false");
pParentNode->LinkEndChild(pValueElement);
}
else if (pParentObj->isOfClass(CCObject::ClassOfCCInteger))
{
CCInteger * pValue = (CCInteger *)pParentObj;
TiXmlElement * pValueElement = new TiXmlElement("integer");
{
char szBuf[64] = {0};
sprintf(szBuf, "%d", (int)(*pValue));
TiXmlText * pValueText = new TiXmlText(szBuf);
pValueElement->LinkEndChild(pValueText);
}
pParentNode->LinkEndChild(pValueElement);
}
else if (pParentObj->isOfClass(CCObject::ClassOfCCReal))
{
CCReal * pValue = (CCReal *)pParentObj;
TiXmlElement * pValueElement = new TiXmlElement("real");
{
TiXmlText * pValueText = new TiXmlText(FloatToString((double)(*pValue)));
pValueElement->LinkEndChild(pValueText);
}
pParentNode->LinkEndChild(pValueElement);
}
else if (pParentObj->isOfClass(CCObject::ClassOfCCDate))
{
CCDate * pValue = (CCDate *)pParentObj;
TiXmlElement * pValueElement = new TiXmlElement("date");
{
char szBuf[64] = {0};
getTimeString(*pValue, szBuf);
TiXmlText * pValueText = new TiXmlText(szBuf);
pValueElement->LinkEndChild(pValueText);
}
pParentNode->LinkEndChild(pValueElement);
}
}