KisResourceCacheDb.h 2.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
 * Copyright (C) 2018 Boudewijn Rempt <boud@valdyas.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef KISRESOURCECACHEDB_H
#define KISRESOURCECACHEDB_H

#include <QObject>
#include <QScopedPointer>

#include <kritaresources_export.h>
27

28 29 30
/**
 * @brief The KisResourceCacheDb class encapsulates the database that
 * caches information about the resources available to the user.
31 32 33
 *
 * KisApplication creates and initializes the database. All other methods
 * are static and can be used from anywhere.
34
 */
35
class KRITARESOURCES_EXPORT KisResourceCacheDb
36 37
{
public:
38

39 40 41 42 43
    static const QString dbLocationKey; ///< configuration key for the location of the database
    static const QString resourceCacheDbFilename; ///< filename of the database
    static const QString databaseVersion; ///< current schema version
    static const QStringList resourceTypes; ///< all types of resources
    static const QStringList storageTypes; ///< kinds of places where resources can be stored
44

45 46 47
    /**
     * @brief KisResourceCacheDb create a resource cache database.
     */
48
    explicit KisResourceCacheDb();
49 50
    ~KisResourceCacheDb();

Boudewijn Rempt's avatar
Boudewijn Rempt committed
51 52
    /**
     * @brief isValid
53
     * @return true if the database has been correctly created, false if the database cannot be used
Boudewijn Rempt's avatar
Boudewijn Rempt committed
54 55 56
     */
    bool isValid() const;

57 58 59 60 61 62 63
    /**
     * @brief initialize
     * @param location the location of the database
     * @return true if the database has been initialized correctly
     */
    bool initialize(const QString &location) const;

64 65
private:

66

67 68 69 70 71 72
    class Private;
    QScopedPointer<Private> d;

};

#endif // KISRESOURCECACHEDB_H