当前位置: 首页>>代码示例>>C++>>正文


C++ CCString::release方法代码示例

本文整理汇总了C++中CCString::release方法的典型用法代码示例。如果您正苦于以下问题:C++ CCString::release方法的具体用法?C++ CCString::release怎么用?C++ CCString::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCString的用法示例。


在下文中一共展示了CCString::release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: endElement

 void endElement(void *ctx, const char *name)
 {
     CC_UNUSED_PARAM(ctx);
     CCSAXState curState = m_tStateStack.empty() ? SAX_DICT : m_tStateStack.top();
     std::string sName((char*)name);
     if( sName == "dict" )
     {
         m_tStateStack.pop();
         m_tDictStack.pop();
         if ( !m_tDictStack.empty())
         {
             m_pCurDict = m_tDictStack.top();
         }
     }
     else if (sName == "array")
     {
         m_tStateStack.pop();
         m_tArrayStack.pop();
         if (! m_tArrayStack.empty())
         {
             m_pArray = m_tArrayStack.top();
         }
     }
     else if (sName == "true")
     {
         CCString *str = new CCString("1");
         if (SAX_ARRAY == curState)
         {
             m_pArray->addObject(str);
         }
         else if (SAX_DICT == curState)
         {
             m_pCurDict->setObject(str, m_sCurKey);
         }
         str->release();
     }
     else if (sName == "false")
     {
         CCString *str = new CCString("0");
         if (SAX_ARRAY == curState)
         {
             m_pArray->addObject(str);
         }
         else if (SAX_DICT == curState)
         {
             m_pCurDict->setObject(str, m_sCurKey);
         }
         str->release();
     }
     m_tState = SAX_NONE;
 }
开发者ID:QiMa,项目名称:Cocos2dWindows,代码行数:51,代码来源:CCFileUtils.cpp

示例2: textHandler

    void textHandler(void *ctx, const char *ch, int len)
    {
        if (m_tState == SAX_NONE)
        {
            return;
        }
        CCString *pText = new CCString();
        pText->m_sString = std::string((char*)ch,0,len);

        switch(m_tState)
        {
        case SAX_KEY:
            m_sCurKey = pText->m_sString;
            break;
        case SAX_INT:
        case SAX_REAL:
        case SAX_STRING:
            {
                CCAssert(!m_sCurKey.empty(), "not found key : <integet/real>");

                if (m_bInArray)
                {
                    m_pArray->addObject(pText);
                }
                else
                {
                    m_pCurDict->setObject(pText, m_sCurKey);
                }
                break;
            }
        }
        pText->release();
    }
开发者ID:daoopp,项目名称:WebGame,代码行数:33,代码来源:CCFileUtils.cpp

示例3: plist_characters

void plist_characters(void *ctx, const xmlChar *ch, int len)
{
 	CCDictMaker * pMaker = (CCDictMaker*)(ctx);
	if (pMaker->m_tState == SAX_NONE)
	{
		return;
	}
 	CCString *pText = new CCString();
	pText->m_sString = std::string((char*)ch,0,len);

 	switch(pMaker->m_tState)
 	{
 	case SAX_KEY:
 		pMaker->m_sCurKey = pText->m_sString;
 		break;
 	case SAX_INT:
 	case SAX_REAL:
 	case SAX_STRING:
 		{
 			CCAssert(!pMaker->m_sCurKey.empty(), "not found key : <integet/real>");
 			pMaker->m_pCurDict->setObject(pText, pMaker->m_sCurKey);
 			break;
 		}
 	}
	pText->release();
}
开发者ID:BigHand,项目名称:cocos2d-x,代码行数:26,代码来源:CCFileUtils_android.cpp

示例4: textHandler

    void textHandler(void *ctx, const char *ch, int len)
    {
        CC_UNUSED_PARAM(ctx);
        if (m_tState == SAX_NONE)
        {
            return;
        }

        CCSAXState curState = m_tStateStack.empty() ? SAX_DICT : m_tStateStack.top();
        CCString *pText = new CCString(std::string((char*)ch,0,len));

        switch(m_tState)
        {
        case SAX_KEY:
            m_sCurKey = pText->getCString();
            break;
        case SAX_INT:
        case SAX_REAL:
        case SAX_STRING:
            {
                if (curState == SAX_DICT)
                {
                    CCAssert(!m_sCurKey.empty(), "key not found : <integer/real>");
                }
                
                m_sCurValue.append(pText->getCString());
            }
            break;
        default:
            break;
        }
        pText->release();
    }
