本文整理汇总了C++中GroupPtr::members方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupPtr::members方法的具体用法?C++ GroupPtr::members怎么用?C++ GroupPtr::members使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupPtr
的用法示例。
在下文中一共展示了GroupPtr::members方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
std::vector<GroupPtr> FileAuthSourceMapper::get_user_groups(Leosac::Auth::IUserPtr u)
{
assert(u);
std::vector<GroupPtr> grps;
auto lambda_cmp = [&](IUserPtr user) -> bool
{
return user->id() == u->id();
};
for (const auto &grp_map : groups_)
{
GroupPtr grp;
std::tie(std::ignore, grp) = grp_map;
if (std::find_if(grp->members().begin(),
grp->members().end(), lambda_cmp) != grp->members().end())
{
grps.push_back(grp);
}
}
return grps;
}
示例2: isGroupMember
//Item is member of group
bool AbstractGroupableItem::isGroupMember(const GroupPtr group) const
{
//kDebug();
if (!group) {
//kDebug() << "Null Group Pointer";
return false;
}
if (!parentGroup()) {
return false;
}
return group->members().contains(const_cast<AbstractGroupableItem*>(this));
}
示例3: createGroup
TaskGroup* AbstractGroupingStrategy::createGroup(ItemList items)
{
GroupPtr oldGroup;
if (!items.isEmpty() && items.first()->isGrouped()) {
oldGroup = items.first()->parentGroup();
} else {
oldGroup = rootGroup();
}
TaskGroup *newGroup = new TaskGroup(d->groupManager);
ItemList oldGroupMembers = oldGroup->members();
int index = oldGroupMembers.count();
d->createdGroups.append(newGroup);
//kDebug() << "added group" << d->createdGroups.count();
// NOTE: Queued is vital to make sure groups only get removed after their children, for
// correct QAbstractItemModel (TasksModel) transaction semantics.
connect(newGroup, SIGNAL(itemRemoved(AbstractGroupableItem*)), this, SLOT(checkGroup()), Qt::QueuedConnection);
foreach (AbstractGroupableItem * item, items) {
int idx = oldGroupMembers.indexOf(item);
if (idx >= 0 && idx < index) {
index = idx;
}
newGroup->add(item);
}