aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-09-01 17:37:44 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-09-01 17:37:44 -0300
commite2ac43587bf4549ca01f5f6092f7c164bf3395ef (patch)
treedc65770b111edf0ac7f493136c0ee0d3b9aeb177
parent5242336237e970c2f47f31f6e941073317775279 (diff)
moved setInclude, addExtraIncludes and related methods from ComplexTypeEntry
to TypeEntry, this way they will be also available on PrimitiveTypeEntry; the type system format now accepts the 'include' tag
-rw-r--r--typesystem.cpp12
-rw-r--r--typesystem.h57
2 files changed, 34 insertions, 35 deletions
diff --git a/typesystem.cpp b/typesystem.cpp
index 6475db065..90b77faf1 100644
--- a/typesystem.cpp
+++ b/typesystem.cpp
@@ -1530,12 +1530,12 @@ bool Handler::startElement(const QString &, const QString &n,
Include inc(loc, attributes["file-name"]);
ComplexTypeEntry *ctype = static_cast<ComplexTypeEntry *>(element->entry);
- if (topElement.type & StackElement::ComplexTypeEntryMask)
- ctype->setInclude(inc);
- else if (topElement.type == StackElement::ExtraIncludes)
- ctype->addExtraInclude(inc);
- else {
- m_error = "Only supported parents are complex types and extra-includes";
+ if (topElement.type & (StackElement::ComplexTypeEntryMask | StackElement::PrimitiveTypeEntry)) {
+ element->entry->setInclude(inc);
+ } else if (topElement.type == StackElement::ExtraIncludes) {
+ element->entry->addExtraInclude(inc);
+ } else {
+ m_error = "Only supported parent tags are primitive-type, complex types or extra-includes";
return false;
}
diff --git a/typesystem.h b/typesystem.h
index 936b7056e..65dd28a01 100644
--- a/typesystem.h
+++ b/typesystem.h
@@ -763,6 +763,31 @@ public:
return m_docModifications;
}
+ IncludeList extraIncludes() const
+ {
+ return m_extraIncludes;
+ }
+ void setExtraIncludes(const IncludeList &includes)
+ {
+ m_extraIncludes = includes;
+ }
+ void addExtraInclude(const Include &include)
+ {
+ if (!m_includesUsed.value(include.name, false)) {
+ m_extraIncludes << include;
+ m_includesUsed[include.name] = true;
+ }
+ }
+
+ Include include() const
+ {
+ return m_include;
+ }
+ void setInclude(const Include &inc)
+ {
+ m_include = inc;
+ }
+
private:
QString m_name;
Type m_type;
@@ -772,6 +797,9 @@ private:
bool m_preferredConversion;
CodeSnipList m_codeSnips;
DocModificationList m_docModifications;
+ IncludeList m_extraIncludes;
+ Include m_include;
+ QHash<QString, bool> m_includesUsed;
};
typedef QHash<QString, QList<TypeEntry *> > TypeEntryHash;
typedef QHash<QString, TypeEntry *> SingleTypeEntryHash;
@@ -1210,22 +1238,6 @@ public:
return true;
}
- IncludeList extraIncludes() const
- {
- return m_extraIncludes;
- }
- void setExtraIncludes(const IncludeList &includes)
- {
- m_extraIncludes = includes;
- }
- void addExtraInclude(const Include &include)
- {
- if (!m_includesUsed.value(include.name, false)) {
- m_extraIncludes << include;
- m_includesUsed[include.name] = true;
- }
- }
-
ComplexTypeEntry *copy() const
{
ComplexTypeEntry *centry = new ComplexTypeEntry(name(), type());
@@ -1256,16 +1268,6 @@ public:
return strings_jobject;
}
-
- Include include() const
- {
- return m_include;
- }
- void setInclude(const Include &inc)
- {
- m_include = inc;
- }
-
void setTypeFlags(TypeFlags flags)
{
m_typeFlags = flags;
@@ -1419,9 +1421,6 @@ public:
private:
- IncludeList m_extraIncludes;
- Include m_include;
- QHash<QString, bool> m_includesUsed;
FunctionModificationList m_functionMods;
FieldModificationList m_fieldMods;
QString m_package;