QString RenjuController::userContextInfo( DJGameUser* user ) const { DJGameUserItem *userItem = gameUserItem( user->userId() ); QString rank; if ( userItem ) { int index = indexOfSection( Rank ); rank = userItem->text( index ); } QString info; info += user->userName() + " : " + rank; info += "\n"; info += baseSectionName(NickName) + " : " + user->nickName(); info += "\n"; DJGameRoom *room = selfRoom(); if ( room && room->options() & DJGAME_ROOMOPTION_COUNTER ) { info += baseSectionName(Money)+ QString(":%1").arg(user->money()) + " "; info += baseSectionName(Chips)+ QString(":%1").arg(user->chips()) + "\n"; }else { info += baseSectionName(Wins)+ QString(":%1").arg(user->wins()) + " "; info += baseSectionName(Loses)+ QString(":%1").arg(user->loses()) + " "; info += baseSectionName(Draws)+ QString(":%1").arg(user->draws()) + "\n"; info += baseSectionName(Score)+ QString(":%1").arg(user->score()) + "\n"; info += baseSectionName(Money)+ QString(":%1").arg(user->money()) + " "; info += baseSectionName(Chips)+ QString(":%1").arg(user->chips()) + "\n"; } return info; }
void CDoodMemberManager::addMember(Member mem) { //TODO CDoodMemberItem *item = memberListMap.value(mem.id,NULL); if(item!=NULL){ return; } item=groupLeaderListMap.value(mem.id,NULL); if(item!=NULL){ return; } item=groupAdminListMap.value(mem.id,NULL); if(item!=NULL){ return; } CDoodMemberItem *tmpItem = new CDoodMemberItem(this); CDoodMemberItem *groupLeaderItem = NULL; CDoodMemberItem *groupAdminItem=NULL; tmpItem->setId(mem.id); tmpItem->setGender(mem.gender); tmpItem->setName(mem.name); tmpItem->setThumbAvatar(mem.thumbAvatar); tmpItem->setMember_type(mem.member_type); tmpItem->setSection(mem.team); tmpItem->setTeam(mem.team); tmpItem->setGroupid(mem.groupid); tmpItem->setRemark(mem.remark); if(mem.member_type == "3"){ groupLeaderItem = new CDoodMemberItem(this); groupLeaderItem->setId(mem.id); groupLeaderItem->setGender(mem.gender); groupLeaderItem->setName(mem.name); groupLeaderItem->setThumbAvatar(mem.thumbAvatar); groupLeaderItem->setMember_type(mem.member_type); groupLeaderItem->setRemark(mem.remark); groupLeaderItem->setGroupid(mem.groupid); groupLeaderItem->setTeam(mem.team); groupLeaderItem->setSection("群主"); if(mMy_Id==mem.id){ setMy_Type("3"); mMy_sec=mem.team; qDebug() << Q_FUNC_INFO<<"niuniuniu"<<my_Type(); } insertItem(0,groupLeaderItem); groupLeaderListMap[mem.id] = groupLeaderItem; } if(mem.member_type == "2"){ groupAdminItem = new CDoodMemberItem(this); groupAdminItem->setId(mem.id); groupAdminItem->setGender(mem.gender); groupAdminItem->setName(mem.name); groupAdminItem->setThumbAvatar(mem.thumbAvatar); groupAdminItem->setMember_type(mem.member_type); groupAdminItem->setRemark(mem.remark); groupAdminItem->setGroupid(mem.groupid); groupAdminItem->setTeam(mem.team); groupAdminItem->setSection("管理员"); if(mMy_Id==mem.id){ setMy_Type("2"); } insertItem(groupLeaderListMap.size(),groupAdminItem); groupAdminListMap[mem.id] = groupAdminItem; } // if(mem.member_type=="1"){ insertItem(indexOfSection(tmpItem->sectionKey()),tmpItem); memberListMap[mem.id] = tmpItem; // } }
void testSymbolVersionDefinitions() { ElfFileSet set; set.addFile(QStringLiteral(LIBDIR "libversioned-symbols.so")); QVERIFY(set.size() > 1); auto f = set.file(0); QVERIFY(f); const auto symDefIndex = f->indexOfSection(".gnu.version_d"); const auto symbolVersionDefs = f->section<ElfGNUSymbolVersionDefinitionsSection>(symDefIndex); QVERIFY(symbolVersionDefs); QCOMPARE(symbolVersionDefs->entryCount(), 3u); ElfGNUSymbolVersionDefinition *defV1 = nullptr, *defV2 = nullptr; auto def = symbolVersionDefs->definition(1); QVERIFY(def); QCOMPARE(def->versionIndex(), (uint16_t)2); QCOMPARE(symbolVersionDefs->definitionForVersionIndex(2), def); if (def->auxiliarySize() == 1) defV1 = def; else defV2 = def; def = symbolVersionDefs->definition(2); QVERIFY(def); QCOMPARE(def->versionIndex(), (uint16_t)3); QCOMPARE(symbolVersionDefs->definitionForVersionIndex(3), def); if (def->auxiliarySize() == 1) defV1 = def; else defV2 = def; QVERIFY(defV1); QVERIFY(defV2); QCOMPARE(defV2->auxiliarySize(), (uint16_t)2); auto defEntry = defV2->auxiliaryEntry(0); QVERIFY(defEntry); QCOMPARE(defEntry->name(), "VER2"); defEntry = defV2->auxiliaryEntry(1); QVERIFY(defEntry); QCOMPARE(defEntry->name(), "VER1"); QCOMPARE(defV1->auxiliarySize(), (uint16_t)1); defEntry = defV1->auxiliaryEntry(0); QVERIFY(defEntry); QCOMPARE(defEntry->name(), "VER1"); const auto symVerIndex = f->indexOfSection(".gnu.version"); const auto symbolVersionTable = f->section<ElfGNUSymbolVersionTable>(symVerIndex); QVERIFY(symbolVersionTable); const auto dynTabIndex = f->indexOfSection(".dynsym"); QVERIFY(dynTabIndex > 0); const auto symTab = f->section<ElfSymbolTableSection>(dynTabIndex); QVERIFY(symTab); QCOMPARE(symTab->header()->entryCount(), symbolVersionTable->header()->entryCount()); ElfSymbolTableEntry *f1 = nullptr, *f2 = nullptr, *f_ver1 = nullptr, *f_ver2 = nullptr; for (uint i = 0; i < symTab->header()->entryCount(); ++i) { auto sym = symTab->entry(i); QVERIFY(sym); if (strcmp(sym->name(), "function1") == 0) f1 = sym; else if (strcmp(sym->name(), "function2") == 0) f2 = sym; else if (strcmp(sym->name(), "function") == 0) { qDebug() << symbolVersionTable->versionIndex(i); if (symbolVersionTable->versionIndex(i) == defV2->versionIndex()) f_ver2 = sym; else if (symbolVersionTable->versionIndex(i) == defV1->versionIndex()) f_ver1 = sym; } } QVERIFY(f1); QVERIFY(f2); QVERIFY(f_ver1); QVERIFY(f_ver2); QCOMPARE(f1->value(), f_ver1->value()); QCOMPARE(f2->value(), f_ver2->value()); }