Exemplo n.º 1
0
QStringList Config::getFilesHere(const QString& dir,
                                 const QString& nameFilter,
                                 const QSet<QString> &excludedDirs)
{
    QStringList result;
    if (excludedDirs.contains(dir))
        return result;

    QDir dirInfo(dir);
    QStringList fileNames;
    QStringList::const_iterator fn;

    dirInfo.setNameFilters(nameFilter.split(' '));
    dirInfo.setSorting(QDir::Name);
    dirInfo.setFilter(QDir::Files);
    fileNames = dirInfo.entryList();
    fn = fileNames.constBegin();
    while (fn != fileNames.constEnd()) {
        if (!fn->startsWith(QLatin1Char('~')))
            result.append(dirInfo.filePath(*fn));
	++fn;
    }    
    
    dirInfo.setNameFilters(QStringList("*"));
    dirInfo.setFilter(QDir::Dirs|QDir::NoDotAndDotDot);
    fileNames = dirInfo.entryList();
    fn = fileNames.constBegin();
    while (fn != fileNames.constEnd()) {
        result += getFilesHere(dirInfo.filePath(*fn), nameFilter, excludedDirs);
	++fn;
    }
    return result;
}
Exemplo n.º 2
0
QStringList Config::getExampleImageFiles(const QSet<QString> &excludedDirs,
                                         const QSet<QString> &excludedFiles)
{
    QStringList result;
    QStringList dirs = getCanonicalPathList("exampledirs");
    QString nameFilter = getString(CONFIG_EXAMPLES + dot + CONFIG_IMAGEEXTENSIONS);

    QStringList::ConstIterator d = dirs.constBegin();
    while (d != dirs.constEnd()) {
        result += getFilesHere(*d, nameFilter, location(), excludedDirs, excludedFiles);
        ++d;
    }
    return result;
}
Exemplo n.º 3
0
QStringList Config::getExampleQdocFiles(const QSet<QString> &excludedDirs,
                                        const QSet<QString> &excludedFiles)
{
    QStringList result;
    QStringList dirs = getCanonicalPathList("exampledirs");
    QString nameFilter = " *.qdoc";

    QStringList::ConstIterator d = dirs.constBegin();
    while (d != dirs.constEnd()) {
        result += getFilesHere(*d, nameFilter, location(), excludedDirs, excludedFiles);
        ++d;
    }
    return result;
}
Exemplo n.º 4
0
/*!
  Builds and returns a list of file pathnames for the file
  type specified by \a filesVar (e.g. "headers" or "sources").
  The files are found in the directories specified by
  \a dirsVar, and they are filtered by \a defaultNameFilter
  if a better filter can't be constructed from \a filesVar.
  The directories in \a excludedDirs are avoided.
 */
QStringList Config::getAllFiles(const QString &filesVar,
                                const QString &dirsVar,
                                const QSet<QString> &excludedDirs)
{
    QStringList result = getStringList(filesVar);
    QStringList dirs = getStringList(dirsVar);

    QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS));

    QStringList::ConstIterator d = dirs.begin();
    while (d != dirs.end()) {
	result += getFilesHere(*d, nameFilter, excludedDirs);
	++d;
    }
    return result;
}
Exemplo n.º 5
0
/*!
  Builds and returns a list of file pathnames for the file
  type specified by \a filesVar (e.g. "headers" or "sources").
  The files are found in the directories specified by
  \a dirsVar, and they are filtered by \a defaultNameFilter
  if a better filter can't be constructed from \a filesVar.
  The directories in \a excludedDirs are avoided. The files
  in \a excludedFiles are not included in the return list.
 */
QStringList Config::getAllFiles(const QString &filesVar,
                                const QString &dirsVar,
                                const QSet<QString> &excludedDirs,
                                const QSet<QString> &excludedFiles)
{
    QStringList result = getCanonicalPathList(filesVar);
    QStringList dirs = getCanonicalPathList(dirsVar);

    QString nameFilter = getString(filesVar + dot + CONFIG_FILEEXTENSIONS);

    QStringList::ConstIterator d = dirs.constBegin();
    while (d != dirs.constEnd()) {
        result += getFilesHere(*d, nameFilter, location(), excludedDirs, excludedFiles);
        ++d;
    }
    return result;
}
Exemplo n.º 6
0
Arquivo: config.cpp Projeto: cedrus/qt
QStringList Config::getFilesHere(const QString& uncleanDir,
                                 const QString& nameFilter,
                                 const Location &location,
                                 const QSet<QString> &excludedDirs,
                                 const QSet<QString> &excludedFiles)
{
    QString dir = location.isEmpty() ? QDir::cleanPath(uncleanDir) : QDir(uncleanDir).canonicalPath();
    QStringList result;
    if (excludedDirs.contains(dir))
        return result;

    QDir dirInfo(dir);
    QStringList fileNames;
    QStringList::const_iterator fn;

    dirInfo.setNameFilters(nameFilter.split(QLatin1Char(' ')));
    dirInfo.setSorting(QDir::Name);
    dirInfo.setFilter(QDir::Files);
    fileNames = dirInfo.entryList();
    fn = fileNames.constBegin();
    while (fn != fileNames.constEnd()) {
        if (!fn->startsWith(QLatin1Char('~'))) {
            QString s = dirInfo.filePath(*fn);
            QString c = QDir::cleanPath(s);
            if (!excludedFiles.contains(c)) {
                result.append(c);
            }
        }
        ++fn;
    }

    dirInfo.setNameFilters(QStringList(QLatin1String("*")));
    dirInfo.setFilter(QDir::Dirs|QDir::NoDotAndDotDot);
    fileNames = dirInfo.entryList();
    fn = fileNames.constBegin();
    while (fn != fileNames.constEnd()) {
        result += getFilesHere(dirInfo.filePath(*fn), nameFilter, location, excludedDirs, excludedFiles);
        ++fn;
    }
    return result;
}
Exemplo n.º 7
0
/*!
  Get all .qdocinc files.
 */
QString Config::getIncludeFilePath(const QString& fileName) const
{
    QString ext = fileName.mid(fileName.lastIndexOf('.'));
    ext.prepend('*');

    if (!includeFilesMap_.contains(ext)) {
        QSet<QString> t;
        QStringList result;
        QStringList dirs = getCanonicalPathList(CONFIG_SOURCEDIRS);
        QStringList::ConstIterator d = dirs.constBegin();
        while (d != dirs.constEnd()) {
            result += getFilesHere(*d, ext, location(), t, t);
            ++d;
        }
        includeFilesMap_.insert(ext, result);
    }
    const QStringList& paths = (*includeFilesMap_.find(ext));
    for (int i=0; i<paths.size(); ++i) {
        if (paths[i].endsWith(fileName))
            return paths[i];
    }
    return QString();
}