diff options
Diffstat (limited to 'cpp/src/slice2docbook/Gen.cpp')
-rw-r--r-- | cpp/src/slice2docbook/Gen.cpp | 147 |
1 files changed, 140 insertions, 7 deletions
diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp index f0dbc86d38c..d65d7588f23 100644 --- a/cpp/src/slice2docbook/Gen.cpp +++ b/cpp/src/slice2docbook/Gen.cpp @@ -173,14 +173,60 @@ Slice::Gen::visitContainer(const ContainerPtr& p) end(); } - VectorList vectors = p->vectors(); - vectors.sort(); - if (!vectors.empty()) + StructList structs = p->structs(); + structs.sort(); + if (!structs.empty()) { - start("section", "Vector Index"); + start("section", "Struct Index"); start("variablelist"); - for (VectorList::iterator q = vectors.begin(); q != vectors.end(); ++q) + for (StructList::iterator q = structs.begin(); q != structs.end(); ++q) + { + start("varlistentry"); + start("term"); + O << nl << toString(*q, p); + end(); + start("listitem"); + printSummary(*q); + end(); + end(); + } + + end(); + end(); + } + + SequenceList sequences = p->sequences(); + sequences.sort(); + if (!sequences.empty()) + { + start("section", "Sequence Index"); + start("variablelist"); + + for (SequenceList::iterator q = sequences.begin(); q != sequences.end(); ++q) + { + start("varlistentry"); + start("term"); + O << nl << toString(*q, p); + end(); + start("listitem"); + printSummary(*q); + end(); + end(); + } + + end(); + end(); + } + + DictionaryList dictionaries = p->dictionaries(); + dictionaries.sort(); + if (!dictionaries.empty()) + { + start("section", "Dictionary Index"); + start("variablelist"); + + for (DictionaryList::iterator q = dictionaries.begin(); q != dictionaries.end(); ++q) { start("varlistentry"); start("term"); @@ -245,14 +291,14 @@ Slice::Gen::visitContainer(const ContainerPtr& p) end(); { - for (VectorList::iterator q = vectors.begin(); q != vectors.end(); ++q) + for (SequenceList::iterator q = sequences.begin(); q != sequences.end(); ++q) { TypePtr type = (*q)->type(); start("section id=" + scopedToId((*q)->scoped()), (*q)->name()); O.zeroIndent(); - O << nl << "<synopsis>vector< " << toString(type, p) << " > <type>" << (*q)->name() + O << nl << "<synopsis>sequence< " << toString(type, p) << " > <type>" << (*q)->name() << "</type>;</synopsis>"; O.restoreIndent(); @@ -263,6 +309,25 @@ Slice::Gen::visitContainer(const ContainerPtr& p) } { + for (DictionaryList::iterator q = dictionaries.begin(); q != dictionaries.end(); ++q) + { + TypePtr keyType = (*q)->keyType(); + TypePtr valueType = (*q)->valueType(); + + start("section id=" + scopedToId((*q)->scoped()), (*q)->name()); + + O.zeroIndent(); + O << nl << "<synopsis>dictionary< " << toString(keyType, p) << ", " << toString(valueType, p) + << " > <type>" << (*q)->name() << "</type>;</synopsis>"; + O.restoreIndent(); + + printComment(*q); + + end(); + } + } + + { for (EnumList::iterator q = enums.begin(); q != enums.end(); ++q) { start("section id=" + scopedToId((*q)->scoped()), (*q)->name()); @@ -504,6 +569,66 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p) } void +Slice::Gen::visitStructStart(const StructPtr& p) +{ + start(_chapter + " id=" + scopedToId(p->scoped()), p->scoped().substr(2)); + + start("section", "Overview"); + O.zeroIndent(); + O << nl << "<synopsis>"; + O << "struct <structname>" << p->name() << "</structname>"; + O << "</synopsis>"; + O.restoreIndent(); + + printComment(p); + + DataMemberList dataMembers = p->dataMembers(); + dataMembers.sort(); + if (!dataMembers.empty()) + { + start("section", "Data Member Index"); + start("variablelist"); + + for (DataMemberList::iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + start("varlistentry"); + start("term"); + O << nl << toString(*q, p); + end(); + start("listitem"); + printSummary(*q); + end(); + end(); + } + + end(); + end(); + } + + end(); + + { + for (DataMemberList::iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + TypePtr type = (*q)->type(); + + start("section id=" + scopedToId((*q)->scoped()), (*q)->name()); + + O.zeroIndent(); + O << nl << "<synopsis>" << toString(type, p) << " <structfield>" << (*q)->name() + << "</structfield>;</synopsis>"; + O.restoreIndent(); + + printComment(*q); + + end(); + } + } + + end(); +} + +void Slice::Gen::printHeader() { static const char* header = @@ -836,6 +961,14 @@ Slice::Gen::toString(const SyntaxTreeBasePtr& p, const ContainerPtr& container) s = getScopedMinimized(cl, container); } + StructPtr st = StructPtr::dynamicCast(p); + if (st) + { + tag = "structname"; + linkend = scopedToId(st->scoped()); + s = getScopedMinimized(st, container); + } + if (s.empty()) { ContainedPtr contained = ContainedPtr::dynamicCast(p); |