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


C++ setObject函数代码示例

本文整理汇总了C++中setObject函数的典型用法代码示例。如果您正苦于以下问题:C++ setObject函数的具体用法?C++ setObject怎么用?C++ setObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _dict

bool PaymentTstoreCommand::handleRecieve(cocos2d::CCDictionary *dict)
{
    if (dict->valueForKey("cmd")->compare(PAYMENT_TSTORE_COMMAND) != 0)
        return false;
    PayController::getInstance()->setGoldExchangeSaleBoughtFlag(m_itemId, false);
    CCDictionary *params = _dict(dict->objectForKey("params"));
    
    if (m_orderId.compare(params->valueForKey("orderId")->getCString()) != 0) {
        return false;
    }
    
    if (params->objectForKey("errorCode")) {
        callFail(NetResult::createWithFail(params));
        return true;
    }
    
    int status = params->valueForKey("status")->intValue();
    if(CCCommonUtils::payParseData(params))
    {
        auto ret = CCDictionary::create();
        ret->setObject(CCInteger::create(status), "status");
        ret->setObject(CCString::create(m_orderId), "orderId");
        callSuccess(NetResult::createWithSuccess(ret));
    }
    return true;
}
开发者ID:ourgames,项目名称:dc208,代码行数:26,代码来源:PaymentCommand.cpp

示例2: if

void TroopInfoPanel::onCallBackClick(cocos2d::CCObject *pSender, Control::EventType pCCControlEvent){
    //getButton(2)->setEnabled(false);
    SoundController::sharedSound()->playEffects(Music_Sfx_click_button);
    auto &marchInfos = WorldController::getInstance()->m_marchInfo;
    auto it = marchInfos.find(m_marchId);
    if (it == marchInfos.end()) {
        return;
    }
    
    auto &info = it->second;

    if (info.stateType == StateOccupy) {
        auto dict = CCDictionary::create();
        dict->setObject(CCString::create(info.uuid), "marchId");
        WorldMapView::instance()->afterMarchCancel(dict);
    }else if (info.marchType == MethodRally){
        auto dict = CCDictionary::create();
        dict->setObject(CCString::create(info.uuid), "marchId");
        PopupViewController::getInstance()->addPopupInView(UseToolView::create(USE_TOOL_MARCH_CANCEL_RALLY,dict));
    }else {
        auto dict = CCDictionary::create();
        dict->setObject(CCString::create(info.uuid), "marchId");
        PopupViewController::getInstance()->addPopupInView(UseToolView::create(USE_TOOL_MARCH_CANCEL,dict));
    }
    this->closeThis();
}
开发者ID:ourgames,项目名称:dc208,代码行数:26,代码来源:TroopInformationView.cpp

示例3: _dict

