File: indexedcontainer.h

package info (click to toggle)
kdevelop-php 24.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,616 kB
  • sloc: cpp: 20,858; php: 15,243; xml: 136; sh: 58; makefile: 10
file content (83 lines) | stat: -rw-r--r-- 2,283 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
    SPDX-FileCopyrightText: 2011 Sven Brauch <svenbrauch@googlemail.com>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#ifndef INDEXEDCONTAINER_H
#define INDEXEDCONTAINER_H

#include "structuretype.h"
#include <language/duchain/types/typesystemdata.h>

#include "phpduchainexport.h"

using namespace KDevelop;

namespace Php {

KDEVPHPDUCHAIN_EXPORT DECLARE_LIST_MEMBER_HASH(IndexedContainerData, m_values, IndexedType)

class KDEVPHPDUCHAIN_EXPORT IndexedContainerData : public Php::StructureTypeData
{
public:
    /// Constructor
    IndexedContainerData()
        : Php::StructureTypeData()
    {
        initializeAppendedLists(m_dynamic);
    }
    /// Copy constructor. \param rhs data to copy
    IndexedContainerData( const IndexedContainerData& rhs )
        : Php::StructureTypeData(rhs)
    {
        initializeAppendedLists(m_dynamic);
        copyListsFrom(rhs);
    }

    ~IndexedContainerData() {
        freeAppendedLists();
    };

    START_APPENDED_LISTS_BASE(IndexedContainerData, StructureTypeData)
    APPENDED_LIST_FIRST(IndexedContainerData, IndexedType, m_values)
    END_APPENDED_LISTS(IndexedContainerData, m_values)
};


class KDEVPHPDUCHAIN_EXPORT IndexedContainer : public Php::StructureType
{
public:
    typedef TypePtr<IndexedContainer> Ptr;

    IndexedContainer();
    IndexedContainer(const IndexedContainer& rhs);
    IndexedContainer(IndexedContainerData& data);
    void addEntry(AbstractType::Ptr typeToAdd);
    AbstractType* clone() const override;
    uint hash() const override;
    int typesCount() const;
    const IndexedType& typeAt(int index) const;
    void replaceType(int index, AbstractType::Ptr newType);
    QString toString() const override;
    // "toString"s only the container type, not the content; used in declarationnavigationcontext to create
    // separate links for the content and container type
    // by keeping toString separate, it is possible to have a pretty type in mixed types etc. without additional
    // efforts being necessary
    QString containerToString() const;

    bool equals(const AbstractType* rhs) const override;

    enum {
        Identity = 52
    };

    typedef IndexedContainerData Data;

protected:
    TYPE_DECLARE_DATA(IndexedContainer);
};

}

#endif // INDEXEDCONTAINER_H