QList<QString> QgsGraduatedSymbolRendererV2::usedAttributes()
{
  QSet<QString> attributes;

  // mAttrName can contain either attribute name or an expression.
  // Sometimes it is not possible to distinguish between those two,
  // e.g. "a - b" can be both a valid attribute name or expression.
  // Since we do not have access to fields here, try both options.
  attributes << mAttrName;

  QgsExpression testExpr( mAttrName );
  if ( !testExpr.hasParserError() )
    attributes.unite( testExpr.referencedColumns().toSet() );

  if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
  if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );

  QgsRangeList::const_iterator range_it = mRanges.constBegin();
  for ( ; range_it != mRanges.constEnd(); ++range_it )
  {
    QgsSymbolV2* symbol = range_it->symbol();
    if ( symbol )
    {
      attributes.unite( symbol->usedAttributes() );
    }
  }
  return attributes.toList();
}
void ServerModeReader::generateProjectTree(CMakeListsNode *root,
        const QList<const FileNode *> &allFiles)
{
    // Split up cmake inputs into useful chunks:
    QList<FileNode *> cmakeFilesSource;
    QList<FileNode *> cmakeFilesBuild;
    QList<FileNode *> cmakeFilesOther;
    QList<FileNode *> cmakeLists;

    foreach (FileNode *fn, m_cmakeInputsFileNodes) {
        const FileName path = fn->filePath();
        if (path.fileName().compare("CMakeLists.txt", HostOsInfo::fileNameCaseSensitivity()) == 0)
            cmakeLists.append(fn);
        else if (path.isChildOf(m_parameters.sourceDirectory))
            cmakeFilesSource.append(fn);
        else if (path.isChildOf(m_parameters.buildDirectory))
            cmakeFilesBuild.append(fn);
        else
            cmakeFilesOther.append(fn);
    }
    m_cmakeInputsFileNodes.clear(); // Clean out, they are not going to be used anymore!

    if (!m_projects.isEmpty())
        root->setDisplayName(m_projects.at(0)->name);

    QSet<Node *> usedNodes;
    usedNodes.insert(updateCMakeInputs(root, m_parameters.sourceDirectory, m_parameters.buildDirectory,
                                       cmakeFilesSource, cmakeFilesBuild, cmakeFilesOther));

    usedNodes.unite(updateCMakeLists(root, cmakeLists));
    usedNodes.unite(updateProjects(root, m_projects, allFiles));

    // Trim out unused nodes:
    root->trim(usedNodes);
}
Exemplo n.º 3
0
void TcpPortsGathererPrivate::updateWin()
{
#ifdef Q_OS_WIN
    QSet<int> ports;

    if (protocol == QAbstractSocket::IPv4Protocol) {
        ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));
    } else {
        //Dynamically load symbol for GetTcp6Table for systems that dont have support for IPV6,
        //eg Windows XP
        typedef ULONG (__stdcall *GetTcp6TablePtr)(PMIB_TCP6TABLE, PULONG, BOOL);
        static GetTcp6TablePtr getTcp6TablePtr = 0;

        if (!getTcp6TablePtr)
            getTcp6TablePtr = (GetTcp6TablePtr)QLibrary::resolve(QLatin1String("Iphlpapi.dll"),
                                                                 "GetTcp6Table");

        if (getTcp6TablePtr && (protocol == QAbstractSocket::IPv6Protocol)) {
            ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));
        } else if (protocol == QAbstractSocket::UnknownNetworkLayerProtocol) {
            ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));
            if (getTcp6TablePtr)
                ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));
        }
    }

    foreach (int port, ports)
        usedPorts.insert(port);
#endif
    Q_UNUSED(protocol);
}
Exemplo n.º 4
0
void TcpPortsGathererPrivate::updateWin(TcpPortsGatherer::ProtocolFlags protocolFlags)
{
#ifdef Q_OS_WIN
    QSet<int> ports;

    if (protocolFlags & TcpPortsGatherer::IPv4Protocol)
        ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));

    //Dynamically load symbol for GetTcp6Table for systems that dont have support for IPV6,
    //eg Windows XP
    typedef ULONG (__stdcall *GetTcp6TablePtr)(PMIB_TCP6TABLE, PULONG, BOOL);
    static GetTcp6TablePtr getTcp6TablePtr = 0;

    if (!getTcp6TablePtr)
        getTcp6TablePtr = (GetTcp6TablePtr)QLibrary::resolve(QLatin1String("Iphlpapi.dll"),
                                                             "GetTcp6Table");

    if (getTcp6TablePtr && (protocolFlags & TcpPortsGatherer::IPv6Protocol))
        ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));

    foreach (int port, ports) {
        if (!usedPorts.contains(port))
            usedPorts.addPort(port);
    }
