File indexing completed on 2024-05-05 04:49:17

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
0003  * Copyright (c) 2007 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017 
0018 #ifndef AMAROK_SERVICESQLCOLLECTION_H
0019 #define AMAROK_SERVICESQLCOLLECTION_H
0020 
0021 #include "amarok_export.h"
0022 #include "ServiceCollection.h"
0023 #include "ServiceMetaBase.h"
0024 #include "ServiceSqlRegistry.h"
0025 
0026 namespace Collections {
0027 
0028 class AMAROK_EXPORT ServiceSqlCollection : public ServiceCollection
0029 {
0030     Q_OBJECT
0031     public:
0032         ServiceSqlCollection( const QString &id, const QString &prettyName, ServiceMetaFactory * metaFactory, ServiceSqlRegistry * registry );
0033         ~ServiceSqlCollection() override;
0034 
0035         virtual void startFullScan() {} //TODO
0036         QueryMaker* queryMaker() override;
0037 
0038         QString collectionId() const override;
0039         QString prettyName() const override;
0040 
0041         QStringList query( const QString &query ) override;
0042         int insert( const QString &statement, const QString &table ) override;
0043 
0044         QString escape( const QString &text ) const override;
0045 
0046         void emitUpdated() { Q_EMIT( updated() ); }
0047 
0048         Meta::TrackPtr trackForUrl( const QUrl &url ) override;
0049         bool possiblyContainsTrack( const QUrl &url ) const override;
0050 
0051 
0052     private:
0053         ServiceMetaFactory * m_metaFactory;
0054         ServiceSqlRegistry * m_registry;
0055 
0056         QString m_collectionId;
0057         QString m_prettyName;
0058 };
0059 
0060 } //namespace Collections
0061 
0062 #endif /* AMAROK_COLLECTION_SQLCOLLECTION_H */
0063