PageRenderTime 21ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/thirdparty/liblastfm2/src/global.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 136 lines | 89 code | 20 blank | 27 comment | 3 complexity | 2faa62a3c12585a1bc19478eca2d7e5e 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
 21#ifndef LASTFM_GLOBAL_H
 22#define LASTFM_GLOBAL_H
 23
 24#define LASTFM_VERSION 0x00000400
 25#define LASTFM_VERSION_STRING "0.4.0"
 26#define LASTFM_MAJOR_VERSION 0
 27#define LASTFM_MINOR_VERSION 4
 28#define LASTFM_PATCH_VERSION 0
 29
 30
 31#include <QtGlobal>
 32
 33#ifdef Q_CC_MSVC
 34    #ifdef LASTFM_LIB
 35        #define LASTFM_DLLEXPORT __declspec(dllexport)
 36    #else
 37        #define LASTFM_DLLEXPORT __declspec(dllimport)
 38    #endif
 39	#ifdef LASTFM_FINGERPRINT_LIB
 40        #define LASTFM_FINGERPRINT_DLLEXPORT __declspec(dllexport)
 41    #else
 42        #define LASTFM_FINGERPRINT_DLLEXPORT __declspec(dllimport)
 43    #endif
 44#elif __GNUC__ >= 4
 45    #define LASTFM_DLLEXPORT __attribute__ ((visibility("default")))
 46	#define LASTFM_FINGERPRINT_DLLEXPORT __attribute__ ((visibility("default")))
 47#else
 48    #define LASTFM_DLLEXPORT
 49	#define LASTFM_FINGERPRINT_DLLEXPORT
 50#endif
 51
 52
 53
 54#include <QMetaEnum>
 55#include <QString>
 56
 57namespace lastfm
 58{
 59    /** http://labs.trolltech.com/blogs/2008/10/09/coding-tip-pretty-printing-enum-values
 60      * Tips for making this take a single parameter welcome! :)
 61      * 
 62      * eg. lastfm::qMetaEnumString<QNetworkReply>( error, "NetworkError" );
 63      */
 64    template <typename T> static inline QString qMetaEnumString( int enum_value, const char* enum_name )
 65    {
 66        QMetaObject meta = T::staticMetaObject;
 67        for (int i=0; i < meta.enumeratorCount(); ++i)
 68        {
 69            QMetaEnum m = meta.enumerator(i);
 70            if (m.name() == QLatin1String(enum_name))
 71                return QLatin1String(m.valueToKey(enum_value));
 72        }
 73        return QString("Unknown enum value for \"%1\": %2").arg( enum_name ).arg( enum_value );
 74    }
 75
 76
 77    enum ImageSize
 78    {
 79        Small,
 80        Medium,
 81        Large, /** seemingly 174x174 */
 82        ExtraLarge,
 83        Mega
 84    };
 85    
 86    
 87    //convenience
 88    class Album;
 89    class Artist;
 90    class Audioscrobbler;
 91    class AuthenticatedUser;
 92    class Fingerprint;
 93    class FingerprintableSource;
 94    class FingerprintId;
 95    class Mbid;
 96    class MutableTrack;
 97    class NetworkAccessManager;
 98    class Playlist;
 99    class User;
100    class RadioStation;
101    class Tag;
102    class Track;
103    class XmlQuery;
104    class Xspf;
105}
106
107
108#ifdef LASTFM_COLLAPSE_NAMESPACE
109using lastfm::Album;
110using lastfm::Artist;
111using lastfm::Audioscrobbler;
112using lastfm::AuthenticatedUser;
113using lastfm::Fingerprint;
114using lastfm::FingerprintId;
115using lastfm::Mbid;
116using lastfm::MutableTrack;
117using lastfm::Playlist;
118using lastfm::User;
119using lastfm::RadioStation;
120using lastfm::Tag;
121using lastfm::Track;
122using lastfm::XmlQuery;
123using lastfm::Xspf;
124#endif
125
126
127//convenience
128class QDomDocument;
129class QNetworkAccessManager;
130class QNetworkReply;
131
132
133//convenience for development
134#include <QDebug>
135
136#endif //LASTFM_GLOBAL_H