File indexing completed on 2025-01-19 03:53:46

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-05-29
0007  * Description : Thumbnail database access wrapper.
0008  *
0009  * SPDX-FileCopyrightText: 2007-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_THUMBS_DB_ACCESS_H
0017 #define DIGIKAM_THUMBS_DB_ACCESS_H
0018 
0019 // Local includes
0020 
0021 #include "digikam_export.h"
0022 #include "dbengineparameters.h"
0023 
0024 namespace Digikam
0025 {
0026 
0027 class DbEngineErrorHandler;
0028 class InitializationObserver;
0029 class ThumbsDb;
0030 class ThumbsDbAccessStaticPriv;
0031 class ThumbsDbBackend;
0032 
0033 class DIGIKAM_EXPORT ThumbsDbAccess
0034 {
0035 public:
0036 
0037     /**
0038      * This class is written in analogy to CoreDbAccess
0039      * (some features stripped off).
0040      * For documentation, see coredbaccess.h
0041      */
0042     ThumbsDbAccess();
0043     ~ThumbsDbAccess();
0044 
0045     ThumbsDb*        db()        const;
0046     ThumbsDbBackend* backend()   const;
0047     QString          lastError() const;
0048 
0049     /**
0050      * Set the "last error" message. This method is not for public use.
0051      */
0052     void setLastError(const QString& error);
0053 
0054     static DbEngineParameters parameters();
0055 
0056 public:
0057 
0058     static void initDbEngineErrorHandler(DbEngineErrorHandler* const errorhandler);
0059     static void setParameters(const DbEngineParameters& parameters);
0060     static bool checkReadyForUse(InitializationObserver* const observer);
0061     static bool isInitialized();
0062     static void cleanUpDatabase();
0063 
0064 private:
0065 
0066     explicit ThumbsDbAccess(bool);
0067 
0068     static ThumbsDbAccessStaticPriv* d;
0069 };
0070 
0071 } // namespace Digikam
0072 
0073 #endif // DIGIKAM_THUMBS_DB_ACCESS_H