开发者ID:akof1314,项目名称:cocos2d-x,代码行数:33,代码来源:CCFileUtils.cpp

示例5: SendDeviceInfo

void HSLog::SendDeviceInfo()
{
	LogRequest_TerminalLog* deviceInfo = m_pLog->mutable_terminallogs();
	std::string platform = "";
#if HSWin32
	platform = "Windows";
#elif HSAndroid
	platform = "Android";
#elif HSios
	platform = "IOS";
#endif
	CCString* dpiSize = CCString::createWithFormat("%dx%d",(int)HSBase::GetScreenWidth(),(int)HSBase::GetScreenHeight());


	deviceInfo->set_osname(platform);
	deviceInfo->set_dpisize(dpiSize->getCString());
	deviceInfo->set_clitype(platform);
	deviceInfo->set_verinfo(HSTool::ShareHSTool()->GetSystemVersions());
	deviceInfo->set_nettype(HSTool::ShareHSTool()->GetNetType());
	deviceInfo->set_netproinfo(HSTool::ShareHSTool()->GetOperator());
	deviceInfo->set_countryinfo(HSTool::ShareHSTool()->GetCountryInfo());
	deviceInfo->set_cityinfo(HSTool::ShareHSTool()->GetCityInfo());

	dpiSize->release();
}
开发者ID:wanggan768q,项目名称:GameWork,代码行数:25,代码来源:HSLog.cpp

示例6: changeBackground

void NovelScene::changeBackground(CCNode *pSender, void* node)
{
    CCString* imgFilePath = (CCString*) node;
    CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(imgFilePath->getCString());
    ((CCSprite*)pSender)->setTexture(texture);
    imgFilePath->release();
}
开发者ID:pdpdds,项目名称:cocos2dx-dev,代码行数:7,代码来源:NovelScene.cpp

示例7: array_Value

static void array_Value(CCArray * aArray, const cocos2d::ValueVector & value)
{
    cocos2d::ValueVector::const_iterator beg = value.begin();
    cocos2d::ValueVector::const_iterator end = value.end();
    for (; beg != end; ++beg)
    {
        const Value & v = *beg;
        if (v.getType() == Value::Type::MAP)
        {
            CCDictionary * dict = new CCDictionary();
            dict->init();
            dictionary_Value(dict, v.asValueMap());
            aArray->addObject(dict);
            dict->release();
        }
        else if (v.getType() == Value::Type::VECTOR)
        {
            CCArray * arr = new CCArray();
            arr->init();
            array_Value(arr, v.asValueVector());
            aArray->addObject(arr);
            arr->release();
        }
        else
        {
            CCString * str = new CCString();
            if (v.getType() == Value::Type::DOUBLE)
                str->initWithFormat("%f", v.asDouble());
            else
                str->initWithFormat("%s", v.asString().c_str());
            aArray->addObject(str);
            str->release();
        }
    }
}
开发者ID:JackKa325,项目名称:cocos2d-x-tools,代码行数:35,代码来源:YHDataManagerImp.cpp

示例8: textHandler

void textHandler(void *ctx, const XML_Char *ch, int len)
{
 	CCDictMaker * pMaker = this;
	if (pMaker->m_tState == SAX_NONE)
	{
		return;
	}
 	CCString *pText = new CCString();
	pText->m_sString = std::string((char*)ch,0,len);

 	switch(pMaker->m_tState)
 	{
 	case SAX_KEY:
		{
			pMaker->m_sCurKey = pText->m_sString;
		}
 		break;
 	case SAX_INT:
 	case SAX_REAL:
 		{
 			CCAssert(!pMaker->m_sCurKey.empty(), "not found real : <integet/real>");
 			pMaker->m_pCurDict->setObject(pText, pMaker->m_sCurKey);
 			break;
 		}
 	case SAX_STRING:
 		{
 			CCAssert(!pMaker->m_sCurKey.empty(), "not found string");
 			pMaker->m_pCurDict->setObject(pText, pMaker->m_sCurKey);
 			break;
 		}
 	}
	pText->release();
}
开发者ID:luky300,项目名称:cocos2d-x,代码行数:33,代码来源:CCFileUtils_airplay.cpp

示例9: endElement

