digiKam
facedbaccess.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-05-29
7  * Description : Face database access wrapper.
8  *
9  * Copyright (C) 2007-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_FACE_DB_ACCESS_H
26 #define DIGIKAM_FACE_DB_ACCESS_H
27 
28 // Local includes
29 
30 #include "digikam_export.h"
31 #include "dbengineparameters.h"
33 
34 namespace Digikam
35 {
36 
37 class FaceDb;
38 class FaceDbAccessStaticPriv;
39 class FaceDbBackend;
40 class DbEngineErrorHandler;
41 
42 class DIGIKAM_GUI_EXPORT FaceDbAccess
43 {
44 public:
45 
51  FaceDbAccess();
52  ~FaceDbAccess();
53 
54  FaceDb* db() const;
55  FaceDbBackend* backend() const;
56  QString lastError() const;
57 
61  void setLastError(const QString& error);
62 
63  static DbEngineParameters parameters();
64 
65 public:
66 
67  static void initDbEngineErrorHandler(DbEngineErrorHandler* const errorhandler);
68  static void setParameters(const DbEngineParameters& parameters);
69  static bool checkReadyForUse(InitializationObserver* const observer);
70  static bool isInitialized();
71  static void cleanUpDatabase();
72 
73 private:
74 
75  explicit FaceDbAccess(bool);
76 
77  // Disable
78  FaceDbAccess(const FaceDbAccess&) = delete;
79  FaceDbAccess& operator=(const FaceDbAccess&) = delete;
80 
81 private:
82 
83  friend class FaceDbAccessUnlock;
84  static FaceDbAccessStaticPriv* d;
85 };
86 
87 // ------------------------------------------------------------------------------------------
88 
90 {
91 public:
92 
102  explicit FaceDbAccessUnlock(FaceDbAccess* const access);
104 
105 private:
106 
107  int count;
108 
109 private:
110 
111  // Disable
112  FaceDbAccessUnlock(const FaceDbAccessUnlock&) = delete;
113  FaceDbAccessUnlock& operator=(const FaceDbAccessUnlock&) = delete;
114 };
115 
116 } // namespace Digikam
117 
118 #endif // DIGIKAM_FACE_DB_ACCESS_H
Definition: dbengineerrorhandler.h:60
Definition: dbengineparameters.h:49
Definition: facedbaccess.h:90
~FaceDbAccessUnlock()
Definition: facedbaccess.cpp:347
FaceDbAccessUnlock()
Definition: facedbaccess.cpp:300
Definition: facedbaccess.h:43
Definition: facedbbackend.h:40
Definition: facedb.h:52
Definition: collectionscannerobserver.h:57
Definition: datefolderview.cpp:43