File indexing completed on 2024-06-23 04:34:45

0001 /*
0002     SPDX-FileCopyrightText: 2002-2005 Roberto Raggi <roberto@kdevelop.org>
0003     SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org>
0004     SPDX-FileCopyrightText: 2006-2008 Hamish Rodda <rodda@kde.org>
0005     SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-only
0008 */
0009 
0010 #ifndef KDEVPLATFORM_ENUMERATORTYPE_H
0011 #define KDEVPLATFORM_ENUMERATORTYPE_H
0012 
0013 #include "identifiedtype.h"
0014 #include "constantintegraltype.h"
0015 
0016 namespace KDevelop {
0017 using EnumeratorTypeBase = KDevelop::MergeIdentifiedType<ConstantIntegralType>;
0018 
0019 using EnumeratorTypeData = EnumeratorTypeBase::Data;
0020 
0021 //The same as EnumerationType, with the difference that here the value is also known
0022 class KDEVPLATFORMLANGUAGE_EXPORT EnumeratorType
0023     : public EnumeratorTypeBase
0024 {
0025 public:
0026     EnumeratorType(const EnumeratorType& rhs);
0027 
0028     explicit EnumeratorType(EnumeratorTypeData& data);
0029 
0030     EnumeratorType();
0031 
0032     EnumeratorType& operator=(const EnumeratorType& rhs) = delete;
0033 
0034     using Ptr = TypePtr<EnumeratorType>;
0035 
0036     bool equals(const KDevelop::AbstractType* rhs) const override;
0037 
0038     KDevelop::AbstractType* clone() const override;
0039 
0040     uint hash() const override;
0041 
0042     WhichType whichType() const override;
0043 
0044     QString toString() const override;
0045 
0046     enum {
0047         Identity = 20
0048     };
0049 
0050     using Data = EnumeratorTypeData;
0051 
0052 protected:
0053     TYPE_DECLARE_DATA(EnumeratorType);
0054 };
0055 }
0056 
0057 #endif // KDEVPLATFORM_ENUMERATORTYPE_H