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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-03-22
0007  * Description : Building complex database SQL queries from search descriptions
0008  *               Internal containers.
0009  *
0010  * SPDX-FileCopyrightText: 2005      by Renchi Raju <renchi dot raju at gmail dot com>
0011  * SPDX-FileCopyrightText: 2007-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0012  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #ifndef DIGIKAM_ITEM_QUERY_BUILDER_P_H
0019 #define DIGIKAM_ITEM_QUERY_BUILDER_P_H
0020 
0021 #include "itemquerybuilder.h"
0022 
0023 // C++ includes
0024 
0025 #include <cmath>
0026 
0027 // Qt includes
0028 
0029 #include <QFile>
0030 #include <QDir>
0031 #include <QMap>
0032 #include <QRectF>
0033 #include <QUrl>
0034 #include <QLocale>
0035 #include <QUrlQuery>
0036 
0037 // Local includes
0038 
0039 #include "metaengine.h"
0040 #include "digikam_debug.h"
0041 #include "coredbaccess.h"
0042 #include "coredb.h"
0043 #include "coredbbackend.h"
0044 #include "fieldquerybuilder.h"
0045 
0046 namespace Digikam
0047 {
0048 
0049 class Q_DECL_HIDDEN RuleTypeForConversion
0050 {
0051 public:
0052 
0053     RuleTypeForConversion();
0054 
0055     QString             key;
0056     SearchXml::Relation op;
0057     QString             val;
0058 };
0059 
0060 // -------------------------------------------------------------------------
0061 
0062 enum SKey
0063 {
0064     ALBUM = 0,
0065     ALBUMNAME,
0066     ALBUMCAPTION,
0067     ALBUMCOLLECTION,
0068     TAG,
0069     TAGNAME,
0070     IMAGENAME,
0071     IMAGECAPTION,
0072     IMAGEDATE,
0073     KEYWORD,
0074     RATING
0075 };
0076 
0077 enum SOperator
0078 {
0079     EQ = 0,
0080     NE,
0081     LT,
0082     GT,
0083     LIKE,
0084     NLIKE,
0085     LTE,
0086     GTE
0087 };
0088 
0089 // -------------------------------------------------------------------------
0090 
0091 class Q_DECL_HIDDEN RuleType
0092 {
0093 public:
0094 
0095     SKey      key;
0096     SOperator op;
0097     QString   val;
0098 };
0099 
0100 // -------------------------------------------------------------------------
0101 
0102 class Q_DECL_HIDDEN SubQueryBuilder
0103 {
0104 public:
0105 
0106     QString build(enum SKey key,
0107                   enum SOperator op,
0108                   const QString& passedVal,
0109                   QList<QVariant>* boundValues) const;
0110 };
0111 
0112 } // namespace Digikam
0113 
0114 #endif // DIGIKAM_ITEM_QUERY_BUILDER_P_H