Warning, file /kdevelop/kdev-python/duchain/types/indexedcontainer.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2011 Sven Brauch <svenbrauch@googlemail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef INDEXEDCONTAINER_H
0008 #define INDEXEDCONTAINER_H
0009 
0010 #include <language/duchain/types/structuretype.h>
0011 #include <language/duchain/types/typesystemdata.h>
0012 
0013 #include "types/unsuretype.h"
0014 #include "pythonduchainexport.h"
0015 
0016 using namespace KDevelop;
0017 
0018 namespace Python {
0019 
0020 KDEVPYTHONDUCHAIN_EXPORT DECLARE_LIST_MEMBER_HASH(IndexedContainerData, m_values, IndexedType)
0021 
0022 class KDEVPYTHONDUCHAIN_EXPORT IndexedContainerData : public KDevelop::StructureTypeData
0023 {
0024 public:
0025     /// Constructor
0026     IndexedContainerData()
0027         : KDevelop::StructureTypeData()
0028     {
0029         initializeAppendedLists(m_dynamic);
0030     }
0031     /// Copy constructor. \param rhs data to copy
0032     IndexedContainerData( const IndexedContainerData& rhs )
0033         : KDevelop::StructureTypeData(rhs)
0034     {
0035         initializeAppendedLists(m_dynamic);
0036         copyListsFrom(rhs);
0037     }
0038     
0039     ~IndexedContainerData() {
0040         freeAppendedLists();
0041     };
0042     
0043     START_APPENDED_LISTS_BASE(IndexedContainerData, StructureTypeData)
0044     APPENDED_LIST_FIRST(IndexedContainerData, IndexedType, m_values)
0045     END_APPENDED_LISTS(IndexedContainerData, m_values)
0046 };
0047 
0048 
0049 class KDEVPYTHONDUCHAIN_EXPORT IndexedContainer : public KDevelop::StructureType
0050 {
0051 public:
0052     typedef TypePtr<IndexedContainer> Ptr;
0053     
0054     IndexedContainer();
0055     IndexedContainer(const IndexedContainer& rhs);
0056     IndexedContainer(IndexedContainerData& data);
0057     void addEntry(AbstractType::Ptr typeToAdd);
0058     AbstractType* clone() const override;
0059     uint hash() const override;
0060     int typesCount() const;
0061     const IndexedType& typeAt(int index) const;
0062     void replaceType(int index, AbstractType::Ptr newType);
0063     AbstractType::Ptr asUnsureType() const;
0064     QString toString() const override;
0065     // "toString"s only the container type, not the content; used in declarationnavigationcontext to create
0066     // separate links for the content and container type
0067     // by keeping toString separate, it is possible to have a pretty type in unsure types etc. without additional
0068     // efforts being necessary
0069     QString containerToString() const;
0070     
0071     bool equals(const AbstractType* rhs) const override;
0072     
0073     enum {
0074 // #warning check identity value (59)
0075         Identity = 59
0076     };
0077     
0078     typedef IndexedContainerData Data;
0079     
0080 protected:
0081     TYPE_DECLARE_DATA(IndexedContainer);
0082 };
0083 
0084 }
0085 
0086 #endif // INDEXEDCONTAINER_H