void StatusPush::handleResponse(__Dictionary* dict)
{
    if (!dict)
    {
        return;
    }
    __Dictionary* params = _dict(dict->objectForKey("params"));

    if (params->objectForKey("oldStatus")) {//删除该状态的作用
        int reStatusId = params->valueForKey("oldStatus")->intValue();
        if (GlobalData::shared()->statusMap.find(reStatusId) != GlobalData::shared()->statusMap.end()) {
            GlobalData::shared()->statusMap[reStatusId] = 0;
        }
    }
//    int tempTime = 0;
    if (params->objectForKey("effectState")) {
        auto stateDict = _dict(params->objectForKey("effectState"));
        CCDictElement* element;
        CCDICT_FOREACH(stateDict, element)
        {
            string key = element->getStrKey();
//            int effectId = atoi(key.c_str());

            double time = stateDict->valueForKey(key)->doubleValue()/1000;
            if (time>0) {
                time = GlobalData::shared()->changeTime(time);
            }
            if (key!="startTime") {
                GlobalData::shared()->statusMap[atoi(key.c_str())] = -1;//time;
//                tempTime = time;
            }
            map<int, CCDictionary* >::iterator it = ToolController::getInstance()->m_statusItems.find(100);
            CCObject* obj = element->getObject();
            CCString* str = (CCString*)obj;

            if(it!=ToolController::getInstance()->m_statusItems.end()){
                auto dic = it->second;
                if(!dic->objectForKey("startTime")){
                    dic->setObject(CCString::create(CC_ITOA(WorldController::getInstance()->getTime())), "startTime");
                }else if(key!="" && key!="startTime"){
                    dic->setObject(CCString::create(str->getCString()), "endTime");
                }else if(key=="startTime"){
                    dic->setObject(CCString::create(str->getCString()), "startTime");
                }
                ToolController::getInstance()->m_statusItems[100] = dic;
            }else{
                auto infoDic = CCDictionary::create();
                infoDic->retain();
                if(key!="" && key!="startTime"){
                    infoDic->setObject(CCString::create(str->getCString()), "endTime");
                }else if(key=="startTime"){
                    infoDic->setObject(CCString::create(str->getCString()), "startTime");
                }
                ToolController::getInstance()->m_statusItems[100] = infoDic;
            }
            

            ToolController::getInstance()->checkMaincityCustom();

        }
开发者ID:ourgames,项目名称:dc208,代码行数:60,代码来源:ShowStatusItemCommand.cpp

示例4: handleRecieve

bool AllianceLeaderTransCommand::handleRecieve(cocos2d::CCDictionary *dict)
{
    if (dict->valueForKey("cmd")->compare(ALLIANCE_AL_LEADER_TRANS) != 0)
        return false;
    
    CCDictionary *params=_dict(dict->objectForKey("params"));
    if (!params) {
        return false;
    }
    const CCString *pStr = params->valueForKey("errorCode");
    if (pStr->compare("")!=0) {
        CCCommonUtils::flyText(pStr->getCString());
    }else{
        CCDictionary *alliance=_dict(params->objectForKey("alliance"));
        GlobalData::shared()->playerInfo.allianceInfo.updateAllianceInfo(alliance);
        std::string playerId = params->valueForKey("oldLeaderId")->getCString();
        int oldRank = params->valueForKey("oldLeaderRank")->intValue();
        auto dic = CCDictionary::create();
        dic->setObject(CCString::create(CC_ITOA(oldRank)), "rank");
        dic->setObject(CCString::create(playerId.c_str()), "playerId");
        CCSafeNotificationCenter::sharedNotificationCenter()->postNotification(MSG_ALLIANCE_LEADER_CHANGE,dic);
        callSuccess(NetResult::create(Error_OK, params));
    }
    return true;
}
开发者ID:ourgames,项目名称:dc208,代码行数:25,代码来源:AllianceLeaderTransCommand.cpp

示例5: testDic

void HelloWorld:: testDic(){
    //打印字符串
    std::string a="ddddd";
    log("a=%s",a.c_str());
    char b[10];
    log("%lu",sizeof(b));
    //拼接
    int i=20;
    sprintf(b, "%d.png",i);
    printf("%s",b);
    
    auto pDic=__Dictionary::create();
    auto pValue1=__String::create("100");
    auto pValue2=__String::create("120");
    auto pValue3=__Integer::create(200);
    pDic->setObject(pValue1, "key1");
    pDic->setObject(pValue2, "key2");
    pDic->setObject(pValue3, "key3");
    auto pStr1=(__String *)pDic->objectForKey("key1");
    log("{key1:%s}",pStr1->getCString());
    auto pInteger=(__Integer*)pDic->objectForKey("key3");
    log("{key3:%d}",pInteger->getValue());
    auto name=__String::create("zhangsan");
    auto pass=__String::create("password");
    auto dic=__Dictionary::create();
    dic->setObject(name, "NAME");
    dic->setObject(pass, "PWD");
    
}
开发者ID:baokuanze,项目名称:ActionDemo,代码行数:29,代码来源:HelloWorldScene.cpp

示例6: confirmed

void BlankTile::confirmed(CCObject* obj){
    auto dict = CCDictionary::create();
    dict->setObject(CCString::createWithFormat("%d",0), "point");
    auto& info = ToolController::getInstance()->getToolInfoById(ITEM_NEW_BEGINNER_MOVE);
    if (info.getCNT() > 0) {
        dict->setObject(CCString::create(info.uuid), "goodsId");
        if (GlobalData::shared()->trans_res_forbidden_swith == 1) {
            bool flag = ActivityController::getInstance()->checkServerCanJoin(GlobalData::shared()->playerInfo.currentServerId);
            if (!flag && (GlobalData::shared()->resourceInfo.lFood > GlobalData::shared()->trans_res_limit || GlobalData::shared()->resourceInfo.lWood > GlobalData::shared()->trans_res_limit)) {
                CCCallFuncO* fun = CCCallFuncO::create(this, callfuncO_selector(BlankTile::alertShow), dict);
                YesNoDialog::marchAlertShow(_lang_1("104959", CC_ITOA(GlobalData::shared()->trans_res_limit)), fun, NULL);
            }
            else {
                WorldMapView::instance()->afterCrossCityMove(dict);
                this->closeSelf();
            }
        }
        else {
            WorldMapView::instance()->afterCrossCityMove(dict);
            this->closeSelf();
        }
    } else {
        closeSelf();
    }
    return;
}
开发者ID:ourgames,项目名称:dc208,代码行数:26,代码来源:BlankTile.cpp

示例7: setObject

bool PythonQtObjectPtr::fromVariant(const QVariant& variant) 
{
  if (!variant.isNull()) {
      setObject(qVariantValue<PythonQtObjectPtr>(variant));
      return true;
  }
  else {
      setObject(0);
      return false;
  } 
}
开发者ID:b3c,项目名称:PythonQt,代码行数:11,代码来源:PythonQtObjectPtr.cpp

示例8: initWithObjects

bool OSDictionary::initWithObjects(const OSObject *objects[],
                                   const OSSymbol *keys[],
                                   unsigned int theCount,
                                   unsigned int theCapacity)
{
    unsigned int newCapacity = theCount;

    if (!objects || !keys)
        return false;

    if ( theCapacity ) {
        if (theCount > theCapacity)
            return false;
        
        newCapacity = theCapacity;
    }

    if (!initWithCapacity(newCapacity))
        return false;

    for (unsigned int i = 0; i < theCount; i++) {
        const OSMetaClassBase *newObject = *objects++;

        if (!newObject || !keys[i] || !setObject(keys[i], newObject))
            return false;
    }

    return true;	
}
开发者ID:aglab2,项目名称:darwin-xnu,代码行数:29,代码来源:OSDictionary.cpp

示例9: setObject

Rectangle::Rectangle( const Falcon::CoreClass* gen, const GdkRectangle* rect )
    :
    Gtk::VoidObject( gen )
{
    if ( rect )
        setObject( rect );
}
开发者ID:Klaim,项目名称:falcon,代码行数:7,代码来源:gdk_Rectangle.cpp

示例10: assert

void ArrayIter::objInit(ObjectData *obj) {
    assert(obj);
    setObject(obj);
    if (incRef) {
        obj->incRefCount();
    }
    if (!obj->isCollection()) {
        assert(obj->o_instanceof(s_Iterator));
        obj->o_invoke(s_rewind, Array());
    } else {
        if (hasVector()) {
            c_Vector* vec = getVector();
            m_versionNumber = vec->getVersionNumber();
            m_pos = 0;
        } else if (hasMap()) {
            c_Map* mp = getMap();
            m_versionNumber = mp->getVersionNumber();
            m_pos = mp->iter_begin();
        } else if (hasStableMap()) {
            c_StableMap* smp = getStableMap();
            m_versionNumber = smp->getVersionNumber();
            m_pos = smp->iter_begin();
        } else {
            assert(false);
        }
    }
}
开发者ID:gitlisted,项目名称:hiphop-php,代码行数:27,代码来源:array_iterator.cpp

示例11: setObject

bool OSSet::initWithObjects(const OSObject *inObjects[],
                              unsigned int inCount,
                              unsigned int inCapacity)
{
    unsigned int capacity = inCount;

    if ( inCapacity ) {
        if ( inCount > inCapacity )
            return false;

        capacity = inCapacity;
    }

    if (!inObjects || !initWithCapacity(capacity))
        return false;

    for ( unsigned int i = 0; i < inCount; i++ ) {
// xx-review: no test here for failure of setObject()
        if (members->getCount() < inCapacity)
            setObject(inObjects[i]);
        else
            return false;
    }

    return true;	
}
开发者ID:Algozjb,项目名称:xnu,代码行数:26,代码来源:OSSet.cpp

示例12: _lang

void FacebookInviteView::delayShowData(float t){
    if( !getParent() )
        return;
    
    CCCommonUtils::flyHint("", "", _lang("105552"));
    m_data->removeAllObjects();
    int result = CCUserDefault::sharedUserDefault()->getIntegerForKey(FB_RequestResult, -1); //1成功  2错误 3取消
    if(true){//result==1
        int num = m_srcData->count();
        for (int i=0; i<num; i++) {
            auto dic = _dict(m_srcData->objectAtIndex(i));
            if (dic!=NULL) {
                string flag = dic->valueForKey("flag")->getCString();
                if (flag=="0") {
                    if(m_data->count()>=50){
                        break;
                    }
                    dic->setObject(CCString::create("1"), "flag");
                    m_data->addObject(dic);
                }
            }
        }
        if(m_inviteNum!=0){
            CCArray* p = CCArray::create();
            p->addObject(CCInteger::create(m_inviteNum));
            CCArray* d = CCArray::create();
            DataRecordCommand *cmd = new DataRecordCommand(FB_INVITE_FRIEND, p, d);
            cmd->sendAndRelease();
        }
        m_tip->setVisible(m_data->count()<=0);
    }
    m_tabView->reloadData();
}
开发者ID:ourgames,项目名称:dc208,代码行数:33,代码来源:FacebookInviteView.cpp

示例13: getStorage

//=============================================================================
// METHOD    : SPELLwsListDataHandler::read()
//=============================================================================
void SPELLwsListDataHandler::read()
{
	// Load the number of items
	unsigned int numItems = getStorage()->loadLong();

	// Create a list
	PyObject* listObject = PyList_New(numItems);

	for( unsigned int index = 0; index < numItems; index++)
	{
		// Load the item code
		SPELLwsData::Code code = loadDataCode();
		// Create an appropriate handler
		SPELLwsDataHandler* handler = SPELLwsDataHandlerFactory::createDataHandler(code);
		handler->setStorage(getStorage());
		// Read the data
		handler->read();
		// Add the item to the list
		PyList_SetItem(listObject, index, handler->getObject());
		delete handler;
	}

	// Set it as associated object
	setObject( listObject );
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:28,代码来源:SPELLwsListDataHandler.C

示例14: nameHandler

//=============================================================================
// METHOD    : SPELLwsClassDataHandler::read()
//=============================================================================
void SPELLwsClassDataHandler::read()
{
	// Store the class name
	SPELLwsObjectDataHandler nameHandler( NULL );
	nameHandler.setStorage(getStorage());
	SPELLwsDictDataHandler dictHandler( NULL );
	dictHandler.setStorage(getStorage());

	// Read the data
	DEBUG("[CDH] Reading name");
	nameHandler.read();
	DEBUG("[CDH] Name read: " + PYREPR(nameHandler.getObject()));

	PyObject* classObject = NULL;
	if ( PYSTR(nameHandler.getObject()) == "__FAILED_WS_CLASS__" )
	{
		classObject = PyClass_New( NULL, PyDict_New(), nameHandler.getObject() );
		std::string msg = "Detected failed WS class, assuming error during marshal process";
		LOG_ERROR(msg);
		std::cerr << msg << std::endl;
	}
	else
	{
		DEBUG("[CDH] Reading dictionary");
		dictHandler.read();
		DEBUG("[CDH] Dictionary read: " + PYREPR(dictHandler.getObject()));
		// Create the class object
		classObject = PyClass_New( NULL, dictHandler.getObject(), nameHandler.getObject() );
	}
	// Set it as associated object
	setObject( classObject );
}
开发者ID:unnch,项目名称:spell-sat,代码行数:35,代码来源:SPELLwsClassDataHandler.C

示例15: ASSERT

void ArrayIter::objInit(ObjectData *obj, bool rewind /* = true */) {
  ASSERT(obj);
  setObject(obj);
  if (incRef) {
    obj->incRefCount();
  }
  if (!obj->isCollection()) {
    ASSERT(obj->o_instanceof(s_Iterator));
    if (rewind) {
      obj->o_invoke(s_rewind, Array());
    }
    // If it is from IteratorAggregate, there is no need to rewind.
  } else {
    if (hasVector()) {
      c_Vector* vec = getVector();
      m_versionNumber = vec->getVersionNumber();
      m_pos = 0;
    } else if (hasMap()) {
      c_Map* mp = getMap();
      m_versionNumber = mp->getVersionNumber();
      m_pos = mp->iter_begin();
    } else if (hasStableMap()) {
      c_StableMap* smp = getStableMap();
      m_versionNumber = smp->getVersionNumber();
      m_pos = smp->iter_begin();
    } else {
      ASSERT(false);
    }
  }
}
开发者ID:abulo,项目名称:hiphop-php,代码行数:30,代码来源:array_iterator.cpp


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