PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms app.codeStats 0ms

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