Generate __attribute__(deprecated) for deprecated APIs.
We allow also a custom deprecation message.
Change-Id: I297bed611c7fbbb34d41e7edd796557c9afe50da
diff --git a/api/GenerateDocumentation.cpp b/api/GenerateDocumentation.cpp
index b78edae..565f4fb 100644
--- a/api/GenerateDocumentation.cpp
+++ b/api/GenerateDocumentation.cpp
@@ -340,22 +340,26 @@
}
}
-static void writeDetailedTypeSpecification(GeneratedFile* file, const TypeSpecification* type) {
- switch (type->getKind()) {
- case SIMPLE:
- *file << "<p>A typedef of: " << type->getSimpleType()
+static void writeDetailedTypeSpecification(GeneratedFile* file, const TypeSpecification* spec) {
+ switch (spec->getKind()) {
+ case SIMPLE: {
+ Type* type = spec->getType();
+ *file << "<p>A typedef of: " << spec->getSimpleType()
+ << makeAttributeTag(spec->getAttribute(), "", type->deprecated(),
+ type->getDeprecatedMessage())
<< " ";
- writeHtmlVersionTag(file, type->getVersionInfo());
+ writeHtmlVersionTag(file, spec->getVersionInfo());
*file << "</p>\n";
break;
+ }
case ENUM: {
*file << "<p>An enum with the following values: \n";
- writeHtmlVersionTag(file, type->getVersionInfo());
+ writeHtmlVersionTag(file, spec->getVersionInfo());
*file << "</p>\n";
*file << " <table class='jd-tagtable'><tbody>\n";
- const vector<string>& values = type->getValues();
- const vector<string>& valueComments = type->getValueComments();
+ const vector<string>& values = spec->getValues();
+ const vector<string>& valueComments = spec->getValueComments();
for (size_t i = 0; i < values.size(); i++) {
*file << " <tr><th>" << values[i] << "</th><td>";
if (valueComments.size() > i) {
@@ -368,12 +372,12 @@
}
case STRUCT: {
*file << "<p>A structure with the following fields: ";
- writeHtmlVersionTag(file, type->getVersionInfo());
+ writeHtmlVersionTag(file, spec->getVersionInfo());
*file << "</p>\n";
*file << " <table class='jd-tagtable'><tbody>\n";
- const vector<string>& fields = type->getFields();
- const vector<string>& fieldComments = type->getFieldComments();
+ const vector<string>& fields = spec->getFields();
+ const vector<string>& fieldComments = spec->getFieldComments();
for (size_t i = 0; i < fields.size(); i++) {
*file << " <tr><th>" << fields[i] << "</th><td>";
if (fieldComments.size() > i && !fieldComments[i].empty()) {