File indexing completed on 2024-04-28 07:40:49
0001 0002 #pragma once 0003 0004 #include <QObject> 0005 #include <QString> 0006 #include <QStringList> 0007 #include <QMap> 0008 #include <QCoreApplication> 0009 #include <QSharedData> 0010 0011 #include <functional> 0012 0013 class ExternalFwdDecl; 0014 class LocalFwdDecl; 0015 0016 template<typename T> class QList; 0017 0018 class MyObject : public QObject 0019 { 0020 Q_OBJECT 0021 public: 0022 MyObject(QObject* parent = nullptr); 0023 0024 inline MyObject(const QString& inlineCtor, QObject* parent = nullptr); 0025 0026 enum LocalEnum { 0027 Val1 = 1, 0028 Val2 0029 }; 0030 Q_DECLARE_FLAGS(LocalEnums, LocalEnum) 0031 0032 enum { 0033 AnonVal1, 0034 AnonVal2 0035 }; 0036 0037 double unnamedParameters(int, double); 0038 0039 int addThree(int input) const; 0040 QList<int> addThree(QList<int> input) const; 0041 0042 const QString addThree(const QString& input, const QString& prefix = QStringLiteral("Default")) const; 0043 0044 int findNeedle(QStringList list, QString needle, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const; 0045 0046 int qtEnumTest(QFlags<Qt::MatchFlag> flags); 0047 int localEnumTest(QFlags<MyObject::LocalEnum> flags); 0048 0049 inline int inlineMethod(int arg); 0050 0051 int functionParam(std::function<int()> fn); 0052 int groups(unsigned int maxCount = std::numeric_limits<uint>::max()) const; 0053 0054 void enumNullptr(Qt::WindowFlags f = nullptr); 0055 0056 void enumBraces(Qt::WindowFlags f = {}); 0057 void stringBraces(QString s = {}); 0058 void stringRefBraces(QString const& s = {}); 0059 void intBraces(int i = {}); 0060 void intRefBraces(int const& i = {}); 0061 void pointerBraces(int* p = {}); 0062 0063 int const_parameters(const int input, QObject* const obj = 0) const; 0064 0065 int externalFwdDecl(const ExternalFwdDecl& f); 0066 int externalFwdDeclRef(ExternalFwdDecl& f); 0067 0068 int localFwdDecl(const LocalFwdDecl& f); 0069 0070 int localListDecl(const QList<int>& l); 0071 0072 int localDeclListDecl(const QList<LocalFwdDecl>& l); 0073 0074 mode_t dummyFunc(QObject* parent) { return 0; } 0075 0076 signals: 0077 void publicSlotCalled(); 0078 0079 Q_SIGNALS: 0080 void privateSlotCalled(); 0081 void protectedSlotCalled(); 0082 0083 public slots: 0084 void publicSlot1(); 0085 0086 public Q_SLOTS: 0087 void publicSlot2(); 0088 0089 protected slots: 0090 void protectedSlot1(); 0091 0092 protected Q_SLOTS: 0093 void protectedSlot2(); 0094 0095 private slots: 0096 void privateSlot1(); 0097 0098 private Q_SLOTS: 0099 void privateSlot2(); 0100 }; 0101 0102 inline MyObject::MyObject(const QString& inlineCtor, QObject* parent) 0103 : MyObject(parent) 0104 { 0105 0106 } 0107 0108 inline int MyObject::inlineMethod(int arg) 0109 { 0110 return arg; 0111 } 0112 0113 class LocalFwdDecl 0114 { 0115 public: 0116 LocalFwdDecl(int value); 0117 0118 int getValue() const; 0119 0120 private: 0121 int m_value; 0122 }; 0123 0124 class NonCopyable 0125 { 0126 public: 0127 NonCopyable(); 0128 ~NonCopyable(); 0129 0130 private: 0131 int* const mNum; 0132 }; 0133 0134 class NonCopyableByMacro 0135 { 0136 public: 0137 NonCopyableByMacro(); 0138 0139 Q_DECLARE_TR_FUNCTIONS(NonCopyableByMacro) 0140 0141 private: 0142 Q_DISABLE_COPY(NonCopyableByMacro) 0143 }; 0144 0145 Q_DECLARE_METATYPE(NonCopyableByMacro*) 0146 0147 class HasPrivateDefaultCtor 0148 { 0149 public: 0150 private: 0151 HasPrivateDefaultCtor(int param = 0); 0152 }; 0153 0154 class Shared : public QSharedData 0155 { 0156 public: 0157 Shared(const Shared& other); 0158 }; 0159 0160 namespace SomeNS { 0161 0162 class NonCopyableInNS 0163 { 0164 public: 0165 NonCopyableInNS(); 0166 ~NonCopyableInNS(); 0167 0168 private: 0169 int* const mNum; 0170 }; 0171 0172 enum MyFlagType { 0173 EnumValueOne = 0x01, 0174 EnumValueTwo = 0x02 0175 }; 0176 Q_DECLARE_FLAGS(MyFlags, MyFlagType) 0177 0178 qreal useEnum(MyFlags flags = EnumValueOne); 0179 0180 int customMethod(QList<int> const& nums); 0181 0182 typedef QString(*TagFormatter)(const QStringList &languages, 0183 const QString &tagName, 0184 const QHash<QString, QString> &attributes, 0185 const QString &text, 0186 const QStringList &tagPath, 0187 SomeNS::MyFlagType format); 0188 0189 } 0190 0191 class TypedefUser 0192 { 0193 public: 0194 0195 void setTagPattern(const QString &tagName, 0196 SomeNS::TagFormatter formatter = NULL, 0197 int leadingNewlines = 0); 0198 }; 0199 0200 int anotherCustomMethod(QList<int> const& nums); 0201 0202 enum __attribute__((visibility("default"))) EnumWithAttributes { 0203 Foo, 0204 Bar = 2 0205 }; 0206 0207 #define EXPORT __attribute__((visibility("default"))) 0208 #define NO_EXPORT __attribute__((visibility("hidden"))) 0209 0210 class EXPORT Visible 0211 { 0212 public: 0213 EXPORT int visible_fn() { return 1; } 0214 NO_EXPORT int invisible_fn() { return 1; } 0215 }; 0216 0217 class NO_EXPORT Invisible 0218 { 0219 public: 0220 int someApi() { return 1; } 0221 };