From d92629dfaa88abaabe38db791450ce704fdeca87 Mon Sep 17 00:00:00 2001 From: alandefreitas Date: Sun, 29 Dec 2024 03:59:22 -0300 Subject: [PATCH] Info Attribute lists #feat --- include/mrdocs/Metadata/Field.hpp | 3 +++ include/mrdocs/Metadata/Function.hpp | 3 +++ .../generator/common/partials/symbol/signature/field.hbs | 2 ++ .../generator/common/partials/symbol/signature/function.hbs | 2 ++ src/lib/Metadata/Info.cpp | 2 ++ 5 files changed, 12 insertions(+) diff --git a/include/mrdocs/Metadata/Field.hpp b/include/mrdocs/Metadata/Field.hpp index f67a0696f..c03c019fd 100644 --- a/include/mrdocs/Metadata/Field.hpp +++ b/include/mrdocs/Metadata/Field.hpp @@ -6,6 +6,7 @@ // // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) // Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) // // Official repository: https://github.com/cppalliance/mrdocs // @@ -58,6 +59,8 @@ struct FieldInfo bool HasNoUniqueAddress = false; + std::vector Attributes; + //-------------------------------------------- explicit FieldInfo(SymbolID ID) noexcept diff --git a/include/mrdocs/Metadata/Function.hpp b/include/mrdocs/Metadata/Function.hpp index 326fa3412..9638f03a9 100644 --- a/include/mrdocs/Metadata/Function.hpp +++ b/include/mrdocs/Metadata/Function.hpp @@ -6,6 +6,7 @@ // // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) // Copyright (c) 2023 Krystian Stasiowski (sdkrystian@gmail.com) +// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) // // Official repository: https://github.com/cppalliance/mrdocs // @@ -166,6 +167,8 @@ struct FunctionInfo StorageClassKind StorageClass = StorageClassKind::None; ReferenceKind RefQualifier = ReferenceKind::None; + std::vector Attributes; + //-------------------------------------------- explicit FunctionInfo(SymbolID ID) noexcept diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/field.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/field.hbs index 2eaa14db0..cd4c317b8 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/field.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature/field.hbs @@ -1,3 +1,5 @@ +{{#if attributes}}[{{join ", " attributes}}] +{{/if}} {{#if isMutable}}mutable {{/if~}} {{>type/declarator-prefix type}} {{>symbol/name symbol~}} diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs index 987e56293..a6e6631b8 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs @@ -2,6 +2,8 @@ {{/if~}} {{#if isFriend}}friend {{/if~}} +{{#if attributes}}{{#unless isFriend}}[{{join ", " attributes}}] +{{/unless}}{{/if~}} {{#if constexprKind}}{{constexprKind}} {{/if~}} {{#if storageClass}}{{storageClass}} diff --git a/src/lib/Metadata/Info.cpp b/src/lib/Metadata/Info.cpp index 515a183b8..75b15b7bc 100644 --- a/src/lib/Metadata/Info.cpp +++ b/src/lib/Metadata/Info.cpp @@ -179,6 +179,7 @@ tag_invoke( { io.map("requires", I.Requires.Written); } + io.map("attributes", dom::LazyArray(I.Attributes)); } if constexpr (T::isTypedef()) { @@ -222,6 +223,7 @@ tag_invoke( { io.map("bitfieldWidth", I.BitfieldWidth.Written); } + io.map("attributes", dom::LazyArray(I.Attributes)); } if constexpr (T::isSpecialization()) {}