summaryrefslogtreecommitdiff
path: root/cpp/src/slice2html/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2html/Gen.cpp')
-rw-r--r--cpp/src/slice2html/Gen.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp
index 93e97489b4f..467257c628c 100644
--- a/cpp/src/slice2html/Gen.cpp
+++ b/cpp/src/slice2html/Gen.cpp
@@ -2107,6 +2107,29 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
assert(_out.currIndent() == indent);
+ ConstList consts = p->consts();
+
+ if(!consts.empty())
+ {
+ start("h2");
+ _out << "Constant Index";
+ end();
+ start("dl");
+ for(ConstList::const_iterator q = consts.begin(); q != consts.end(); ++q)
+ {
+ start("dt", "Symbol");
+ _out << toString(*q, p, false, true);
+ end();
+ start("dd");
+ string metadata;
+ printSummary(*q, p, (*q)->findMetaData("deprecate", metadata));
+ end();
+ }
+ end();
+ }
+
+ assert(_out.currIndent() == indent);
+
EnumList enums = p->enums();
if(!enums.empty())
@@ -2205,6 +2228,46 @@ Slice::ModuleGenerator::visitContainer(const ContainerPtr& p)
end();
}
}
+
+ if(!consts.empty())
+ {
+ start("h2");
+ _out << "Constants";
+ end();
+ for(ConstList::const_iterator q = consts.begin(); q != consts.end(); ++q)
+ {
+ start("dl");
+ start("dt");
+ start("span", "Synopsis");
+ _out << "const " << toString((*q)->type(), p, false, true) << " " << toString(*q, p) << " = ";
+ if(EnumPtr::dynamicCast((*q)->type()))
+ {
+ _out << toString((*q)->value(), p, false, true);
+ }
+ else
+ {
+ _out << (*q)->literal();
+ }
+ _out << ";";
+ end();
+ end();
+
+ start("dd");
+ string metadata, deprecateReason;
+ if((*q)->findMetaData("deprecate", metadata))
+ {
+ deprecateReason = "This type is deprecated.";
+ if(metadata.find("deprecate:") == 0 && metadata.size() > 10)
+ {
+ deprecateReason = metadata.substr(10);
+ }
+ }
+
+ printComment(*q, p, deprecateReason, true);
+ end();
+ end();
+ }
+ }
}
Slice::ExceptionGenerator::ExceptionGenerator(XMLOutput& o, const Files& files)