/thirdparty/liblastfm2/src/fingerprint/Collection.h

http://github.com/tomahawk-player/tomahawk · C Header · 59 lines · 20 code · 12 blank · 27 comment · 0 complexity · 57bac9cc96b823f16cc3a5c40c29ff0a 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. /** Class that we use to store fingerprints, basically
  17. */
  18. #ifndef COLLECTION_H
  19. #define COLLECTION_H
  20. #include <QObject>
  21. #include <QSqlDatabase>
  22. /** @author: <chris@last.fm> */
  23. class Collection
  24. {
  25. public:
  26. static Collection& instance();
  27. /** \brief Temp method: Gets a fingerprint id. Returns "" if none found. */
  28. QString getFingerprintId( const QString& filePath );
  29. /** \brief Temp method: Sets a fingerprint id. */
  30. bool setFingerprintId( const QString& filePath, QString fpId );
  31. private:
  32. Collection();
  33. /** the database version
  34. * version 0: up until 1.4.1
  35. * version 1: from 1.4.2 */
  36. int version() const;
  37. bool query( const QString& queryToken );
  38. QString fileURI( const QString& filePath );
  39. static void destroy();
  40. static Collection* s_instance;
  41. QSqlDatabase m_db;
  42. };
  43. #endif // COLLECTION_H