#endif
    Q_UNUSED(protocolFlags);
}
Exemplo n.º 5
0
QSet<XsdElement::Ptr> collectAllElements(const XsdSchema::Ptr &schema)
{
    QSet<XsdElement::Ptr> elements;

    // collect global elements
    const XsdElement::List elementList = schema->elements();
    for (int i = 0; i < elementList.count(); ++i)
        elements.insert(elementList.at(i));

    // collect all elements from global groups
    const XsdModelGroup::List groupList = schema->elementGroups();
    for (int i = 0; i < groupList.count(); ++i) {
        const XsdModelGroup::Ptr group(groupList.at(i));

        for (int j = 0; j < group->particles().count(); ++j)
            elements.unite(collectAllElements(group->particles().at(j)));
    }

    // collect all elements from complex type definitions
    SchemaType::List types;
    types << schema->types() << schema->anonymousTypes();

    for (int i = 0; i < types.count(); ++i) {
        if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema()) {
            const XsdComplexType::Ptr complexType(types.at(i));
            if (complexType->contentType()->particle())
                elements.unite(collectAllElements(complexType->contentType()->particle()));
        }
    }

    return elements;
}
Exemplo n.º 6
0
QList<QString> QgsSingleSymbolRendererV2::usedAttributes()
{
  QSet<QString> attributes;
  if ( mSymbol.data() ) attributes.unite( mSymbol->usedAttributes() );
  if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
  if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );
  return attributes.toList();
}
Exemplo n.º 7
0
void AutoProfileWatcher::clearProfileAssignments()
{
    QSet<AutoProfileInfo*> terminateProfiles;

    QListIterator<QList<AutoProfileInfo*> > iterDelete(appProfileAssignments.values());
    while (iterDelete.hasNext())
    {
        QList<AutoProfileInfo*> templist = iterDelete.next();
        terminateProfiles.unite(templist.toSet());
    }
    appProfileAssignments.clear();

    QListIterator<QList<AutoProfileInfo*> > iterClassDelete(windowClassProfileAssignments.values());
    while (iterClassDelete.hasNext())
    {
        QList<AutoProfileInfo*> templist = iterClassDelete.next();
        terminateProfiles.unite(templist.toSet());
    }
    windowClassProfileAssignments.clear();

    QListIterator<QList<AutoProfileInfo*> > iterNameDelete(windowNameProfileAssignments.values());
    while (iterNameDelete.hasNext())
    {
        QList<AutoProfileInfo*> templist = iterNameDelete.next();
        terminateProfiles.unite(templist.toSet());
    }
    windowNameProfileAssignments.clear();

    QSetIterator<AutoProfileInfo*> iterTerminate(terminateProfiles);
    while (iterTerminate.hasNext())
    {
        AutoProfileInfo *info = iterTerminate.next();
        if (info)
        {
            delete info;
            info = 0;
        }
    }

    QListIterator<AutoProfileInfo*> iterDefaultsDelete(defaultProfileAssignments.values());
    while (iterDefaultsDelete.hasNext())
    {
        AutoProfileInfo *info = iterDefaultsDelete.next();
        if (info)
        {
            delete info;
            info = 0;
        }
    }
    defaultProfileAssignments.clear();

    allDefaultInfo = 0;
    guidSet.clear();
}
Exemplo n.º 8
0
QList<QString> QgsRuleBasedRendererV2::usedAttributes()
{
  QSet<QString> attrs;
  for ( QList<Rule>::iterator it = mRules.begin(); it != mRules.end(); ++it )
  {
    Rule& rule = *it;
    attrs.unite( rule.needsFields().toSet() );
    if ( rule.symbol() )
    {
      attrs.unite( rule.symbol()->usedAttributes() );
    }
  }
  return attrs.values();
}
Exemplo n.º 9
0
QSet<QString> QgsPointClusterRenderer::usedAttributes() const
{
  QSet<QString> attr = QgsPointDistanceRenderer::usedAttributes();
  if ( mClusterSymbol )
    attr.unite( mClusterSymbol->usedAttributes() );
  return attr;
}
Exemplo n.º 10
0
void WordMatchSearchImpl::query(const QString &req, QVector<Service::Item *> *res) const
{
	QSet<Service::Item*>* resSet = nullptr;
	QStringList words = req.split(' ', QString::SkipEmptyParts);

	// Quit if there are no words in query
	if (words.empty())
		return;

	for (QString &w : words)
	{
		InvertedIndex::const_iterator lb, ub;
		lb =  std::lower_bound (_invertedIndex.cbegin(), _invertedIndex.cend(), w, CaseInsensitiveCompare());
		ub =  std::upper_bound (_invertedIndex.cbegin(), _invertedIndex.cend(), w, CaseInsensitiveComparePrefix());
		QSet<Service::Item*> tmpSet;
		while (lb!=ub)
			tmpSet.unite(lb++->second);
		if (resSet == nullptr)
			resSet = new QSet<Service::Item*>(tmpSet);
		else
			resSet->intersect(tmpSet);
	}
	if (resSet != nullptr) {
		for (Service::Item *s : *resSet)
			res->append(s);
		delete resSet;
	}
}
Exemplo n.º 11
0
QSet<QString> QgsSingleSymbolRenderer::usedAttributes( const QgsRenderContext &context ) const
{
  QSet<QString> attributes;
  if ( mSymbol )
    attributes.unite( mSymbol->usedAttributes( context ) );
  return attributes;
}
QSet<QString> QgsPointDisplacementRenderer::usedAttributes( const QgsRenderContext &context ) const
{
  QSet<QString> attr = QgsPointDistanceRenderer::usedAttributes( context );
  if ( mCenterSymbol )
    attr.unite( mCenterSymbol->usedAttributes( context ) );
  return attr;
}
bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QSet<QString>& attributeNames )
{
  QgsDiagramLayerSettings& s2 = mSettings;
  const QgsMapSettings& mapSettings = mEngine->mapSettings();

  if ( mapSettings.hasCrsTransformEnabled() )
  {
    if ( context.coordinateTransform().isValid() )
      // this is context for layer rendering - use its CT as it includes correct datum transform
      s2.setCoordinateTransform( context.coordinateTransform() );
    else
      // otherwise fall back to creating our own CT - this one may not have the correct datum transform!
      s2.setCoordinateTransform( QgsCoordinateTransform( mLayerCrs, mapSettings.destinationCrs() ) );
  }
  else
  {
    s2.setCoordinateTransform( QgsCoordinateTransform() );
  }

  s2.setRenderer( mDiagRenderer );

  //add attributes needed by the diagram renderer
  attributeNames.unite( s2.referencedFields( context.expressionContext(), mFields ) );

  return true;
}
QSet<Core::Id> ServerModeReader::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)
{
    QSet<Core::Id> languages;
    int counter = 0;
    foreach (const FileGroup *fg, m_fileGroups) {
        ++counter;
        const QString defineArg
        = transform(fg->defines, [](const QString &s) -> QString {
            QString result = QString::fromLatin1("#define ") + s;
            int assignIndex = result.indexOf('=');
            if (assignIndex != -1)
                result[assignIndex] = ' ';
            return result;
        }).join('\n');
        const QStringList flags = QtcProcess::splitArgs(fg->compileFlags);
        const QStringList includes = transform(fg->includePaths, [](const IncludePath *ip)  {
            return ip->path.toString();
        });

        ppBuilder.setProjectFile(fg->target->sourceDirectory.toString());
        ppBuilder.setDisplayName(fg->target->name + QString::number(counter));
        ppBuilder.setDefines(defineArg.toUtf8());
        ppBuilder.setIncludePaths(includes);
        ppBuilder.setCFlags(flags);
        ppBuilder.setCxxFlags(flags);


        languages.unite(QSet<Core::Id>::fromList(ppBuilder.createProjectPartsForFiles(transform(fg->sources, &FileName::toString))));
    }
Exemplo n.º 15
0
QSet<RPropertyTypeId> RBlockReferenceEntity::getPropertyTypeIds() const {
    QSet<RPropertyTypeId> ret;

    // TODO: move to RObject?
    // add attribute tag / values as properties of the block reference:
    const RDocument* doc = getDocument();
    if (doc!=NULL) {
        QSet<REntity::Id> childIds = doc->queryChildEntities(getId(), RS::EntityAttribute);
        QSet<REntity::Id>::iterator it;
        for (it=childIds.begin(); it!=childIds.end(); it++) {
            REntity::Id childId = *it;
            QSharedPointer<REntity> child = doc->queryEntityDirect(childId);
            if (child.isNull()) {
                continue;
            }

            QSet<RPropertyTypeId> childProperties = child->getPropertyTypeIds();
            QSet<RPropertyTypeId>::iterator it2;
            for (it2=childProperties.begin(); it2!=childProperties.end(); it2++) {
                RPropertyTypeId pid = *it2;
                QPair<QVariant, RPropertyAttributes> p = child->getProperty(pid);
                if (p.second.isVisibleToParent()) {
                    pid.setId(RPropertyTypeId::INVALID_ID);
                    ret.insert(pid);
                    //qDebug() << pid.getCustomPropertyTitle() << " / " << pid.getCustomPropertyName();
                    //qDebug() << p.first.toString();
                }
            }
        }
    }

    ret.unite(REntity::getPropertyTypeIds());
    return ret;
}
Exemplo n.º 16
0
QSet<QString> allKnownSet()
{
  QSet<QString> set;
  set << "WantHelp" << "Help+" << "HelpHidden" << "FirstTimeForInst";
  set.unite(availPublicSet());
  return set;
}
Exemplo n.º 17
0
QSet<QString> QgsMarkerLineSymbolLayerV2::usedAttributes() const
{
  QSet<QString> attr = QgsLineSymbolLayerV2::usedAttributes();
  if ( mMarker )
    attr.unite( mMarker->usedAttributes() );
  return attr;
}
QList<QString> QgsGraduatedSymbolRendererV2::usedAttributes()
{
  QSet<QString> attributes;
  attributes.insert( mAttrName );
  if ( !mRotationField.isEmpty() )
  {
    attributes.insert( mRotationField );
  }
  if ( !mSizeScaleField.isEmpty() )
  {
    attributes.insert( mSizeScaleField );
  }

  QgsSymbolV2* symbol = 0;
  QgsRangeList::const_iterator range_it = mRanges.constBegin();
  for ( ; range_it != mRanges.constEnd(); ++range_it )
  {
    symbol = range_it->symbol();
    if ( symbol )
    {
      attributes.unite( symbol->usedAttributes() );
    }
  }
  return attributes.toList();
}
Exemplo n.º 19
0
void    DataVizAdapter::updateLabels()
{
    // Generate rows and row labels (use minute resolution)
    QSet<qint64> rowKeys;
    for ( const auto& tvm : qAsConst(_tvms) )
        rowKeys.unite(QSet<qint64>::fromList(tvm->getMap().keys()));
    updateLabels( rowKeys );
}
Exemplo n.º 20
0
QSet<QString> QgsArrowSymbolLayer::usedAttributes() const
{
  QSet<QString> attributes = QgsLineSymbolLayerV2::usedAttributes();

  attributes.unite( mSymbol->usedAttributes() );

  return attributes;
}
Exemplo n.º 21
0
QList<kint> VertexBuffer::mergeVerticesIndices(const QList<kint>& v1, const QList<kint>& v2) const
{
	QSet<kint> set = QSet<kint>::fromList(v1);
	set.unite(QSet<kint>::fromList(v2));

	QList<kint> result = set.values();
	qSort(result);
	return result;
}
Exemplo n.º 22
0
QSet<QString> Tag::allFiles() {
    int childQuantity = this->children_.size();
    QSet<QString> uniqueFiles = this->files_;
    for(int i = 0; i < childQuantity; ++i) {
        uniqueFiles = uniqueFiles.unite(this->children_[i]->allFiles());
    }

    return uniqueFiles;
}
Exemplo n.º 23
0
QStringList QbsProject::files(Project::FilesMode fileMode) const
{
    Q_UNUSED(fileMode);
    if (!m_qbsProject.isValid() || isParsing())
        return QStringList();
    QSet<QString> result;
    collectFilesForProject(m_projectData, result);
    result.unite(m_qbsProject.buildSystemFiles());
    return result.toList();
}
Exemplo n.º 24
0
QSet<QString> KateHlKeyword::allKeywords() const
{
    QSet<QString> result;
    foreach (const QSet<QString>* v, dict) {
        if (!v) {
            continue;
        }
        result.unite(*v);
    }
    return result;
}
Exemplo n.º 25
0
Arquivo: aqp.cpp Projeto: cslux/ledcc
QSet<QString> suffixesForMimeTypes(const QStringList &mimeTypes)
{
    initializeFormatForMimeType();
    QSet<QString> formats;
    foreach (const QString &mimeType, mimeTypes)
        formats.unite(formatForMimeType.value(mimeType));
    if (mimeTypes.count() && mimeTypes.at(0).startsWith("audio/")) {
        // TWEAK: Supported audio formats that are not reported as such:
        formats.insert("wav");
    }
    return formats;
}
Exemplo n.º 26
0
/**
  * Fills up the parent sync file with all the content of folders in the folder action group.
  * Recursively calls itself when finds a folder.
  */
void SyncAction::createSyncFileFromFolders(SyncFile * parent, FolderActionGroup * f*g)
{
    QSet<QString> entries;

    for (int i = 0; i < f*g->count(); ++i) {
        //Creating a set of all file names ---------------------------------

        QDir sync_dir(f*g->at(i));
        if (!sync_dir.exists()) continue;

        entries.unite(sync_dir.entryList(exception_bundle->filters(), static_cast<QDir::Filter>(dir_filters), (QDir::Name | QDir::DirsFirst | QDir::IgnoreCase)).toSet());
    }

    QFileInfo fi;
    FolderActionGroup * child_dirs_fag = NULL;
    SyncFile * sf = NULL;

    foreach (QString entry, entries) {

        if (exception_bundle->cdAndCheck(entry)) { // +++ Blacklisted +++
            skipped_count++;
        }
        else { // +++ Not in blacklist +++
            sf = parent->addChild(entry);

            for (int n = 0; n < f*g->count(); ++n) {
                // Obtaining absolute paths for the file names ---------------------
                fi.setFile(QDir(f*g->at(n)).absoluteFilePath(entry));

                if (fi.exists()) {
                    if (fi.isDir()) {
                        sf->setDir(true);
                        if (!child_dirs_fag) child_dirs_fag = new FolderActionGroup;
                        child_dirs_fag->insert(f*g->idAt(n), fi.absoluteFilePath());
                    }

                    sf->addFolder(f*g->idAt(n));
                }
            }

            //sf->setBlacklisted(exception_bundle->isInBlacklist());
            if (child_dirs_fag) {
                createSyncFileFromFolders(sf, child_dirs_fag);

                delete child_dirs_fag; child_dirs_fag = NULL;
            }
        }

        exception_bundle->cdUp();
    }

    f*g = NULL;
}
Exemplo n.º 27
0
QStringList QbsProject::files(Project::FilesMode fileMode) const
{
    Q_UNUSED(fileMode);
    qCDebug(qbsPmLog) << Q_FUNC_INFO << m_qbsProject.isValid() << isParsing();
    if (!m_qbsProject.isValid() || isParsing())
        return QStringList();
    QSet<QString> result;
    collectFilesForProject(m_projectData, result);
    result.unite(m_qbsProject.buildSystemFiles());
    qCDebug(qbsPmLog) << "file count:" << result.count();
    return result.toList();
}
Exemplo n.º 28
0
void QGeoCameraTilesPrivate::updateGeometry(double viewExpansion)
{
    // Find the frustum from the camera / screen / viewport information
    // The larger frustum when stationary is a form of prefetching
    Frustum f = frustum(viewExpansion);

    // Find the polygon where the frustum intersects the plane of the map
    Polygon footprint = frustumFootprint(f);

    // Clip the polygon to the map, split it up if it cross the dateline
    QPair<Polygon, Polygon> polygons = clipFootprintToMap(footprint);

    if (!polygons.first.isEmpty()) {
        QSet<QGeoTileSpec> tilesLeft = tilesFromPolygon(polygons.first);
        tiles_.unite(tilesLeft);
    }

    if (!polygons.second.isEmpty()) {
        QSet<QGeoTileSpec> tilesRight = tilesFromPolygon(polygons.second);
        tiles_.unite(tilesRight);
    }
}
Exemplo n.º 29
0
QSet<QString> QgsSymbolV2::usedAttributes() const
{
  QSet<QString> attributes;
  QgsSymbolLayerV2List::const_iterator sIt = mLayers.constBegin();
  for ( ; sIt != mLayers.constEnd(); ++sIt )
  {
    if ( *sIt )
    {
      attributes.unite(( *sIt )->usedAttributes() );
    }
  }
  return attributes;
}
Exemplo n.º 30
0
void EntitySimulation::updateEntities(QSet<EntityItem*>& entitiesToDelete) {
    quint64 now = usecTimestampNow();

    // these methods may accumulate entries in _entitiesToBeDeleted
    expireMortalEntities(now);
    callUpdateOnEntitiesThatNeedIt(now);
    updateEntitiesInternal(now);
    sortEntitiesThatMoved();

    // at this point we harvest _entitiesToBeDeleted
    entitiesToDelete.unite(_entitiesToDelete);
    _entitiesToDelete.clear();
}