/thirdparty/liblastfm2/src/types/Tag.h

http://github.com/tomahawk-player/tomahawk · C Header · 63 lines · 26 code · 9 blank · 28 comment · 0 complexity · 89bed116b08457482aaf66461fcb8d41 MD5 · raw file

  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_TAG_H
  17. #define LASTFM_TAG_H
  18. #include <lastfm/global.h>
  19. #include <QMap>
  20. #include <QString>
  21. #include <QUrl>
  22. namespace lastfm
  23. {
  24. class LASTFM_DLLEXPORT Tag
  25. {
  26. QString m_name;
  27. public:
  28. Tag( const QString& name ) : m_name( name )
  29. {}
  30. operator QString() const { return m_name; }
  31. QString name() const { return m_name; }
  32. lastfm::Tag operator=( const Tag& that ) const { return Tag( that.name() ); }
  33. bool operator<( const Tag& that ) const { return this->m_name < that.m_name; }
  34. /** the global tag page at www.last.fm */
  35. QUrl www() const;
  36. /** the tag page for user @p user at www.last.fm */
  37. QUrl www( const class User& user ) const;
  38. /** pass the finished QNetworkReply to Tag::list() */
  39. class QNetworkReply* search() const;
  40. /** the top global tags on Last.fm, sorted by popularity (number of times used) */
  41. static class QNetworkReply* getTopTags();
  42. /** the integer is the weighting, not all list type return requests
  43. * have a weighting, so the int may just be zero, if you don't care
  44. * about the weight just do this:
  45. * QStringList tags = Tag::list( reply ).values();
  46. */
  47. static QMap<int, QString> list( QNetworkReply* );
  48. };
  49. }
  50. #endif