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

0001 /*
0002     SPDX-FileCopyrightText: 2009 Milian Wolff <mail@milianw.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef INTEGRALTYPEEXTENDED_H
0008 #define INTEGRALTYPEEXTENDED_H
0009 
0010 #include <language/duchain/types/integraltype.h>
0011 #include <language/duchain/types/typesystemdata.h>
0012 #include "phpduchainexport.h"
0013 
0014 namespace Php
0015 {
0016 
0017 typedef KDevelop::IntegralTypeData IntegralTypeExtendedData;
0018 
0019 /**
0020  * Drop-In replacement for the IntegralType in KDevplatform with
0021  * some extended logic specific for PHP
0022  */
0023 class KDEVPHPDUCHAIN_EXPORT IntegralTypeExtended: public KDevelop::IntegralType
0024 {
0025 public:
0026     typedef KDevelop::TypePtr<IntegralTypeExtended> Ptr;
0027 
0028     enum PHPIntegralTypes {
0029         TypeResource = KDevelop::IntegralType::TypeLanguageSpecific,
0030         TypeCallable,
0031         TypeObject
0032     };
0033 
0034     /// Default constructor
0035     IntegralTypeExtended(uint type = TypeNone);
0036     /// Copy constructor. \param rhs type to copy
0037     IntegralTypeExtended(const IntegralTypeExtended& rhs);
0038     /// Constructor using raw data. \param data internal data.
0039     IntegralTypeExtended(IntegralTypeExtendedData& data);
0040 
0041     QString toString() const override;
0042 
0043     KDevelop::AbstractType* clone() const override;
0044 
0045     bool equals(const KDevelop::AbstractType* rhs) const override;
0046 
0047     uint hash() const override;
0048 
0049     enum {
0050         ///TODO: is that value OK?
0051         Identity = 50
0052     };
0053 
0054   typedef KDevelop::IntegralTypeData Data;
0055   typedef KDevelop::IntegralType BaseType;
0056 
0057 protected:
0058     TYPE_DECLARE_DATA(IntegralTypeExtended);
0059 };
0060 
0061 }
0062 
0063 #endif // PHPINTEGRALTYPE_H
0064