本文整理汇总了C++中ContactList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ ContactList::insert方法的具体用法?C++ ContactList::insert怎么用?C++ ContactList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactList
的用法示例。
在下文中一共展示了ContactList::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntries
void RoutingBin::GetEntries(ContactList &outList, bool bEmptyFirst)
{
if(bEmptyFirst)
outList.clear();
if(nodeList.size() > 0)
{
outList.insert(outList.end(),nodeList.begin(),nodeList.end());
}
}
示例2: query
ContactList *RosterDBManager::getAllContacts()
{
ContactList *list = new ContactList();
QSqlQuery query(db);
qint64 startTime = QDateTime::currentDateTime().toMSecsSinceEpoch();
Utilities::logData("Reading roster DB...");
query.prepare("select * from roster");
query.exec();
while (query.next()) {
Contact *c;
int type = query.value(1).toInt();
c = ((type == Contact::TypeContact) ? new Contact() : new Group());
c->type = (Contact::ContactType) type;
c->jid = query.value(0).toString();
c->alias = query.value(2).toString();
c->fromAddressBook = query.value(3).toBool();
c->name = query.value(4).toString();
c->phone = query.value(5).toString();
c->status = query.value(6).toString();
c->statusTimestamp = query.value(7).toLongLong();
c->lastSeen = query.value(8).toLongLong();
QByteArray bytes = query.value(9).toByteArray();
c->photo = QImage::fromData(bytes);
if (c->type == Contact::TypeGroup)
{
Group *g = (Group *)c;
g->creationTimestamp = query.value(10).toLongLong();
g->author = query.value(11).toString();
g->subjectTimestamp = query.value(12).toLongLong();
g->subjectOwner = query.value(13).toString();
g->subjectOwnerName = query.value(14).toString();
QSqlQuery subQuery(db);
subQuery.prepare("select jid from participants where gjid = :gjid");
subQuery.bindValue(":jid",g->jid);
subQuery.exec();
while (subQuery.next()) {
g->addParticipant(subQuery.value(0).toString());
}
}
c->photoId = query.value(15).toString();
c->blocked = query.value(16).toBool();
list->insert(c->jid,c);
}
qint64 endTime = QDateTime::currentDateTime().toMSecsSinceEpoch() - startTime;
Utilities::logData("Roster retrieved in " + QString::number(endTime) +
" milliseconds.");
return list;
}