File indexing completed on 2024-05-12 16:18:06

0001 /***************************************************************************
0002  *   Copyright (C) 2010 Ralf Engels <ralf-engels@gmx.de>                   *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  *                                                                         *
0009  *   This program is distributed in the hope that it will be useful,       *
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0012  *   GNU General Public License for more details.                          *
0013  *                                                                         *
0014  *   You should have received a copy of the GNU General Public License     *
0015  *   along with this program; if not, write to the                         *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0018  ***************************************************************************/
0019 
0020 #ifndef COLLECTIONSCANNER_PLAYLIST_H
0021 #define COLLECTIONSCANNER_PLAYLIST_H
0022 
0023 #include "amarokshared_export.h"
0024 
0025 #include <QString>
0026 #include <QXmlStreamReader>
0027 #include <QXmlStreamWriter>
0028 
0029 namespace CollectionScanner
0030 {
0031 
0032 /**
0033  * @class Playlist
0034  * @short Represents a playlist
0035  */
0036 
0037 class AMAROKSHARED_EXPORT Playlist
0038 {
0039 public:
0040     explicit Playlist( const QString &path );
0041     explicit Playlist( QXmlStreamReader *reader );
0042 
0043     /** The absolute path to the file.
0044      *  Because of symbolic links the path could be outside the original scanning directories.
0045      */
0046     QString path() const;
0047 
0048     /** Returns the relative path at the point of scanning */
0049     QString rpath() const;
0050 
0051 
0052     /** Writes the contents of this object to an xml stream.
0053      *  Only the content is written and no enclosing directory tags.
0054      *  This is done to make it mirror the constructor which does not read those
0055      *  tags either.
0056      */
0057     void toXml( QXmlStreamWriter *writer ) const;
0058 
0059 private:
0060     QString m_path;
0061     QString m_rpath;
0062 };
0063 
0064 }
0065 
0066 #endif // COLLECTIONSCANNER_PLAYLIST_H