File indexing completed on 2024-04-28 12:31:50

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2011 Harald Sitter <sitter@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 */
0021 
0022 #ifndef PHONON_MRL_H
0023 #define PHONON_MRL_H
0024 
0025 #include <QUrl>
0026 
0027 #include "phonon_export.h"
0028 
0029 
0030 namespace Phonon
0031 {
0032 
0033 /** \class Mrl mrl.h phonon/Mrl
0034  * Media Resource Locator - A QUrl particularly for MediaSources.
0035  *
0036  * Whenever working with URLs/URIs that actually are referencing a media resource
0037  * a Mrl should be used rather than a QUrl. Mrl has functions particularly
0038  * made for a media related use case and additionally overloads some of QUrl's
0039  * functions to work more reasonable in a Phonon context.
0040  *
0041  * A Mrl can be used just like a QUrl.
0042  *
0043  * \ingroup Playback
0044  * \author Harald Sitter <sitter@kde.org>
0045  */
0046 class PHONON_EXPORT Mrl : public QUrl
0047 {
0048 public:
0049     Mrl();
0050     Mrl(const Mrl &copy);
0051 
0052     Mrl(const QUrl &url);
0053     Mrl(const QString &url);
0054 
0055     Mrl &operator =(const Mrl &copy);
0056 #ifndef QT_NO_URL_CAST_FROM_STRING
0057     Mrl &operator =(const QString &url);
0058 #endif
0059 
0060     /**
0061      * Returns the encoded representation of the MRL if it's valid; otherwise
0062      * an empty QByteArray is returned. The output can be customized by passing
0063      * flags with options.
0064      *
0065      * If the MRL is a local file it will first be encoded using the local encoding,
0066      * otherwise it gets converted to UTF-8, and all non-ASCII characters are
0067      * then percent encoded.
0068      *
0069      * \arg options QUrl::FormattingOptions to manipulate what the output should look like
0070      *
0071      * \returns the encoded MRL or an empty QByteArray if the MRL was invalid
0072      */
0073     QByteArray toEncoded(FormattingOptions options = None) const;
0074 };
0075 
0076 } // namespace Phonon
0077 
0078 
0079 #endif // PHONON_MRL_H