File indexing completed on 2025-02-09 05:31:51
0001 /* This file is part of the KDE project 0002 Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Lesser General Public 0006 License as published by the Free Software Foundation; either 0007 version 2.1 of the License, or (at your option) version 3, or any 0008 later version accepted by the membership of KDE e.V. (or its 0009 successor approved by the membership of KDE e.V.), Nokia Corporation 0010 (or its successors, if any) and the KDE Free Qt Foundation, which shall 0011 act as a proxy defined in Section 6 of version 3 of the license. 0012 0013 This library is distributed in the hope that it will be useful, 0014 but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 Lesser General Public License for more details. 0017 0018 You should have received a copy of the GNU Lesser General Public 0019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0020 0021 */ 0022 0023 #ifndef PHONONDEFS_H 0024 #define PHONONDEFS_H 0025 0026 #include <QtGlobal> 0027 #include "phonon_export.h" 0028 0029 #ifdef PHONON_BACKEND_VERSION_4_7 0030 # ifndef PHONON_BACKEND_VERSION_4_4 0031 # define PHONON_BACKEND_VERSION_4_4 0032 # endif 0033 #endif 0034 #ifdef PHONON_BACKEND_VERSION_4_4 0035 # ifndef PHONON_BACKEND_VERSION_4_3 0036 # define PHONON_BACKEND_VERSION_4_3 0037 # endif 0038 #endif 0039 #ifdef PHONON_BACKEND_VERSION_4_3 0040 # ifndef PHONON_BACKEND_VERSION_4_2 0041 # define PHONON_BACKEND_VERSION_4_2 0042 # endif 0043 #endif 0044 0045 // the following inlines are correct - exclude per line doesn't work for multiline-macros so exclude 0046 // the whole file for inline checks 0047 //krazy:excludeall=inline 0048 #define P_DECLARE_PRIVATE(Class) \ 0049 inline Class##Private* k_func() { return reinterpret_cast<Class##Private *>(k_ptr); } \ 0050 inline const Class##Private* k_func() const { return reinterpret_cast<const Class##Private *>(k_ptr); } \ 0051 friend class Class##Private; 0052 0053 /** 0054 * \internal 0055 * Used in class declarations to provide the needed functions. This is used for 0056 * abstract base classes. 0057 * 0058 * \param classname The Name of the class this macro is used for. 0059 * 0060 * Example: 0061 * \code 0062 * class AbstractEffect : public QObject 0063 * { 0064 * Q _OBJECT 0065 * Q_PROPERTY(int propertyA READ propertyA WRITE setPropertyA) 0066 * PHONON_ABSTRACTBASE(AbstractEffect) 0067 * public: 0068 * int propertyA() const; 0069 * void setPropertyA(int); 0070 * }; 0071 * \endcode 0072 * 0073 * \see PHONON_OBJECT 0074 * \see PHONON_HEIR 0075 */ 0076 #define PHONON_ABSTRACTBASE(classname) \ 0077 protected: \ 0078 /** 0079 * \internal 0080 * Constructor that is called from derived classes. 0081 * 0082 * \param parent Standard QObject parent. 0083 */ \ 0084 classname(classname ## Private &dd, QObject *parent); \ 0085 private: 0086 0087 /** 0088 * \internal 0089 * Used in class declarations to provide the needed functions. This is used for 0090 * classes that inherit QObject directly. 0091 * 0092 * \param classname The Name of the class this macro is used for. 0093 * 0094 * Example: 0095 * \code 0096 * class EffectSettings : public QObject 0097 * { 0098 * Q _OBJECT 0099 * Q_PROPERTY(int propertyA READ propertyA WRITE setPropertyA) 0100 * PHONON_OBJECT(EffectSettings) 0101 * public: 0102 * int propertyA() const; 0103 * void setPropertyA(int); 0104 * }; 0105 * \endcode 0106 * 0107 * \see PHONON_ABSTRACTBASE 0108 * \see PHONON_HEIR 0109 */ 0110 #define PHONON_OBJECT(classname) \ 0111 public: \ 0112 /** 0113 * Constructs an object with the given \p parent. 0114 */ \ 0115 classname(QObject *parent = nullptr); \ 0116 private: 0117 0118 /** 0119 * \internal 0120 * Used in class declarations to provide the needed functions. This is used for 0121 * classes that inherit another Phonon object. 0122 * 0123 * \param classname The Name of the class this macro is used for. 0124 * 0125 * Example: 0126 * \code 0127 * class ConcreteEffect : public AbstractEffect 0128 * { 0129 * Q _OBJECT 0130 * Q_PROPERTY(int propertyB READ propertyB WRITE setPropertyB) 0131 * PHONON_HEIR(ConcreteEffect) 0132 * public: 0133 * int propertyB() const; 0134 * void setPropertyB(int); 0135 * }; 0136 * \endcode 0137 * 0138 * \see PHONON_ABSTRACTBASE 0139 * \see PHONON_OBJECT 0140 */ 0141 #define PHONON_HEIR(classname) \ 0142 public: \ 0143 /** 0144 * Constructs an object with the given \p parent. 0145 */ \ 0146 classname(QObject *parent = nullptr); \ 0147 0148 0149 #endif // PHONONDEFS_H