Esempio n. 1
0
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");
   }
}
void ContactsTreeWidget::loadContactList() {
  appInstance->logEvent("ContactsTreeWidget::loadContactList()", SEVERITY_DEBUG);
  GroupList *gl = appInstance->mUser->getGroupList();
  ContactList *cl;
  ContactList::iterator c**t;
  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(c**t = cl->begin(); c**t != cl->end(); c**t++) {
      appInstance->mainWindow->contactsTree->addContact(*c**t);
    }
  }
  appInstance->mainWindow->contactsTree->loadAvatars();
}
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");
	}
		
}
Esempio n. 4
0
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);
}
void ContactsTreeWidget::loadAvatars() {
  appInstance->logEvent("ContactsTreeWidget::loadAvatars()", SEVERITY_DEBUG);
  GroupList *gl = appInstance->mUser->getGroupList();
  ContactList *cl;
  ContactList::iterator c**t;
  GroupList::iterator glIt;
  for(glIt = gl->begin(); glIt != gl->end(); glIt++) {
    cl = glIt->second.contacts();
    for(c**t = cl->begin(); c**t != cl->end(); c**t++) {
      if (addedContacts[c**t->getIndex()]) {
        c**t->setAvatar(MrimUtils::prepareAvatar(c**t->getAddress()));
        addedContacts[c**t->getIndex()][columns.contactAvatar] = resizeAvatar(c**t->getAvatar());
      }
    }
  }
}
Esempio n. 6
0
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");
   }
}
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;
}
Esempio n. 8
0
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() );
	}
}
Esempio n. 9
0
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());
}