コード例 #1
0
ファイル: CatSolution.cpp プロジェクト: llseptem/Cat
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;
}
コード例 #2
0
		void GroupRegistry::setGroupTitle(GroupId const& groupId, QString const& newTitle) {
			if (hasGroup(groupId)) {
				mutex.lock();
				groupTitles.insert(groupId, newTitle);
				mutex.unlock();

				emit groupDataChanged();
			}
		}
コード例 #3
0
ファイル: BlockFS.cpp プロジェクト: G-Node/nix
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);
}
コード例 #4
0
ファイル: ContactRegistry.cpp プロジェクト: rugk/openMittsu
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;
}
コード例 #5
0
		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;
		}
コード例 #6
0
		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.";
			}
		}
コード例 #7
0
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;
		}
	}
}
コード例 #8
0
		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();
			}
		}
コード例 #9
0
		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();
			}
		}
コード例 #10
0
ファイル: UserManager.cpp プロジェクト: Gohla/Diversia
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" );
    }
}
コード例 #11
0
		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();
			}
		}
コード例 #12
0
ファイル: Preference.cpp プロジェクト: corburn/ISIS
  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);
          }
        }
      }
    }
  }
コード例 #13
0
ファイル: kdesktopfile.cpp プロジェクト: serghei/kde3-kdelibs
bool KDesktopFile::hasActionGroup(const QString &group) const
{
    return hasGroup(QString::fromLatin1("Desktop Action ") + group);
}
コード例 #14
0
ファイル: GoStone.cpp プロジェクト: fndisme/GoGame
void GoStone::unbindGroup() {
  assert(hasGroup()) ;
  m_group_ref =  -1;
  m_color = GoColor::None ;
}
コード例 #15
0
ファイル: GoStone.cpp プロジェクト: fndisme/GoGame
void GoStone::bindGroup(int g) {
  assert(!hasGroup()) ;
  m_group_ref = g ;
}
コード例 #16
0
/*!
    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));
}
コード例 #17
0
ファイル: kdesktopfile.cpp プロジェクト: crayonink/calligra-2
bool KDesktopFile::hasActionGroup(const QString &group) const
{
  return hasGroup(QString(QLatin1String("Desktop Action ") + group).toUtf8().constData());
}
コード例 #18
0
ファイル: CIniFile.cpp プロジェクト: redagito/RTR2014
bool CIniFile::hasKey(const std::string& group, const std::string& key) const
{
    return hasGroup(group) && d_entries.at(group).count(key) == 1;
}