本文整理汇总了C++中Contact::getGroups方法的典型用法代码示例。如果您正苦于以下问题:C++ Contact::getGroups方法的具体用法?C++ Contact::getGroups怎么用?C++ Contact::getGroups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::getGroups方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addContactToRoster
bool MySqlStorage::addContactToRoster(QString jid, Contact contact)
{
if (contactExists(jid, contact.getJid()))
{
updateNameToContact(jid, contact.getJid(), contact.getName());
updateGroupToContact(jid, contact.getJid(), contact.getGroups());
return true;
}
else
{
if (userExists(contact.getJid()))
{
QJsonDocument document;
QJsonObject object;
object.insert("groups", QJsonArray::fromStringList(QStringList::fromSet(contact.getGroups())));
document.setObject(object);
QSqlQuery query;
query.prepare("INSERT INTO qjabberd_contact(user_id, approved, ask, groups, jid, name, subscription, version)"
" VALUES(:user_id, :approved, :ask, :groups, :jid, :name, :subscription, :version)");
query.bindValue(":user_id", getUserId(jid));
query.bindValue(":version", contact.getVersion());
query.bindValue(":approved", (int)contact.getApproved());
query.bindValue(":ask", contact.getAsk());
query.bindValue(":jid", contact.getJid());
query.bindValue(":name", contact.getName());
query.bindValue(":subscription", contact.getSubscription());
query.bindValue(":groups", document.toJson());
return query.exec();
}
}
return false;
}
示例2: GetContact
void CVoxSQLite::GetContact( const char* username, Contact& c )
{
CppSQLite3Buffer buf;
buf.format( "SELECT * from Contact WHERE username = %Q;", username );
try
{
CppSQLite3Statement stmt = m_db.compileStatement( (const char*)buf );
int nContactId = 0;
CppSQLite3Query q = stmt.execQuery();
//Process record set.
while (!q.eof())
{
nContactId = q.getIntField(0);
// c.setName ( q.getStringField(1) );
// c.setNickname ( q.getStringField(2) );
// c.setBirthday ( q.getStringField(3) );
// c.setMergedContact( q.getStringField(3) );
GetMergedContacts( username, c.getMergedContacts() );
GetGroups ( username, c.getGroups() );
GetProfile ( username, c );
q.nextRow();
}
stmt.reset();
}
catch (CppSQLite3Exception& e)
{
e.errorCode();
}
}