summaryrefslogtreecommitdiff
path: root/cpp/src/slice2html/Gen.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-12-20 05:09:15 +0000
committerMichi Henning <michi@zeroc.com>2006-12-20 05:09:15 +0000
commitbf118bf417cbaba4734b988d541ab4e779533b69 (patch)
treec50b7436c53e37c4428b6e00a4d0190a1634e791 /cpp/src/slice2html/Gen.cpp
parentFixed bug that caused link to be omitted to derived classes and exceptions. (diff)
downloadice-bf118bf417cbaba4734b988d541ab4e779533b69.tar.bz2
ice-bf118bf417cbaba4734b988d541ab4e779533b69.tar.xz
ice-bf118bf417cbaba4734b988d541ab4e779533b69.zip
Changed to use headings instead of display lists.
Diffstat (limited to 'cpp/src/slice2html/Gen.cpp')
-rw-r--r--cpp/src/slice2html/Gen.cpp297
1 files changed, 56 insertions, 241 deletions
diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp
index f7d57b9e380..ee2260215fc 100644
--- a/cpp/src/slice2html/Gen.cpp
+++ b/cpp/src/slice2html/Gen.cpp
@@ -113,7 +113,7 @@ Slice::GeneratorBase::setHeader(const string& header)
XMLOutput O1(hdr1);
O1 << "<!-- Generated by Ice version " << ICE_STRING_VERSION << " -->";
O1 << sp;
- O1 << nl << "<!DOCTYPE html PUBLIC \"-//W3C//dtD html 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";
+ O1 << nl << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">";
O1 << se("html");
O1 << se("head");
O1 << se("title") << nl;
@@ -285,30 +285,27 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
if(pos != string::npos)
{
comment.erase(pos + 1);
+ start("p");
_out.zeroIndent();
_out << nl << comment;
_out.restoreIndent();
+ end();
}
if(!deprecateReason.empty())
{
- end();
- start("dd");
+ start("p");
_out << nl << deprecateReason;
+ end();
}
assert(_out.currIndent() == indent);
- bool startedList = false;
-
if(!par.empty())
{
- start("dl");
- startedList = true;
- start("dt", "Heading");
+ start("h4");
_out << "Parameters";
end();
- start("dd");
start("dl");
for(StringList::const_iterator q = par.begin(); q != par.end(); ++q)
{
@@ -333,36 +330,23 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
end();
}
end();
- end();
}
if(!ret.empty())
{
- if(!startedList)
- {
- start("dl");
- startedList = true;
- }
- start("dt");
+ start("h4");
_out << "Return Value";
end();
- start("dd", "Symbol");
+ start("p", "Symbol");
_out << ret.front();
end();
}
-
if(!throws.empty())
{
- if(!startedList)
- {
- start("dl");
- startedList = true;
- }
- start("dt", "Heading");
+ start("h4");
_out << "Exceptions";
end();
- start("dd");
start("dl");
for(StringList::const_iterator q = throws.begin(); q != throws.end(); ++q)
{
@@ -387,10 +371,8 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
end();
}
end();
- end();
}
-
ClassList derivedClasses;
ClassDefPtr def = ClassDefPtr::dynamicCast(p);
if(def)
@@ -399,15 +381,9 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
}
if(!derivedClasses.empty())
{
- if(!startedList)
- {
- start("dl");
- startedList = true;
- }
- start("dt", "Heading");
+ start("h4", "Heading");
_out << "Derived Classes and Interfaces";
end();
- start("dd");
start("dl");
for(ClassList::const_iterator q = derivedClasses.begin(); q != derivedClasses.end(); ++q)
{
@@ -416,7 +392,6 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
end();
}
end();
- end();
}
ExceptionList derivedExceptions;
@@ -426,15 +401,9 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
derivedExceptions = p->unit()->findDerivedExceptions(ex);
if(!derivedExceptions.empty())
{
- if(!startedList)
- {
- start("dl");
- startedList = true;
- }
- start("dt", "Heading");
+ start("h4");
_out << "Derived Exceptions";
end();
- start("dd");
start("dl");
for(ExceptionList::const_iterator q = derivedExceptions.begin(); q != derivedExceptions.end(); ++q)
{
@@ -443,22 +412,15 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
end();
}
end();
- end();
}
ContainedList usedBy;
usedBy = p->unit()->findUsedBy(ex);
if(!usedBy.empty())
{
- if(!startedList)
- {
- start("dl");
- startedList = true;
- }
- start("dt", "Heading");
+ start("h4", "Heading");
_out << "Used By";
end();
- start("dd");
start("dl", "UsedBy");
//
// We first extract the symbol names from the used-by list and sort
@@ -477,7 +439,6 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
end();
}
end();
- end();
}
}
@@ -512,15 +473,9 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
strings.sort();
strings.unique();
- if(!startedList)
- {
- start("dl");
- startedList = true;
- }
- start("dt", "Heading");
+ start("h4", "Heading");
_out << "Used By";
end();
- start("dd");
start("dl", "UsedBy");
for(list<string>::const_iterator p = strings.begin(); p != strings.end(); ++p)
{
@@ -529,20 +484,13 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
end();
}
end();
- end();
}
if(!see.empty())
{
- if(!startedList)
- {
- start("dl");
- startedList = true;
- }
- start("dt", "Heading");
+ start("h4");
_out << "See Also";
end();
- start("dd");
start("dl", "UsedBy");
for(StringList::const_iterator q = see.begin(); q != see.end(); ++q)
{
@@ -551,12 +499,6 @@ Slice::GeneratorBase::printComment(const ContainedPtr& p, const string& deprecat
end();
}
end();
- end();
- }
-
- if(startedList)
- {
- end();
}
assert(_out.currIndent() == indent);
@@ -805,7 +747,7 @@ Slice::GeneratorBase::toString(const string& str, const ContainerPtr& container,
// If we can't find the string, printing it in typewriter
// font is the best we can do.
//
- return "<span class=Symbol>" + s + "</span>";
+ return "<tt>" + s + "</tt>";
}
string
@@ -1219,16 +1161,12 @@ Slice::IndexGenerator::~IndexGenerator()
{
::std::sort(_modules.begin(), _modules.end());
- start("dl");
- start("dt", "Heading");
+ start("h1");
_out << "Slice Documentation Index";
end();
- start("dd");
- start("dl");
- start("dt", "Heading");
+ start("h2");
_out << "Modules";
end();
- start("dd");
start("dl");
for(ModuleDescriptions::const_iterator i = _modules.begin(); i != _modules.end(); ++i)
{
@@ -1240,10 +1178,6 @@ Slice::IndexGenerator::~IndexGenerator()
end();
}
end();
- end();
- end();
- end();
- end();
closeDoc();
}
@@ -1351,13 +1285,10 @@ Slice::ModuleGenerator::generate(const ModulePtr& m)
openDoc(m);
- start("dl");
- start("dt", "Symbol");
+ start("h1", "Symbol");
_out << toString(m, m, true);
end();
- start("dd");
- start("dl");
string metadata, deprecateReason;
if(m->findMetaData("deprecate", metadata))
{
@@ -1367,29 +1298,18 @@ Slice::ModuleGenerator::generate(const ModulePtr& m)
deprecateReason = metadata.substr(10);
}
}
- start("dt", "Heading");
+ start("h2");
_out << "Overview";
end();
- start("dd");
- start("dl");
- start("dt");
- start("span", "Synopsis");
+ start("h3", "Synopsis");
printMetaData(m);
_out << "module " << m->name();
end();
- end();
- start("dd");
+
printComment(m, deprecateReason, true);
- end();
- end();
visitContainer(m);
- end();
- end();
- end();
- end();
-
closeDoc();
assert(_out.currIndent() == indent);
@@ -1406,10 +1326,9 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!modules.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Module Index";
end();
- start("dd");
start("dl");
for(ModuleList::const_iterator q = modules.begin(); q != modules.end(); ++q)
{
@@ -1422,7 +1341,6 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
@@ -1437,10 +1355,9 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!classes.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Class Index";
end();
- start("dd");
start("dl");
for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q)
{
@@ -1453,17 +1370,15 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
if(!interfaces.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Interface Index";
end();
- start("dd");
start("dl");
for(ClassList::const_iterator q = interfaces.begin(); q != interfaces.end(); ++q)
{
@@ -1476,7 +1391,6 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
@@ -1485,10 +1399,9 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!exceptions.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Exception Index";
end();
- start("dd");
start("dl");
for(ExceptionList::const_iterator q = exceptions.begin(); q != exceptions.end(); ++q)
{
@@ -1501,7 +1414,6 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
@@ -1510,10 +1422,9 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!structs.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Structure Index";
end();
- start("dd");
start("dl");
for(StructList::const_iterator q = structs.begin(); q != structs.end(); ++q)
{
@@ -1526,7 +1437,6 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
@@ -1535,10 +1445,9 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!sequences.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Sequence Index";
end();
- start("dd");
start("dl");
for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
{
@@ -1551,7 +1460,6 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
@@ -1560,10 +1468,9 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!dictionaries.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Dictionary Index";
end();
- start("dd");
start("dl");
for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
{
@@ -1576,7 +1483,6 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
@@ -1585,10 +1491,9 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
if(!enums.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Enumeration Index";
end();
- start("dd");
start("dl");
for(EnumList::const_iterator q = enums.begin(); q != enums.end(); ++q)
{
@@ -1601,17 +1506,15 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
end();
- end();
}
assert(_out.currIndent() == indent);
if(!sequences.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Sequences";
end();
- start("dd");
for(SequenceList::const_iterator q = sequences.begin(); q != sequences.end(); ++q)
{
start("dl");
@@ -1642,15 +1545,13 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
end();
}
- end();
}
if(!dictionaries.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Dictionaries";
end();
- start("dd");
for(DictionaryList::const_iterator q = dictionaries.begin(); q != dictionaries.end(); ++q)
{
start("dl");
@@ -1683,7 +1584,6 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
end();
}
- end();
}
}
@@ -1701,8 +1601,7 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
openDoc(e);
- start("dl");
- start("dt", "Symbol, Heading");
+ start("h1", "Symbol");
_out << toString(e, e, true);
end();
@@ -1717,16 +1616,11 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
}
}
- start("dd");
- start("dl");
- start("dt", "Heading");
+ start("h2");
_out << "Overview";
end();
- start("dd");
- start("dl");
- start("dt");
- start("span", "Synopsis");
+ start("h3", "Synopsis");
printMetaData(e);
if(e->isLocal())
{
@@ -1744,20 +1638,16 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
_out.dec();
}
end();
- end();
- start("dd");
+
printComment(e, deprecateReason);
- end();
- end();
DataMemberList dataMembers = e->dataMembers();
if(_indexCount > 0 && dataMembers.size() >= _indexCount)
{
- start("dt", "Heading");
+ start("h2");
_out << "Data Member Index";
end();
- start("dd");
start("dl");
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -1770,15 +1660,13 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
end();
}
end();
- end();
}
if(!dataMembers.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Data Members";
end();
- start("dd");
start("dl");
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -1804,12 +1692,7 @@ Slice::ExceptionGenerator::generate(const ExceptionPtr& e)
end();
}
end();
- end();
}
- end();
- end();
- end();
- end();
closeDoc();
@@ -1830,8 +1713,7 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
openDoc(c);
- start("dl");
- start("dt", "Symbol");
+ start("h1", "Symbol");
_out << toString(c, c, true);
end();
@@ -1848,15 +1730,10 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
}
}
- start("dd");
- start("dl");
- start("dt", "Heading");
+ start("h2");
_out << "Overview";
end();
- start("dd");
- start("dl");
- start("dt");
- start("span", "Synopsis");
+ start("h3", "Synopsis");
printMetaData(c);
if(c->isLocal())
{
@@ -1885,22 +1762,16 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
}
}
end();
- end();
- start("dd");
printComment(c, deprecateReason);
- end();
- end();
- end();
OperationList operations = c->operations();
if(_indexCount > 0 && operations.size() >= _indexCount)
{
- start("dt", "Heading");
+ start("h2");
_out << "Operation Index";
end();
- start("dd");
start("dl");
for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
{
@@ -1913,17 +1784,15 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
end();
}
end();
- end();
}
DataMemberList dataMembers = c->dataMembers();
if(_indexCount > 0 && dataMembers.size() >= _indexCount)
{
- start("dt", "Heading");
+ start("h2");
_out << "Data Member Index";
end();
- start("dd");
start("dl");
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -1936,20 +1805,16 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
end();
}
end();
- end();
}
if(!operations.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Operations";
end();
- start("dd");
- start("dl");
for(OperationList::const_iterator q = operations.begin(); q != operations.end(); ++q)
{
- start("dt");
- start("span", "Synopsis");
+ start("h3", "Synopsis");
TypePtr returnType = (*q)->returnType();
_out << (returnType ? toString(returnType, c, false) : string("void")) << " "
<< toString(*q, c) << "(";
@@ -1984,9 +1849,7 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
}
}
end();
- end();
- start("dd");
string reason;
metadata.clear();
if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
@@ -1998,30 +1861,22 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
}
}
printComment(*q, reason);
- end();
}
- end();
- end();
}
if(!dataMembers.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Data Members";
end();
- start("dd");
- start("dl");
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- start("dt");
- start("span", "Synopsis");
+ start("h3", "Synopsis");
printMetaData(*q);
TypePtr type = (*q)->type();
_out << toString(type, c, false) << " " << toString(*q, c) << ";";
end();
- end();
- start("dd");
string reason;
metadata.clear();
if(deprecatedClass || (*q)->findMetaData("deprecate", metadata))
@@ -2034,16 +1889,9 @@ Slice::ClassGenerator::generate(const ClassDefPtr& c)
}
printComment(*q, reason);
- end();
}
- end();
- end();
}
- end();
- end();
- end();
-
closeDoc();
assert(_out.currIndent() == indent);
@@ -2063,8 +1911,7 @@ Slice::StructGenerator::generate(const StructPtr& s)
openDoc(s);
- start("dl");
- start("dt", "Symbol, Heading");
+ start("h1", "Symbol");
_out << toString(s, s, true);
end();
@@ -2079,16 +1926,11 @@ Slice::StructGenerator::generate(const StructPtr& s)
}
}
- start("dd");
- start("dl");
- start("dt", "Heading");
+ start("h2", "Heading");
_out << "Overview";
end();
- start("dd");
- start("dl");
- start("dt");
- start("span", "Synopsis");
+ start("h3", "Synopsis");
printMetaData(s);
if(s->isLocal())
{
@@ -2096,20 +1938,16 @@ Slice::StructGenerator::generate(const StructPtr& s)
}
_out << "struct " << s->name();
end();
- end();
- start("dd");
+
printComment(s, deprecateReason);
- end();
- end();
DataMemberList dataMembers = s->dataMembers();
if(_indexCount > 0 && dataMembers.size() >= _indexCount)
{
- start("dt", "Heading");
+ start("h2");
_out << "Data Member Index";
end();
- start("dd");
start("dl");
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -2122,15 +1960,13 @@ Slice::StructGenerator::generate(const StructPtr& s)
end();
}
end();
- end();
}
if(!dataMembers.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Data Members";
end();
- start("dd");
start("dl");
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -2156,12 +1992,7 @@ Slice::StructGenerator::generate(const StructPtr& s)
end();
}
end();
- end();
}
- end();
- end();
- end();
- end();
closeDoc();
@@ -2182,8 +2013,7 @@ Slice::EnumGenerator::generate(const EnumPtr& e)
openDoc(e);
- start("dl");
- start("dt", "Symbol, Heading");
+ start("h1", "Symbol");
_out << toString(e, e->container(), true);
end();
@@ -2198,16 +2028,11 @@ Slice::EnumGenerator::generate(const EnumPtr& e)
}
}
- start("dd");
- start("dl");
- start("dt", "Heading");
+ start("h2");
_out << "Overview";
end();
- start("dd");
- start("dl");
- start("dt");
- start("span", "Synopsis");
+ start("h3", "Synopsis");
printMetaData(e);
if(e->isLocal())
{
@@ -2215,20 +2040,15 @@ Slice::EnumGenerator::generate(const EnumPtr& e)
}
_out << "enum " << e->name();
end();
- end();
- start("dd");
printComment(e, deprecateReason);
- end();
- end();
EnumeratorList enumerators = e->getEnumerators();
if(!enumerators.empty())
{
- start("dt", "Heading");
+ start("h2");
_out << "Enumerators";
end();
- start("dd");
start("dl");
for(EnumeratorList::const_iterator q = enumerators.begin(); q != enumerators.end(); ++q)
{
@@ -2245,12 +2065,7 @@ Slice::EnumGenerator::generate(const EnumPtr& e)
end();
}
end();
- end();
}
- end();
- end();
- end();
- end();
closeDoc();