Akonadi

supertrait.h
1 /*
2  SPDX-FileCopyrightText: 2009 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 namespace Akonadi
10 {
11 namespace Internal
12 {
13 template<typename T> struct check_type {
14  using type = void;
15 };
16 }
17 
18 /**
19  @internal
20  @see SuperClass
21 */
22 template<typename Super, typename = void> struct SuperClassTrait {
23  using Type = Super;
24 };
25 
26 template<typename Class> struct SuperClassTrait<Class, typename Internal::check_type<typename Class::SuperClass>::type> {
27  using Type = typename Class::SuperClass;
28 };
29 
30 /**
31  Type trait to provide information about a base class for a given class.
32  Used eg. for the Akonadi payload mechanism.
33 
34  To provide base class introspection for own types, extend this trait as follows:
35  @code
36  namespace Akonadi
37  {
38  template <> struct SuperClass<MyClass> : public SuperClassTrait<MyBaseClass>{};
39  }
40  @endcode
41 
42  Alternatively, define a typedef "SuperClass" in your type, pointing to the base class.
43  This avoids having to include this header file if that's inconvenient from a dependency
44  point of view.
45 */
46 template<typename Class> struct SuperClass : public SuperClassTrait<Class> {
47 };
48 }
49 
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
Type trait to provide information about a base class for a given class.
Definition: supertrait.h:46
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:49 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.