File indexing completed on 2024-05-19 04:49:16

0001 /****************************************************************************************
0002  * Copyright (c) 2009 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef MEMORYCUSTOMVALUE_H
0018 #define MEMORYCUSTOMVALUE_H
0019 
0020 #include "amarok_export.h"
0021 #include "core/meta/forward_declarations.h"
0022 #include "core/collections/QueryMaker.h"
0023 
0024 #include <QList>
0025 #include <QString>
0026 
0027 class CustomReturnFunction;
0028 class CustomReturnValue;
0029 
0030 namespace CustomValueFactory
0031 {
0032     CustomReturnFunction* returnFunction( Collections::QueryMaker::ReturnFunction function, qint64 value );
0033     CustomReturnValue* returnValue( qint64 value );
0034 }
0035 
0036 class AMAROK_EXPORT CustomReturnFunction
0037 {
0038     public:
0039         CustomReturnFunction();
0040         virtual ~CustomReturnFunction();
0041 
0042         virtual QString value( const Meta::TrackList &tracks ) const = 0;
0043 };
0044 
0045 class AMAROK_EXPORT TrackCounter : public CustomReturnFunction
0046 {
0047     public:
0048         TrackCounter();
0049         ~TrackCounter() override;
0050 
0051         QString value( const Meta::TrackList &tracks ) const override;
0052 };
0053 
0054 class AMAROK_EXPORT ArtistCounter : public CustomReturnFunction
0055 {
0056     public:
0057         ArtistCounter();
0058         ~ArtistCounter() override;
0059 
0060         QString value( const Meta::TrackList &tracks ) const override;
0061 };
0062 
0063 class AMAROK_EXPORT GenreCounter : public CustomReturnFunction
0064 {
0065     public:
0066         GenreCounter();
0067         ~GenreCounter() override;
0068 
0069         QString value( const Meta::TrackList &tracks ) const override;
0070 };
0071 
0072 class AMAROK_EXPORT ComposerCounter : public CustomReturnFunction
0073 {
0074     public:
0075         ComposerCounter();
0076         ~ComposerCounter() override;
0077 
0078         QString value( const Meta::TrackList &tracks ) const override;
0079 };
0080 
0081 class AMAROK_EXPORT AlbumCounter : public CustomReturnFunction
0082 {
0083     public:
0084         AlbumCounter();
0085         ~AlbumCounter() override;
0086 
0087         QString value( const Meta::TrackList &tracks ) const override;
0088 };
0089 
0090 class AMAROK_EXPORT YearCounter : public CustomReturnFunction
0091 {
0092     public:
0093         YearCounter();
0094         ~YearCounter() override;
0095 
0096         QString value( const Meta::TrackList &tracks ) const override;
0097 };
0098 
0099 class AMAROK_EXPORT CustomReturnValue
0100 {
0101     public:
0102         CustomReturnValue();
0103         virtual ~CustomReturnValue();
0104 
0105         virtual QString value( const Meta::TrackPtr &track ) const = 0;
0106 };
0107 
0108 class AMAROK_EXPORT TitleReturnValue : public CustomReturnValue
0109 {
0110     public:
0111         TitleReturnValue();
0112         ~TitleReturnValue() override;
0113         QString value( const Meta::TrackPtr &track ) const override;
0114 };
0115 
0116 class AMAROK_EXPORT UrlReturnValue : public CustomReturnValue
0117 {
0118     public:
0119         UrlReturnValue();
0120         ~UrlReturnValue() override;
0121         QString value( const Meta::TrackPtr &track ) const override;
0122 };
0123 
0124 
0125 #endif