File indexing completed on 2024-05-12 15:55:34

0001 /* SPDX-FileCopyrightText: 2012 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #include "FileNameList.h"
0007 
0008 DB::FileNameList::FileNameList(const QList<DB::FileName> &other)
0009 {
0010     QList<DB::FileName>::operator=(other);
0011 }
0012 
0013 DB::FileNameList::FileNameList(const QStringList &files)
0014 {
0015     for (const QString &file : files)
0016         append(DB::FileName::fromAbsolutePath(file));
0017 }
0018 
0019 QStringList DB::FileNameList::toStringList(DB::PathType type) const
0020 {
0021     QStringList res;
0022 
0023     for (const DB::FileName &fileName : *this) {
0024         if (type == DB::RelativeToImageRoot)
0025             res.append(fileName.relative());
0026         else
0027             res.append(fileName.absolute());
0028     }
0029     return res;
0030 }
0031 
0032 DB::FileNameList &DB::FileNameList::operator<<(const DB::FileName &fileName)
0033 {
0034     QList<DB::FileName>::operator<<(fileName);
0035     return *this;
0036 }
0037 
0038 DB::FileNameList DB::FileNameList::reversed() const
0039 {
0040     FileNameList res;
0041     for (const FileName &fileName : *this) {
0042         res.prepend(fileName);
0043     }
0044     return res;
0045 }
0046 // vi:expandtab:tabstop=4 shiftwidth=4: