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 PHP_STRUCTURETYPE_H 0008 #define PHP_STRUCTURETYPE_H 0009 0010 #include <language/duchain/types/structuretype.h> 0011 #include <language/duchain/types/typesystemdata.h> 0012 #include <serialization/indexedstring.h> 0013 0014 #include "phpduchainexport.h" 0015 0016 namespace Php 0017 { 0018 0019 class KDEVPHPDUCHAIN_EXPORT StructureTypeData : public KDevelop::StructureTypeData 0020 { 0021 public: 0022 /// Constructor 0023 StructureTypeData() 0024 : KDevelop::StructureTypeData() 0025 { 0026 } 0027 /// Copy constructor. \param rhs data to copy 0028 StructureTypeData( const StructureTypeData& rhs ) 0029 : KDevelop::StructureTypeData(rhs), prettyName(rhs.prettyName) 0030 { 0031 } 0032 0033 KDevelop::IndexedString prettyName; 0034 }; 0035 0036 /** 0037 * Drop-In replacement for the StructureType in KDevplatform which 0038 * makes it possible to store the type as lower case but 0039 * keeping the "pretty" name intact. 0040 */ 0041 class KDEVPHPDUCHAIN_EXPORT StructureType: public KDevelop::StructureType 0042 { 0043 public: 0044 typedef KDevelop::TypePtr<StructureType> Ptr; 0045 0046 /// Default constructor 0047 StructureType(); 0048 /// Copy constructor. \param rhs type to copy 0049 StructureType(const StructureType& rhs); 0050 /// Constructor using raw data. \param data internal data. 0051 StructureType(StructureTypeData& data); 0052 0053 void setPrettyName(const KDevelop::IndexedString& name); 0054 KDevelop::IndexedString prettyName() const; 0055 0056 QString toString() const override; 0057 0058 KDevelop::AbstractType* clone() const override; 0059 0060 uint hash() const override; 0061 0062 enum { 0063 ///TODO: is that value OK? 0064 Identity = 51 0065 }; 0066 0067 typedef StructureTypeData Data; 0068 typedef KDevelop::StructureType BaseType; 0069 0070 protected: 0071 TYPE_DECLARE_DATA(StructureType); 0072 }; 0073 0074 } 0075 0076 #endif // PHP_STRUCTURETYPE_H 0077