Akonadi

parttypehelper.h
1 /*
2  Copyright (c) 2011 Volker Krause <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef PARTTYPEHELPER_H
21 #define PARTTYPEHELPER_H
22 
23 #include "exception.h"
24 #include "query.h"
25 
26 namespace Akonadi
27 {
28 namespace Server
29 {
30 
31 class PartType;
32 
33 AKONADI_EXCEPTION_MAKE_INSTANCE(PartTypeException);
34 
38 namespace PartTypeHelper
39 {
45 PartType fromFqName(const QString &fqName);
46 
50 PartType fromFqName(const QByteArray &fqName);
51 
58 PartType fromFqName(const QString &ns, const QString &typeName);
59 
66 
73 
77 template<template<typename> class T>
78 Query::Condition conditionFromFqNames(const T<QByteArray> &fqNames)
79 {
81  c.setSubQueryMode(Query::Or);
82  for (const QByteArray &fqName : fqNames) {
84  }
85  return c;
86 }
87 
94 std::pair<QString, QString> parseFqName(const QString &fqName);
95 
99 QString fullName(const PartType &type);
100 
101 } // namespace PartTypeHelper
102 
103 } // namespace Server
104 } // namespace Akonadi
105 
106 #endif
void addCondition(const Condition &condition)
Add a WHERE condition.
Definition: query.cpp:67
Representation of a record in the PartType table.
Definition: entities.h:1780
PartType fromFqName(const QString &fqName)
Retrieve (or create) PartType for the given fully qualified name.
QString fullName(const PartType &type)
Returns full part name.
Query::Condition conditionFromFqName(const QString &fqName)
Returns a query condition that matches the given part.
void setSubQueryMode(LogicOperator op)
Set how sub-conditions should be combined, default is And.
Definition: query.cpp:62
Helper integration between Akonadi and Qt.
Represents a WHERE condition tree.
Definition: query.h:77
std::pair< QString, QString > parseFqName(const QString &fqName)
Parses a fully qualified part type name into namespace/name.
Query::Condition conditionFromFqNames(const QStringList &fqNames)
Returns a query condition that matches the given part type list.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed May 27 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.