PageRenderTime 142ms CodeModel.GetById 60ms app.highlight 6ms RepoModel.GetById 75ms app.codeStats 0ms

/thirdparty/liblastfm2/src/types/Album.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 73 lines | 36 code | 13 blank | 24 comment | 7 complexity | 4faa9f787d5b11165edaaad57c8201d7 MD5 | raw file
 1/*
 2   Copyright 2009 Last.fm Ltd. 
 3      - Primarily authored by Max Howell, Jono Cole and Doug Mansell
 4
 5   This file is part of liblastfm.
 6
 7   liblastfm is free software: you can redistribute it and/or modify
 8   it under the terms of the GNU General Public License as published by
 9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   liblastfm is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with liblastfm.  If not, see <http://www.gnu.org/licenses/>.
19*/
20#ifndef LASTFM_ALBUM_H
21#define LASTFM_ALBUM_H
22
23#include <lastfm/Artist>
24#include <lastfm/Mbid>
25#include <QString>
26#include <QUrl>
27
28namespace lastfm
29{
30    class LASTFM_DLLEXPORT Album
31    {
32        Mbid m_mbid;
33        Artist m_artist;
34        QString m_title;
35
36    public:
37        Album()
38        {}
39
40        explicit Album( Mbid mbid ) : m_mbid( mbid )
41        {}
42
43        Album( Artist artist, QString title ) : m_artist( artist ), m_title( title )
44        {}
45
46        bool operator==( const Album& that ) const { return m_title == that.m_title && m_artist == that.m_artist; }
47        bool operator!=( const Album& that ) const { return m_title != that.m_title || m_artist != that.m_artist; }
48    
49        operator QString() const { return title(); }
50        QString title() const { return m_title.isEmpty() ? "[unknown]" : m_title; }
51        Artist artist() const { return m_artist; }
52        Mbid mbid() const { return m_mbid; }
53
54        /** artist may have been set, since we allow that in the ctor, but should we handle untitled albums? */
55        bool isNull() const { return m_title.isEmpty() && m_mbid.isNull(); }
56    
57        /** Album.getInfo WebService */
58        QNetworkReply* getInfo() const;
59        QNetworkReply* share( const QStringList& recipients, const QString& message = "", bool isPublic = true ) const;
60
61        /** use Tag::list to get the tag list out of the finished reply */
62        QNetworkReply* getTags() const;
63        QNetworkReply* getTopTags() const;
64        
65        /** Last.fm dictates that you may submit at most 10 of these */
66        QNetworkReply* addTags( const QStringList& ) const;
67    
68        /** the Last.fm website url for this album */
69        QUrl www() const;
70    };
71}
72
73#endif //LASTFM_ALBUM_H