本文整理汇总了C++中GroupList类的典型用法代码示例。如果您正苦于以下问题:C++ GroupList类的具体用法?C++ GroupList怎么用?C++ GroupList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GroupList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qDebug
void GroupControler::onListChanged(std::vector<std::shared_ptr<service::User> > group)
{
qDebug() << Q_FUNC_INFO<<group.size();
GroupList groupList;
for(auto i:group){
std::shared_ptr<service::TinyGroup> tg = std::dynamic_pointer_cast<service::TinyGroup>(i);
Group gp;
gp.avatar=QString::fromStdString(tg->avatar);
gp.createrid=QString::number(tg->createrid);
qDebug() << Q_FUNC_INFO<<"wwwwwwwwww :"<<gp.createrid;
// QDateTime DateTime;
// DateTime.setMSecsSinceEpoch(gro->create_time);
// group.create_time=DateTime.toString("MM月dd日") +QString::fromLocal8Bit(" ")+DateTime.toString("HH:mm");
gp.extend=QString::fromStdString(tg->extends);
gp.id=QString::number(tg->id);
gp.level=QString::number(tg->level);
gp.name=QString::fromStdString(tg->name);
std::string str;
str=tg->pinyin.substr(0,1);
str[0]=str[0]-32;
if(str[0]<'A'||str[0]>'Z'){
str[0]='#';
}
gp.pinyin=QString::fromStdString(str);
qDebug() << Q_FUNC_INFO<<gp.pinyin<<"zhelizheliezheli";
gp.server=QString::fromStdString(tg->server);
gp.thumbAvatar=QString::fromStdString(tg->thumb_avatar);
qDebug() << Q_FUNC_INFO<<"wwwwwwwwww"<<gp.thumbAvatar;
gp.timeZone=QString::number(tg->time_zone);
groupList.push_back(gp);
}
emit groupListChanged(groupList);
}
示例2: CFDictionaryCreate
bool
OSXKeyState::getGroups(GroupList& groups) const
{
CFIndex n;
bool gotLayouts = false;
// get number of layouts
CFStringRef keys[] = { kTISPropertyInputSourceCategory };
CFStringRef values[] = { kTISCategoryKeyboardInputSource };
CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 1, NULL, NULL);
CFArrayRef kbds = TISCreateInputSourceList(dict, false);
n = CFArrayGetCount(kbds);
gotLayouts = (n != 0);
if (!gotLayouts) {
LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
return false;
}
// get each layout
groups.clear();
for (CFIndex i = 0; i < n; ++i) {
bool addToGroups = true;
TISInputSourceRef keyboardLayout =
(TISInputSourceRef)CFArrayGetValueAtIndex(kbds, i);
if (addToGroups)
groups.push_back(keyboardLayout);
}
return true;
}
示例3: sort
void CPdpManager::SortGroups()
{
//here is a little hack to sort the groups into the correct order so that they
//will save out properly.
GroupList gListSort = m_GroupList;
sort(gListSort.begin(), gListSort.end());
for (int newIdx = 0; newIdx < (int)gListSort.size(); newIdx++)
{
if (gListSort[newIdx] != m_GroupList[newIdx])
{
int oldIdx = 0;
for (oldIdx = 0; oldIdx < (int)m_GroupList.size(); oldIdx++)
{
if (m_GroupList[oldIdx] == gListSort[newIdx])
{
dprintf("%s - old: %d, new: %d\n", m_GroupList[oldIdx].c_str(), oldIdx, newIdx);
break;
}
}
assert(oldIdx != gListSort.size());
for (FileListItr itr = m_FileList.begin(); itr != m_FileList.end(); itr++)
{
if (itr->nGroupInx == oldIdx)
{
//set the new index to the negative value so it doesn't get re-remapped
itr->nGroupInx = -newIdx;
}
}
}
}
m_GroupList = gListSort;
//fix the negative indexes.
for (FileListItr itr = m_FileList.begin(); itr != m_FileList.end(); itr++)
{
if (itr->nGroupInx < 0)
itr->nGroupInx = -itr->nGroupInx;
}
sort(m_FileList.begin(), m_FileList.end(), CPdpManager::SFileCompare);
for (FileListItr itr = m_FileList.begin(); itr != m_FileList.end(); itr++)
{
dprintf(itr->filename.c_str());
dprintf("\n");
}
}
示例4: unmarshalUInt
GroupList *unmarshalGroupList(StorageIntf *s)
{
uint i;
uint count = unmarshalUInt(s);
if (count==NULL_LIST) return 0; // null list
assert(count<1000000);
GroupList *result = new GroupList;
for (i=0;i<count;i++)
{
GroupDef *gd = (GroupDef *)unmarshalObjPointer(s);
result->append(gd);
}
return result;
}
示例5: _handleGroupObjectTimers
bool WorldManager::_handleGroupObjectTimers(uint64 callTime, void* ref)
{
//iterate through all groups and update the missionwaypoints
GroupList* groupList = gGroupManager->getGroupList();
GroupList::iterator it = groupList->begin();
while(it != groupList->end())
{
GroupObject* group = (*it);
gGroupManager->sendGroupMissionUpdate(group);
it++;
}
return (true);
}
示例6: collectGroups
/*!
Insert Parameters in AST of given scad file
form of annotations
*/
void CommentParser::collectParameters(const char *fulltext, FileModule *root_module)
{
// Get all groups of parameters
GroupList groupList = collectGroups(std::string(fulltext));
int parseTill=getLineToStop(fulltext);
// Extract parameters for all literal assignments
for (auto &assignment : root_module->scope.assignments) {
if (!assignment.expr.get()->isLiteral()) continue; // Only consider literals
// get location of assignment node
int firstLine = assignment.location().firstLine();
if(firstLine>=parseTill ) continue;
// making list to add annotations
AnnotationList *annotationList = new AnnotationList();
// Extracting the parameter comment
std::string comment = getComment(std::string(fulltext), firstLine);
// getting the node for parameter annnotataion
shared_ptr<Expression> params = CommentParser::parser(comment.c_str());
if (!params) {
params = shared_ptr<Expression>(new Literal(ValuePtr(std::string(""))));
}
// adding parameter to the list
annotationList->push_back(Annotation("Parameter", params));
//extracting the description
std::string descr = getDescription(std::string(fulltext), firstLine - 1);
if (descr != "") {
//creating node for description
shared_ptr<Expression> expr(new Literal(ValuePtr(std::string(descr.c_str()))));
annotationList->push_back(Annotation("Description", expr));
}
// Look for the group to which the given assignment belong
int i=0;
for (;i<groupList.size() && groupList[i].lineNo<firstLine;i++);
i--;
if (i >= 0) {
//creating node for description
shared_ptr<Expression> expr(new Literal(ValuePtr(groupList[i].commentString)));
annotationList->push_back(Annotation("Group", expr));
}
assignment.addAnnotations(annotationList);
}
}
示例7: loadAvatars
void ContactsTreeWidget::loadAvatars() {
appInstance->logEvent("ContactsTreeWidget::loadAvatars()", SEVERITY_DEBUG);
GroupList *gl = appInstance->mUser->getGroupList();
ContactList *cl;
ContactList::iterator clIt;
GroupList::iterator glIt;
for(glIt = gl->begin(); glIt != gl->end(); glIt++) {
cl = glIt->second.contacts();
for(clIt = cl->begin(); clIt != cl->end(); clIt++) {
if (addedContacts[clIt->getIndex()]) {
clIt->setAvatar(MrimUtils::prepareAvatar(clIt->getAddress()));
addedContacts[clIt->getIndex()][columns.contactAvatar] = resizeAvatar(clIt->getAvatar());
}
}
}
}
示例8: main
int main(int argc, char* argv[])
{
Kernel::installDefaultPrint();
// Build a name -> order map for faster lookups.
for (int i = 0; i < sizeof(OrderTable) / sizeof(const char*); i++)
OutputOrder.insert(String(OrderTable[i]),i+1);
GroupList extensions;
extensions.reserve(800);
loadDir(extensions,"core","VERSION");
loadDir(extensions,"extensions","*");
outputHeader(extensions,"glext.h");
outputFunctions(extensions,"glfnext.h");
return 0;
}
示例9: outputFunctions
void outputFunctions(GroupList& groups, String name)
{
FILE* file = fopen(name.c_str(),"w");
if (!file)
Print("Could not open file " + name);
// Output the functions for each group
for (GroupList::Iterator grp = groups.begin(); grp != groups.end(); grp++) {
if (!grp->name)
continue;
if (grp->name == "GL_ARB_imaging")
// Imaging is include as part of 1.4...
write(file,"\n#if defined(GL_ARB_imaging) && !defined(GL_VERSION_1_4)\n");
else
write(file,"\n#ifdef " + grp->name + "\n");
write(file,"GL_GROUP_BEGIN(" + grp->name + ")\n");
for (Array<String>::Iterator itr = grp->functions.begin();
itr != grp->functions.end(); itr++) {
String& str = *itr;
// Parse function "return name (args)". Start at the back because
// args is enclosed in (), the name has no spaces, and the return type
// can be several tokens, such as "void *" or "const char *"
int b = str.length();
int a = b - 1;
while (str[a] != '(')
a--;
String args = str.substr(a,b - a);
while (str[--a] == ' ')
;
b = a;
while (str[a] != ' ')
a--;
String name = str.substr(a+1,b - a);
while (str[a] == ' ')
a--;
String rtype = str.substr(0,a+1);
//
write(file,"GL_FUNCTION("+name+","+rtype+","+args+")\n");
}
write(file,"GL_GROUP_END()\n#endif\n");
}
}
示例10: defined
bool
COSXKeyState::getGroups(GroupList& groups) const
{
CFIndex n;
bool gotLayouts = false;
#if defined(MAC_OS_X_VERSION_10_5)
// get number of layouts
CFStringRef keys[] = { kTISPropertyInputSourceCategory };
CFStringRef values[] = { kTISCategoryKeyboardInputSource };
CFDictionaryRef dict = CFDictionaryCreate(NULL, (const void **)keys, (const void **)values, 1, NULL, NULL);
CFArrayRef kbds = TISCreateInputSourceList(dict, false);
n = CFArrayGetCount(kbds);
gotLayouts = (n != 0);
#else
OSStatus status = KLGetKeyboardLayoutCount(&n);
gotLayouts = (status == noErr);
#endif
if (!gotLayouts) {
LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
return false;
}
// get each layout
groups.clear();
for (CFIndex i = 0; i < n; ++i) {
bool addToGroups = true;
#if defined(MAC_OS_X_VERSION_10_5)
TISInputSourceRef keyboardLayout =
(TISInputSourceRef)CFArrayGetValueAtIndex(kbds, i);
#else
KeyboardLayoutRef keyboardLayout;
status = KLGetKeyboardLayoutAtIndex(i, &keyboardLayout);
addToGroups == (status == noErr);
#endif
if (addToGroups)
groups.push_back(keyboardLayout);
}
return true;
}
示例11: loadContactList
void ContactsTreeWidget::loadContactList() {
appInstance->logEvent("ContactsTreeWidget::loadContactList()", SEVERITY_DEBUG);
GroupList *gl = appInstance->mUser->getGroupList();
ContactList *cl;
ContactList::iterator clIt;
GroupList::iterator glIt;
appInstance->mainWindow->contactsTree->treeModel->clear();
for (glIt = gl->begin(); glIt != gl->end(); glIt++) {
cl = glIt->second.contacts();
// prevent adding empty "Unauthorized" group
if(glIt->first != GROUP_INDEX_NOT_AUTHORIZED || !cl->empty()) {
appInstance->mainWindow->contactsTree->addGroup(glIt->first, glIt->second);
}
}
for (glIt = gl->begin(); glIt != gl->end(); glIt++) {
cl = glIt->second.contacts();
for(clIt = cl->begin(); clIt != cl->end(); clIt++) {
appInstance->mainWindow->contactsTree->addContact(*clIt);
}
}
appInstance->mainWindow->contactsTree->loadAvatars();
}
示例12: GetKeyboardLayoutList
bool
CMSWindowsKeyState::getGroups(GroupList& groups) const
{
// get keyboard layouts
UInt32 newNumLayouts = GetKeyboardLayoutList(0, NULL);
if (newNumLayouts == 0) {
LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
return false;
}
HKL* newLayouts = new HKL[newNumLayouts];
newNumLayouts = GetKeyboardLayoutList(newNumLayouts, newLayouts);
if (newNumLayouts == 0) {
LOG((CLOG_DEBUG1 "can't get keyboard layouts"));
delete[] newLayouts;
return false;
}
groups.clear();
groups.insert(groups.end(), newLayouts, newLayouts + newNumLayouts);
delete[] newLayouts;
return true;
}
示例13: loadDir
void loadDir(GroupList& groups,String name,const char* filter)
{
DIR *dir = opendir(name);
if (!dir) {
Print("Could not open file " + name);
return;
}
struct dirent *fEntry;
while ((fEntry = readdir(dir)) != 0) {
if (fEntry->d_name[0] == '.')
continue;
String file = name + "/" + String(fEntry->d_name);
if (filter[0] != '*' && file.find(filter) == String::NPos)
continue;
//Print("Loading " + file);
groups.pushBack(Group());
if (!loadFile(groups.last(),file))
groups.popBack();
}
quickSort(groups.begin(),groups.end());
}
示例14: outputHeader
void outputHeader(GroupList& groups, String name)
{
FILE* file = fopen(name.c_str(),"w");
if (!file)
Print("Could not open file " + name);
// Output all the group name together at the top
for (GroupList::Iterator grp = groups.begin(); grp != groups.end(); grp++)
write(file,"#define " + grp->name + "\n");
#if 0 // Types now with the group
// Output all the types for all the extensions
for (GroupList::Iterator grp = groups.begin(); grp != groups.end(); grp++)
for (Array<String>::Iterator itr = grp->types.begin();
itr != grp->types.end(); itr++)
write(file,*itr + ";\n");
#endif
// Output the defines for each group
for (GroupList::Iterator grp = groups.begin(); grp != groups.end(); grp++) {
if (!grp->name)
continue;
write(file,"\n#ifdef " + grp->name + "\n");
for (Array<String>::Iterator itr = grp->types.begin();
itr != grp->types.end(); itr++)
write(file,*itr + ";\n");
for (Array<String>::Iterator itr = grp->defines.begin();
itr != grp->defines.end(); itr++) {
write(file,"#define " + *itr + "\n");
}
for (Array<String>::Iterator itr = grp->functions.begin();
itr != grp->functions.end(); itr++) {
String& str = *itr;
// Parse function "return name (args)". Start at the back because
// args is enclosed in (), the name has no spaces, and the return type
// can be several tokens, such as "void *" or "const char *"
int b = str.length();
int a = b - 1;
while (str[a] != '(')
a--;
while (str[--a] == ' ')
;
b = a;
while (str[a] != ' ')
a--;
String name = str.substr(a+1,b - a);
//
write(file,"#define "+name+" XGL_FUNCPTR("+name+")\n");
}
write(file,"#endif\n");
}
}
示例15: while
void cPlayer::ResolveGroups()
{
// Clear resolved groups first
m_ResolvedGroups.clear();
// Get a complete resolved list of all groups the player is in
std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates
GroupList ToIterate;
for( GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr )
{
ToIterate.push_back( *GroupItr );
}
while( ToIterate.begin() != ToIterate.end() )
{
cGroup* CurrentGroup = *ToIterate.begin();
if( AllGroups.find( CurrentGroup ) != AllGroups.end() )
{
LOGWARNING("ERROR: Player \"%s\" is in the group multiple times (\"%s\"). Please fix your settings in users.ini!",
GetName().c_str(), CurrentGroup->GetName().c_str()
);
}
else
{
AllGroups[ CurrentGroup ] = true;
m_ResolvedGroups.push_back( CurrentGroup ); // Add group to resolved list
const cGroup::GroupList & Inherits = CurrentGroup->GetInherits();
for( cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr )
{
if( AllGroups.find( *itr ) != AllGroups.end() )
{
LOGERROR("ERROR: Player %s is in the same group multiple times due to inheritance (%s). FIX IT!", GetName().c_str(), (*itr)->GetName().c_str() );
continue;
}
ToIterate.push_back( *itr );
}
}
ToIterate.erase( ToIterate.begin() );
}
}