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