void endElement(void *ctx, const XML_Char *name)
{
	std::string sName((char*)name);
	if( sName == "dict" )
	{
		m_tDictStack.pop();
		if ( !m_tDictStack.empty() )
		{
			m_pCurDict = (CCDictionary<std::string, CCObject*>*)(m_tDictStack.top());
		}
	}
    else if (sName == "array")
    {
        CCAssert(m_bInArray, "The plist file is wrong!");
        m_pCurDict->setObject(m_pArray, m_sCurKey);
        m_pArray->release();
        m_pArray = NULL;
        m_bInArray = false;
    }
    else if (sName == "true")
    {
        CCString *str = new CCString("1");
        if (m_bInArray)
        {
            m_pArray->addObject(str);
        }
        else
        {
            m_pCurDict->setObject(str, m_sCurKey);
        }
        str->release();
    }
    else if (sName == "false")
    {
        CCString *str = new CCString("0");
        if (m_bInArray)
        {
            m_pArray->addObject(str);
        }
        else
        {
            m_pCurDict->setObject(str, m_sCurKey);
        }
        str->release();
    }
	m_tState = SAX_NONE;
}
开发者ID:flyingpacer,项目名称:cocos2d-x-samples,代码行数:47,代码来源:CCFileUtils_airplay.cpp

示例10: downloadFileFinished

void ParseFile::downloadFileFinished(CCNode* sender, void* param)
{
	CCString* savePathName = 0;
	ParseError* error = new ParseError();

	CCHttpResponse* response = (CCHttpResponse*)param;
	
	if (response->getResponseCode() == 200)
	{
		FILE* file = 0;
		const char* errorMsg = 0;
		savePathName = (CCString*)response->getHttpRequest()->getUserData();
		std::vector<char>* responseData = response->getResponseData();
		do
		{
			file = fopen(savePathName->getCString(), "wb");
			if (file == 0)
			{
				errorMsg = "error open file!";
				break;
			}
			size_t writeLen = fwrite(&responseData->front(), 1, responseData->size(), file);
			if (writeLen != responseData->size())
			{
				errorMsg = "error write file!";
				break;
			}
		}while(0);

		if (file)
		{
			fclose(file);
		}
		if (errorMsg)
		{
			error->SetError(errorMsg);
		}
	}
	else
	{
		if (strlen(response->getErrorBuffer()) > 0)
		{
			error->SetError(response->getErrorBuffer());
		}
		else
		{
			std::vector<char>* responseData = response->getResponseData();
			responseData->push_back('\0');
			error->SetError(&responseData->front());
		}
	}

	this->downloadFileCompleted(savePathName?savePathName->getCString():0, error);

	savePathName = (CCString*)response->getHttpRequest()->getUserData();
	savePathName->release();

	delete error;
}
开发者ID:Whislly,项目名称:DreamBookToolbox,代码行数:59,代码来源:ParseFile.cpp

示例11: log

	void ProcessApplication::log(ELogType type, const char* format, ...)	{
		CCString* tempString = new CCString();
		va_list ap;
		va_start(ap, format);
		bool initialized(tempString->initWithFormatAndValist(format, ap));
		va_end(ap);
		if(initialized)	{
			log(type, EConsoleBackColor_Black, tempString->getCString());
		}
		tempString->release();
	}
开发者ID:Mobiletainment,项目名称:Multiplayer-Network-Conecpts,代码行数:11,代码来源:slProcessApplication.cpp

示例12: CreaterMessage

bool HSLanFilter::CreaterMessage(google::protobuf::Message* msg)
{    
	if (!msg)
	{
		return false;
	}
	std::string msgName = msg->GetTypeName();
    
	CCLog(msgName.c_str());
    
    if(!msg->IsInitialized())
    {
        CCString* pErrorInfo = CCString::createWithFormat("Init Error [ %s ]",msgName.c_str());
        HSMessageBox(pErrorInfo->getCString());
        
        pErrorInfo->release();
        return false;
    }
    
	std::string strbody = msg->SerializeAsString();
	std::map<std::string,int>::iterator it = m_lanProtocol.find(msgName);
	if (it == this->m_lanProtocol.end())
	{
		msgName.append(" LAN Not registered ");
		CC_SAFE_DELETE(msg);
		return false;
	}
	long long checksum = (long long)(this->Adler32((unsigned char*)strbody.c_str(),strbody.length()));
    
    
    MessageInfo hsMsg = message::MessageInfo::default_instance();
    hsMsg.Clear();
    message::Head* head = hsMsg.mutable_head();
    head->set_checksum(checksum);
	head->set_sign(0);
	head->set_uid(HS_GAME_CACHE_DATA_LAN().uuid());
	head->set_imei("Ambition:IMEI");
    Body* body = hsMsg.mutable_body();
    body->add_commandid(it->second);
	body->add_data(strbody);
    
    
	std::string data = hsMsg.SerializeAsString();

    
    CCLog("Send_Lan %d: %s",data.length(),data.c_str());
    HSJava::ShaderJava()->distributeDataToOthers(data.c_str(), data.length());    
    
    delete msg;
    msg = NULL;
    
	return true;
}
开发者ID:wanggan768q,项目名称:GameWork,代码行数:53,代码来源:HSLanFilter.cpp

