File indexing completed on 2024-04-28 15:52:41

0001 /*
0002     SPDX-FileCopyrightText: 2008 Milian Wolff <mail@milianw.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef CLASSMETHODDECLARATION_H
0008 #define CLASSMETHODDECLARATION_H
0009 
0010 #include <language/duchain/classfunctiondeclaration.h>
0011 
0012 #include <language/duchain/declaration.h>
0013 #include <language/duchain/declarationdata.h>
0014 #include <serialization/indexedstring.h>
0015 
0016 #include "phpduchainexport.h"
0017 
0018 namespace Php
0019 {
0020 
0021 class KDEVPHPDUCHAIN_EXPORT ClassMethodDeclarationData : public KDevelop::ClassFunctionDeclarationData
0022 {
0023 public:
0024     ClassMethodDeclarationData()
0025             : KDevelop::ClassFunctionDeclarationData() {}
0026 
0027     ClassMethodDeclarationData(const ClassMethodDeclarationData& rhs)
0028             : KDevelop::ClassFunctionDeclarationData(rhs)
0029     {
0030         prettyName = rhs.prettyName;
0031     }
0032 
0033     ~ClassMethodDeclarationData() {}
0034 
0035     KDevelop::IndexedString prettyName;
0036 };
0037 
0038 /**
0039  * inherits ClassFunctionDeclaration to overwrite some stuff for PHP specific behaviour
0040  */
0041 class KDEVPHPDUCHAIN_EXPORT ClassMethodDeclaration : public KDevelop::ClassFunctionDeclaration
0042 {
0043 public:
0044     ClassMethodDeclaration(const ClassMethodDeclaration &rhs);
0045     ClassMethodDeclaration(const KDevelop::RangeInRevision &range, KDevelop::DUContext *context);
0046     ClassMethodDeclaration(ClassMethodDeclarationData &data);
0047     ClassMethodDeclaration(ClassMethodDeclarationData &data, const KDevelop::RangeInRevision &range, KDevelop::DUContext *context);
0048     ~ClassMethodDeclaration() override;
0049 
0050     /// overwritten to check for __construct() method
0051     bool isConstructor() const override;
0052     /// overwritten to check for __destruct() method
0053     bool isDestructor() const override;
0054 
0055     QString toString() const override;
0056 
0057     void setPrettyName(const KDevelop::IndexedString& name);
0058     KDevelop::IndexedString prettyName() const;
0059 
0060     enum {
0061         Identity = 84
0062     };
0063 
0064     KDevelop::Declaration* clonePrivate() const override;
0065 private:
0066     DUCHAIN_DECLARE_DATA(ClassMethodDeclaration)
0067 };
0068 
0069 }
0070 
0071 #endif // CLASSMETHODDECLARATION_H
0072