File indexing completed on 2025-01-05 04:46:59

0001 /*
0002     SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "entities.h"
0010 
0011 namespace Akonadi
0012 {
0013 class ImapSet;
0014 class Scope;
0015 
0016 namespace Server
0017 {
0018 class CommandContext;
0019 class QueryBuilder;
0020 
0021 /**
0022   Helper methods to generate WHERE clauses for item queries based on the item set
0023   used in the protocol.
0024 */
0025 namespace ItemQueryHelper
0026 {
0027 /**
0028   Add conditions to @p qb for the given item set @p set. If @p collection is valid,
0029   only items in this collection are considered.
0030 */
0031 void itemSetToQuery(const ImapSet &set, QueryBuilder &qb, const Collection &collection = Collection());
0032 
0033 /**
0034   Convenience method, does essentially the same as the one above.
0035 */
0036 void itemSetToQuery(const ImapSet &set, const CommandContext &context, QueryBuilder &qb);
0037 
0038 /**
0039   Add conditions to @p qb for the given remote identifier @p rid.
0040   The rid context is taken from @p context.
0041 */
0042 void remoteIdToQuery(const QStringList &rids, const CommandContext &context, QueryBuilder &qb);
0043 void gidToQuery(const QStringList &gids, const CommandContext &context, QueryBuilder &qb);
0044 
0045 /**
0046   Add conditions to @p qb for the given item operation scope @p scope.
0047   The rid context is taken from @p context, if none is specified an exception is thrown.
0048 */
0049 void scopeToQuery(const Scope &scope, const CommandContext &context, QueryBuilder &qb);
0050 }
0051 
0052 } // namespace Server
0053 } // namespace Akonadi