本文整理汇总了C++中CCDictionary::autorelease方法的典型用法代码示例。如果您正苦于以下问题:C++ CCDictionary::autorelease方法的具体用法?C++ CCDictionary::autorelease怎么用?C++ CCDictionary::autorelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCDictionary
的用法示例。
在下文中一共展示了CCDictionary::autorelease方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dictionaryWithContentsOfFileThreadSafe
CCDictionary<std::string, CCObject*> *CCFileUtils::dictionaryWithContentsOfFile(const char *pFileName)
{
CCDictionary<std::string, CCObject*> *ret = dictionaryWithContentsOfFileThreadSafe(pFileName);
ret->autorelease();
return ret;
}
示例2: dictionaryWithContentsOfFileThreadSafe
CCDictionary *CCFileUtils::dictionaryWithContentsOfFile(const char *pFileName)
{
//convert to full path
std::string fileFullPath;
fileFullPath = CCFileUtils::fullPathFromRelativePath(pFileName);
CCDictionary *ret = dictionaryWithContentsOfFileThreadSafe(fileFullPath.c_str());
ret->autorelease();
return ret;
}
示例3: saveToDictionary
void GridElementProperty::saveToDictionary(CCDictionary *dict)
{
stringstream strStream;
strStream << mIndex.rIndex << "_" << mIndex.vIndex;
CCDictionary *gridDict = new CCDictionary();
gridDict->setObject(DRUtility::getCCStringWithInt(mType), "mType");
gridDict->setObject(DRUtility::getCCStringWithInt(mID), "mID");
gridDict->setObject(DRUtility::getCCStringWithInt(mIndex.rIndex), "rIndex");
gridDict->setObject(DRUtility::getCCStringWithInt(mIndex.vIndex), "vIndex");
dict->setObject(gridDict, strStream.str());
gridDict->autorelease();
}
示例4: createCCDictionaryWithData
CCDictionary* createCCDictionaryWithData(unsigned char* data)
{
CCAssert((data),"data must not be NULL!!!");
CCDictMaker tMaker;
CCDictionary* dict = tMaker.dictionaryWithData(data);
if (dict != NULL)
{
dict->autorelease();
}
CC_SAFE_DELETE_ARRAY(data);
return dict;
}
示例5: startElement
void startElement(void *ctx, const XML_Char *name, const XML_Char **atts)
{
std::string sName((char*)name);
if( sName == "dict" )
{
CCDictionary<std::string, CCObject*> *pNewDict = new CCDictionary<std::string, CCObject*>();
if(! m_pRootDict)
{
m_pRootDict = pNewDict;
pNewDict->autorelease();
}
else
{
CCAssert(m_pCurDict && !m_sCurKey.empty(), "");
m_pCurDict->setObject(pNewDict, m_sCurKey);
pNewDict->release();
m_sCurKey.clear();
}
m_pCurDict = pNewDict;
m_tDictStack.push(m_pCurDict);
m_tState = SAX_DICT;
}
else if(sName == "key")
{
m_tState = SAX_KEY;
}
else if(sName == "integer")
{
m_tState = SAX_INT;
}
else if(sName == "real")
{
m_tState = SAX_REAL;
}
else if(sName == "string")
{
m_tState = SAX_STRING;
}
else
{
if (sName == "array")
{
m_bInArray = true;
m_pArray = new CCMutableArray<CCObject*>();
}
m_tState = SAX_NONE;
}
}
示例6: plist_startElement
void plist_startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
{
CCDictMaker *pMaker = (CCDictMaker*)(ctx);
std::string sName((char*)name);
if( sName == "dict" )
{
CCDictionary<std::string, CCObject*> *pNewDict = new CCDictionary<std::string, CCObject*>();
if(! pMaker->m_pRootDict)
{
pMaker->m_pRootDict = pNewDict;
pNewDict->autorelease();
}
else
{
CCAssert(pMaker->m_pCurDict && !pMaker->m_sCurKey.empty(), "");
pMaker->m_pCurDict->setObject(pNewDict, pMaker->m_sCurKey);
pNewDict->release();
pMaker->m_sCurKey.clear();
}
pMaker->m_pCurDict = pNewDict;
pMaker->m_tDictStack.push(pMaker->m_pCurDict);
pMaker->m_tState = SAX_DICT;
}
else if(sName == "key")
{
pMaker->m_tState = SAX_KEY;
}
else if(sName == "integer")
{
pMaker->m_tState = SAX_INT;
}
else if(sName == "real")
{
pMaker->m_tState = SAX_REAL;
}
else if(sName == "string")
{
pMaker->m_tState = SAX_STRING;
}
else
{
pMaker->m_tState = SAX_NONE;
}
}
示例7: startElement
void startElement(void *ctx, const char *name, const char **atts)
{
CC_UNUSED_PARAM(ctx);
CC_UNUSED_PARAM(atts);
std::string sName((char*)name);
if( sName == "dict" )
{
m_pCurDict = new CCDictionary<std::string, CCObject*>();
if(! m_pRootDict)
{
m_pRootDict = m_pCurDict;
}
m_tState = SAX_DICT;
CCSAXState preState = SAX_NONE;
if (! m_tStateStack.empty())
{
preState = m_tStateStack.top();
}
if (SAX_ARRAY == preState)
{
// add the dictionary into the array
m_pArray->addObject(m_pCurDict);
}
else if (SAX_DICT == preState)
{
// add the dictionary into the pre dictionary
CCAssert(! m_tDictStack.empty(), "The state is wrong!");
CCDictionary<std::string, CCObject*>* pPreDict = m_tDictStack.top();
pPreDict->setObject(m_pCurDict, m_sCurKey);
}
m_pCurDict->autorelease();
// record the dict state
m_tStateStack.push(m_tState);
m_tDictStack.push(m_pCurDict);
}
else if(sName == "key")
{
m_tState = SAX_KEY;
}
else if(sName == "integer")
{
m_tState = SAX_INT;
}
else if(sName == "real")
{
m_tState = SAX_REAL;
}
else if(sName == "string")
{
m_tState = SAX_STRING;
}
else if (sName == "array")
{
m_tState = SAX_ARRAY;
m_pArray = new CCMutableArray<CCObject*>();
CCSAXState preState = m_tStateStack.empty() ? SAX_DICT : m_tStateStack.top();
if (preState == SAX_DICT)
{
m_pCurDict->setObject(m_pArray, m_sCurKey);
}
else if (preState == SAX_ARRAY)
{
CCAssert(! m_tArrayStack.empty(), "The state is worng!");
CCMutableArray<CCObject*>* pPreArray = m_tArrayStack.top();
pPreArray->addObject(m_pArray);
}
m_pArray->release();
// record the array state
m_tStateStack.push(m_tState);
m_tArrayStack.push(m_pArray);
}
else
{
m_tState = SAX_NONE;
}
}