Skip to content

Commit

Permalink
Add docs to generated cpp code
Browse files Browse the repository at this point in the history
  • Loading branch information
sfodagain committed Apr 8, 2024
1 parent 5d5eb60 commit 586cdfb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ using namespace Aws::Eventstreamrpc;

<#list operations as operation>
<#assign OperationPascalCaseName = operation.getId().getName()/>
<#if operation.hasTrait("documentation")>
/**
<#list operation.findTrait("documentation").get().getValue()?split("\n") as docLine>
* ${docLine}
</#list>
*/
</#if>
<#if context.getOutputEventStreamInfo(operation).isPresent()>
std::shared_ptr<${OperationPascalCaseName}Operation> New${OperationPascalCaseName}(std::shared_ptr<${OperationPascalCaseName}StreamHandler> streamHandler) noexcept;
<#else>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<#else>
<#local BaseClass = "AbstractShapeBase"/>
</#if>
<#if convertedShape.hasTrait("documentation")>
<@placeIndents quantity=indents/>/** ${convertedShape.findTrait("documentation").get().getValue()} */
</#if>
<@placeIndents quantity=indents/>class ${export} ${PascalCaseMemberName} : public ${BaseClass}
<@placeIndents quantity=indents/>{
<@placeIndents quantity=indents/> public:
Expand All @@ -29,31 +32,30 @@
<#local PascalCase = fn_camel_to_pascal.apply(memberShape.getMemberName())>
<#local camelCase = memberShape.getMemberName()>
<#local memberTargetShape = context.getShape(memberShape.getTarget())>
<#local memberDocMessage = "">
<#if memberShape.hasTrait("documentation")>
<#local memberDocMessage += " * " + memberShape.findTrait("documentation").get().getValue() + "\n">
</#if>
<#if memberShape.hasTrait("deprecated")>
<#local deprecationMessage = "/* Deprecated">
<#local memberDocMessage += " * @deprecated">
<#if memberShape.findTrait("deprecated").get().getSince().isPresent()>
<#local deprecationMessage = deprecationMessage + " in " + memberShape.findTrait("deprecated").get().getSince().get()>
<#local memberDocMessage += " in " + memberShape.findTrait("deprecated").get().getSince().get()>
</#if>
<#if memberShape.findTrait("deprecated").get().getMessage().isPresent()>
<#local deprecationMessage = deprecationMessage + " " + memberShape.findTrait("deprecated").get().getMessage().get()>
<#local memberDocMessage += " " + memberShape.findTrait("deprecated").get().getMessage().get()>
</#if>
<#local deprecationMessage = deprecationMessage + " */">
<@placeIndents quantity=indents/> ${deprecationMessage}
<#local memberDocMessage += "\n">
</#if>
<#if memberTargetShape.hasTrait("documentation")>
<#local docMessage = "/* " + memberTargetShape.findTrait("documentation").get().getValue() + " */">
<@placeIndents quantity=indents/> ${docMessage}
<#if memberDocMessage?length gt 0>
<#local memberDocMessage = "/**\n" + memberDocMessage + " */">
</#if>
<#if memberTargetShape.hasTrait("enum")>
<@placeIndents quantity=indents/> ${memberDocMessage}
<@placeIndents quantity=indents/> void Set${PascalCase}(${memberTargetShape.getId().name} ${camelCase}) noexcept;
<#if memberShape.hasTrait("deprecated")>
<@placeIndents quantity=indents/> ${deprecationMessage}
</#if>
<#if memberTargetShape.hasTrait("documentation")>
<@placeIndents quantity=indents/> ${docMessage}
</#if>
<@placeIndents quantity=indents/> ${memberDocMessage}
<@placeIndents quantity=indents/> Aws::Crt::Optional<${memberTargetShape.getId().name}> Get${PascalCase}() noexcept;
<#else>
<@placeIndents quantity=indents/> ${memberDocMessage}
<@placeIndents quantity=indents/> void Set${PascalCase}(const ${context.getTypeName(memberShape)}& ${camelCase}) noexcept {
<#if shape.getDataShape().get().getType().name() == "UNION">
<@placeIndents quantity=indents/> m_${camelCase} = ${camelCase};
Expand All @@ -62,12 +64,7 @@
<@placeIndents quantity=indents/> m_${camelCase} = ${camelCase};
</#if>
<@placeIndents quantity=indents/> }
<#if memberShape.hasTrait("deprecated")>
<@placeIndents quantity=indents/> ${deprecationMessage}
</#if>
<#if memberTargetShape.hasTrait("documentation")>
<@placeIndents quantity=indents/> ${docMessage}
</#if>
<@placeIndents quantity=indents/> ${memberDocMessage}
<#if convertedShape.hasTrait("error") && PascalCase == "Message">
<@placeIndents quantity=indents/> Aws::Crt::Optional<${context.getTypeName(memberShape)}> Get${PascalCase}() noexcept override {
<#else>
Expand Down

0 comments on commit 586cdfb

Please sign in to comment.