示例13: dump_attribs_to_nodes

CCDictionary* Scriptor::dump_attribs_to_nodes(TiXmlElement* pElement, unsigned int indent, ScriptType st)
{
	if ( !pElement ) return NULL;
	if ( st == sUnknown) return NULL;		//关闭调试输出

	CCDictionary* dt = new CCDictionary(); 

	TiXmlAttribute* pAttrib=pElement->FirstAttribute();
	int i=0;
	int ival;
	double dval;

	while (pAttrib)
	{
		//CCLOG( "%s%s: value=[%s]", pIndent, pAttrib->Name(), pAttrib->Value());
		if (pAttrib->QueryIntValue(&ival)==TIXML_SUCCESS)   
		{
			CCInteger* ci = new CCInteger(ival);
			dt->setObject(ci,pAttrib->Name());
			ci->release();
		}
		else if (pAttrib->QueryDoubleValue(&dval)==TIXML_SUCCESS) 
		{
			NFloat* fl = new NFloat(dval);
			dt->setObject(fl,pAttrib->Name());
			fl->release();
		}
		else 
		{
			CCString* sl = new CCString(pAttrib->Value());
			dt->setObject(sl,pAttrib->Name());
			pAttrib->Value();
			CCLOG("value pair:%s||%s||%s",pAttrib->Value(),pAttrib->Name(),sl->getCString());
			sl->release();
		}
		i++;
		pAttrib=pAttrib->Next();
	}
	if(i>0)	return dt;
	else CC_SAFE_RELEASE_NULL(dt);
		
	return NULL;
}
开发者ID:frankiefanstar,项目名称:cocotd,代码行数:43,代码来源:Scriptor.cpp

示例14: addSingle

int CCPreLoad::addSingle(const char* pic, int type, int size)
{
	int ret = -1;
	CCDictionary* dic = new CCDictionary();
	CCString* str = new CCString();
	CCString* str1 = new CCString();
	do{
		str->initWithFormat("%d", type);
		str1->initWithFormat("%d", size);

		dic->setObject(str1, "size");
		dic->setObject(str, "type");
		m_dict->setObject(dic, pic);
		ret = 0;
	}while(0);
	dic->release();
	str->release();
	str1->release();
	return ret;
}
开发者ID:marszaya,项目名称:huihe,代码行数:20,代码来源:CPreLoad.cpp

示例15: onEnter

//------------------------------------------------------------------
//
// SchedulerUpdate
//
//------------------------------------------------------------------
void SchedulerUpdate::onEnter()
{
    SchedulerTestLayer::onEnter();

    TestNode* d = new TestNode();
    CCString* pStr = new CCString("---");
    d->initWithString(pStr, 50);
    pStr->release();
    addChild(d);
    d->release();

    TestNode* b = new TestNode();
    pStr = new CCString("3rd");
    b->initWithString(pStr, 0);
    pStr->release();
    addChild(b);
    b->release();

    TestNode* a = new TestNode();
    pStr = new CCString("1st");
    a->initWithString(pStr, -10);
    pStr->release();
    addChild(a);
    a->release();

    TestNode* c = new TestNode();
    pStr = new CCString("4th");
    c->initWithString(pStr, 10);
    pStr->release();
    addChild(c);
    c->release();

    TestNode* e = new TestNode();
    pStr = new CCString("5th");
    e->initWithString(pStr, 20);
    pStr->release();
    addChild(e);
    e->release();

    TestNode* f = new TestNode();
    pStr = new CCString("2nd");
    f->initWithString(pStr, -5);
    pStr->release();
    addChild(f);
    f->release();

    schedule(schedule_selector(SchedulerUpdate::removeUpdates), 4.0f);
}
开发者ID:issamux,项目名称:WebGame,代码行数:53,代码来源:SchedulerTest.cpp


注:本文中的CCString::release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。