bool CatSolution::readFrom( const QString& pth ) { bool success; QFile fl(pth); if(success = fl.open(QFile::ReadOnly)) { QString msg; int line,col; if(success = myDoc.setContent(&fl,false,&msg,&line,&col)) { QDomElement grp = myDoc.documentElement().firstChildElement(); while(!grp.isNull()) { if(hasGroup(grp.tagName())) { success = false; break; } myGroups.append(grp.tagName()); grp = grp.nextSiblingElement(); } } qDebug() << msg; } if(!success) { newSolution(); } return success; }
void GroupRegistry::setGroupTitle(GroupId const& groupId, QString const& newTitle) { if (hasGroup(groupId)) { mutex.lock(); groupTitles.insert(groupId, newTitle); mutex.unlock(); emit groupDataChanged(); } }
std::shared_ptr<base::IGroup> BlockFS::createGroup(const std::string &name, const std::string &type) { if (name.empty()) { throw EmptyString("Block::createGroup empty name provided!"); } if (hasGroup(name)) { throw DuplicateName("Block::createGroup: an entity with the same name already exists!"); } std::string id = util::createId(); return std::make_shared<GroupFS>(file(), block(), group_dir.location(), id, type, name); }
QString ContactRegistry::getNickname(GroupId const& group) const { if (hasGroup(group)) { accessMutex.lock(); QString result = identityToGroupContactHashMap.find(group).value()->getContactName(); accessMutex.unlock(); return result; } return emptyString; }
QSet<ContactId> GroupRegistry::getGroupMembers(GroupId const& groupId) const { if (!hasGroup(groupId)) { throw openmittsu::exceptions::IllegalArgumentException() << "The given group does not exist."; } mutex.lock(); QSet<ContactId> result = knownGroups.value(groupId); mutex.unlock(); return result; }
QString GroupRegistry::getGroupTitle(GroupId const& groupId) const { if (hasGroup(groupId)) { if (groupTitles.contains(groupId)) { return groupTitles.value(groupId); } else { return QString(""); } } else { throw openmittsu::exceptions::IllegalArgumentException() << "The given group does not exist."; } }
void KviConfigurationFile::setGroup(const QString & szGroup) { m_szGroup = szGroup; if(m_bPreserveEmptyGroups) { if(!hasGroup(szGroup)) { getCurrentGroup(); // we need it to be created. m_bDirty = true; } } }
void GroupRegistry::removeMember(GroupId const& groupId, ContactId const& leavingMember) { if (hasGroup(groupId)) { mutex.lock(); QSet<ContactId> oldMembers = knownGroups.value(groupId); oldMembers.remove(leavingMember); knownGroups.insert(groupId, oldMembers); mutex.unlock(); emit groupDataChanged(); } }
void GroupRegistry::updateGroupMembers(GroupId const& groupId, QSet<ContactId> const& members) { if (hasGroup(groupId)) { mutex.lock(); if (!members.contains(groupId.getOwner())) { QSet<ContactId> fullMembers(members); fullMembers.insert(groupId.getOwner()); knownGroups.insert(groupId, fullMembers); } else { knownGroups.insert(groupId, members); } mutex.unlock(); emit groupDataChanged(); } }
Group& UserManager::addGroup( const String& rName ) { if( !hasGroup( rName ) ) { Group* group = new Group( rName ); mGroups.insert( std::make_pair( rName, group ) ); mGroupSignal( *group, true ); return *group; } else { DIVERSIA_EXCEPT( Exception::ERR_DUPLICATE_ITEM, "Group already exists.", "UserManager::addGroup" ); } }
void GroupRegistry::addGroup(GroupId const& groupId, QSet<ContactId> const& members, QString const& groupTitle) { if (!hasGroup(groupId)) { mutex.lock(); if (!members.contains(groupId.getOwner())) { QSet<ContactId> fullMembers(members); fullMembers.insert(groupId.getOwner()); knownGroups.insert(groupId, fullMembers); } else { knownGroups.insert(groupId, members); } groupTitles.insert(groupId, groupTitle); mutex.unlock(); emit groupDataChanged(); } }
void Preference::Load(const QString &file) { // Read the input PVL preference file Isis::Pvl pvl; if(Isis::FileName(file).fileExists()) { pvl.read(file); } // Override parameters each time load is called for(int i = 0; i < pvl.groups(); i++) { Isis::PvlGroup &inGroup = pvl.group(i); if(this->hasGroup(inGroup.name())) { Isis::PvlGroup &outGroup = this->findGroup(inGroup.name()); for(int k = 0; k < inGroup.keywords(); k++) { Isis::PvlKeyword &inKey = inGroup[k]; while(outGroup.hasKeyword(inKey.name())) { outGroup.deleteKeyword(inKey.name()); } outGroup += inKey; } } else { this->addGroup(inGroup); } } // Configure Isis to use the user performance preferences where // appropriate. if (hasGroup("Performance")) { PvlGroup &performance = findGroup("Performance"); if (performance.hasKeyword("GlobalThreads")) { IString threadsPreference = performance["GlobalThreads"][0]; if (threadsPreference.DownCase() != "optimized") { // We need a no-iException conversion here int threads = threadsPreference.ToQt().toInt(); if (threads > 0) { QThreadPool::globalInstance()->setMaxThreadCount(threads); } } } } }
bool KDesktopFile::hasActionGroup(const QString &group) const { return hasGroup(QString::fromLatin1("Desktop Action ") + group); }
void GoStone::unbindGroup() { assert(hasGroup()) ; m_group_ref = -1; m_color = GoColor::None ; }
void GoStone::bindGroup(int g) { assert(!hasGroup()) ; m_group_ref = g ; }
/*! Removes all settings of a group \param group the group of the setting. Value to organize settings. [Default value: "Global"] [optional parameter] */ void CnotiSettings::removeGroupSettings(const string group) { _settings.remove_if(hasGroup(group)); }
bool KDesktopFile::hasActionGroup(const QString &group) const { return hasGroup(QString(QLatin1String("Desktop Action ") + group).toUtf8().constData()); }
bool CIniFile::hasKey(const std::string& group, const std::string& key) const { return hasGroup(group) && d_entries.at(group).count(key) == 1; }