本文整理汇总了C++中GroupList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupList::push_back方法的具体用法?C++ GroupList::push_back怎么用?C++ GroupList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupList
的用法示例。
在下文中一共展示了GroupList::push_back方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onListChanged
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: ResolveGroups
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() );
}
}
示例4: 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;
}
示例5: collectGroups
/*
This function collect all groups of parameters described in the
scad file.
*/
static GroupList collectGroups(const std::string &fulltext)
{
GroupList groupList; // container of all group names
int lineNo = 1; // tracks line number
bool inString = false; // check if its string or (line-) comment
// iterate through whole scad file
for (unsigned int i=0; i<fulltext.length(); i++) {
// increase line number
if (fulltext[i] == '\n') {
lineNo++;
continue;
}
// skip escaped quotes inside strings
if (inString && fulltext.compare(i, 2, "\\\"") == 0) {
i++;
continue;
}
//start or end of string negate the checkpoint
if (fulltext[i] == '"') {
inString = !inString;
continue;
}
if (!inString && fulltext.compare(i, 2, "//") == 0) {
i++;
while (fulltext[i] != '\n' && i<fulltext.length() ) i++;
lineNo++;
continue;
}
//start of multi line comment if check is true
if (!inString && fulltext.compare(i, 2, "/*") == 0) {
//store comment
std::string comment;
i++;
if(i<fulltext.length()) {
i++;
}
else {
continue;
}
bool isGroup=true;
// till */ every character is comment
while (fulltext.compare(i, 2, "*/") != 0 && i<fulltext.length()) {
if(fulltext[i]=='\n'){
lineNo++;
isGroup=false;
}
comment += fulltext[i];
i++;
}
if(isGroup)
groupList.push_back(createGroup(comment,lineNo));
}
}
return groupList;
}