diff --git a/libluna/include/luna/Attributes.h b/libluna/include/luna/Attributes.h index 28d84975..7e51f100 100644 --- a/libluna/include/luna/Attributes.h +++ b/libluna/include/luna/Attributes.h @@ -1,3 +1,12 @@ +/** + * @file Attributes.h + * @author apio (cloudapio.eu) + * @brief Macro wrappers around GCC attributes. + * + * @copyright Copyright (c) 2022-2023, the Luna authors. + * + */ + #pragma once #define _weak __attribute__((weak)) diff --git a/libluna/include/luna/Badge.h b/libluna/include/luna/Badge.h index 50cb5cbc..f1137104 100644 --- a/libluna/include/luna/Badge.h +++ b/libluna/include/luna/Badge.h @@ -1,8 +1,33 @@ +/** + * @file Badge.h + * @author apio (cloudapio.eu) + * @brief A simple way to control who can call functions. + * + * @copyright Copyright (c) 2022-2023, the Luna authors. + * + */ + #pragma once +/** + * @brief A struct that can only be constructed by one type, used to control access to functions/methods. + * + * Example: There is a private method FooClass::foo() that you want to be callable by BarClass without making it a + * friend. + * + * So, make FooClass::foo() public and make it take a Badge which will only be constructible by BarClass, thus + * limiting the method even though it is public. + * + * @tparam T The type that can construct this badge. + */ template struct Badge { private: + /** + * @brief Construct a new Badge. + * + * This can only be done by the type T. + */ constexpr Badge() = default; Badge(const Badge&) = delete;