PageRenderTime 102ms CodeModel.GetById 60ms app.highlight 3ms RepoModel.GetById 37ms app.codeStats 0ms

/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
 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/** Class that we use to store fingerprints, basically
22  */
23
24#ifndef COLLECTION_H
25#define COLLECTION_H
26
27#include <QObject>
28#include <QSqlDatabase>
29
30
31/** @author: <chris@last.fm> */
32class Collection
33{
34public:
35    static Collection& instance();
36
37    /** \brief Temp method: Gets a fingerprint id. Returns "" if none found. */
38    QString getFingerprintId( const QString& filePath );
39
40    /** \brief Temp method: Sets a fingerprint id. */
41    bool setFingerprintId( const QString& filePath, QString fpId );
42
43private:
44    Collection();
45
46    /** the database version
47        * version 0: up until 1.4.1
48        * version 1: from 1.4.2 */
49    int version() const;
50    bool query( const QString& queryToken );
51    QString fileURI( const QString& filePath );
52
53    static void destroy();    
54    
55    static Collection* s_instance;
56    QSqlDatabase m_db;
57};
58
59#endif // COLLECTION_H