Commit f3c13e41 authored by Wouter's avatar Wouter

Use proper QSet for wrapper enums

parent 418d5775
......@@ -115,6 +115,7 @@ Config::Config(QObject* parent): QObject(parent)
m_globalTypeHeaderMap.insert("QVariant", "QtCore/QVariant");
m_globalTypeHeaderMap.insert("QVariantMap", "QtCore/QVariantMap");
m_globalTypeHeaderMap.insert("QList", "QtCore/QList");
m_globalTypeHeaderMap.insert("QSet", "QtCore/QSet");
m_globalTypeHeaderMap.insert("QSharedPointer", "QtCore/QSharedPointer");
// TODO Add more
......@@ -137,6 +138,7 @@ Config::Config(QObject* parent): QObject(parent)
m_headerDependencies.insert("array", "QVariant");
m_headerDependencies.insert("wrapper", "AbstractWrapper");
m_headerDependencies.insert("wrapper", "QVariant");
m_headerDependencies.insert("wrapper", "QSet");
m_headerDependencies.insert("union", "QVariant");
m_headerDependencies.insert("union", "QSharedPointer");
}
......
......@@ -61,7 +61,7 @@ public:
/**
* Get a list of permitted values.
*/
virtual QList<{{ class.wrappedType.type.className }}> allowedValues() const;
virtual QSet<{{ class.wrappedType.type.className }}> allowedValues() const;
{% endif %}
/**
......
......@@ -76,12 +76,12 @@ bool {{ class.fullName }}::isValid()
}
{% if class.constraints.enums %}
virtual QSet<{{ class.wrappedType.type.className }}> {{ class.fullName }}::allowedValues() const {
QSet<{{ class.wrappedType.type.className }}> {{ class.fullName }}::allowedValues() const {
QSet<{{ class.wrappedType.type.className }}> result;
{% for base in class.inheritance %}result.unite({{ class.wrappedType.type.fullName }}::allowedValues());{% endfor %}
{% for item in class.constraints.enums %}
result.append({{ item }});
result.insert({{ item }});
{% endfor %}
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment