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