3#ifndef INLINECOMPONENTUTILS_P_H
4#define INLINECOMPONENTUTILS_P_H
17#include <private/qv4compileddata_p.h>
18#include <private/qv4resolvedtypereference_p.h>
25 using IndexType = std::vector<QV4::CompiledData::InlineComponent>::size_type;
66template<
typename ObjectContainer,
typename InlineComponent>
69 const std::vector<InlineComponent> &allICs)
71 using CompiledObject =
typename ObjectContainer::CompiledObject;
75 for (
typename std::vector<InlineComponent>::size_type
i = 0;
i < allICs.size(); ++
i) {
76 const auto& ic = allICs[
i];
77 const CompiledObject *
obj = objectContainer->objectAt(ic.objectIndex);
81 const auto targetType = targetTypeRef->
type();
82 if (targetType.isInlineComponentType()
85 return objectContainer->stringAt(icSearched.nameIndex)
86 == targetType.elementName();
90 adjacencyList[std::distance(allICs.cbegin(), icIt)].push_back(&
target);
94 if (
obj->inheritedTypeNameIndex != 0) {
96 createEdgeFromTypeRef(parentTypeRef);
99 auto referencedInICObjectIndex = ic.objectIndex + 1;
100 while (
int(referencedInICObjectIndex) < objectContainer->objectCount()) {
101 auto potentiallyReferencedInICObject = objectContainer->objectAt(referencedInICObjectIndex);
103 = !potentiallyReferencedInICObject->hasFlag(
105 && potentiallyReferencedInICObject->hasFlag(
109 createEdgeFromTypeRef(objectContainer->resolvedType(potentiallyReferencedInICObject->inheritedTypeNameIndex));
110 ++referencedInICObjectIndex;
126 auto const &edges = adjacencyList[node->
index()];
127 for (
auto edgeTarget =edges.begin(); edgeTarget != edges.end(); ++edgeTarget) {
128 topoVisit(*edgeTarget, adjacencyList, hasCycle, nodesSorted);
132 nodesSorted.push_back(*node);
139 nodesSorted.reserve(nodes.size());
142 auto currentNodeIt = std::find_if(nodes.begin(), nodes.end(), [](
const Node& node) {
143 return !node.hasPermanentMark();
147 while (currentNodeIt != nodes.end() && !hasCycle) {
148 Node& currentNode = *currentNodeIt;
149 topoVisit(¤tNode, adjacencyList, hasCycle, nodesSorted);
150 currentNodeIt = std::find_if(nodes.begin(), nodes.end(), [](
const Node& node) {
151 return !node.hasPermanentMark();
Combined button and popup list for selecting options.
NodeList topoSort(NodeList &nodes, AdjacencyList &adjacencyList, bool &hasCycle)
void topoVisit(Node *node, AdjacencyList &adjacencyList, bool &hasCycle, NodeList &nodesSorted)
void fillAdjacencyListForInlineComponents(ObjectContainer *objectContainer, AdjacencyList &adjacencyList, NodeList &nodes, const std::vector< InlineComponent > &allICs)
std::vector< std::vector< Node * > > AdjacencyList
std::vector< Node > NodeList
bool containedInSameType(const QQmlType &a, const QQmlType &b)
constexpr QSpecialIntegerBitfieldInitializer QSpecialIntegerBitfieldZero
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
@ IsPartOfInlineComponent
Node(const Node &)=default
Node & operator=(Node const &)=default
bool hasTemporaryMark() const
bool operator==(Node const &other) const
bool hasPermanentMark() const
Node & operator=(Node &&)=default