diff options
| -rw-r--r-- | libs/multiboot2/multiboot2/information.hpp | 63 | ||||
| -rw-r--r-- | libs/multiboot2/multiboot2/information/tag.hpp | 12 |
2 files changed, 30 insertions, 45 deletions
diff --git a/libs/multiboot2/multiboot2/information.hpp b/libs/multiboot2/multiboot2/information.hpp index 709d64a8..2611063b 100644 --- a/libs/multiboot2/multiboot2/information.hpp +++ b/libs/multiboot2/multiboot2/information.hpp @@ -22,47 +22,38 @@ namespace multiboot2 { - /** - * @copydoc multiboot2::data::basic_memory - */ + //! @copydoc multiboot2::data::basic_memory struct basic_memory : tag<data::basic_memory> { using tag::tag; }; - /** - * @copydoc multiboot2::data::bios_boot_device - */ + //! @copydoc multiboot2::data::bios_boot_device struct bios_boot_device : tag<data::bios_boot_device> { using tag::tag; }; - /** - * @copydoc multiboot2::data::command_line - */ + //! @copydoc multiboot2::data::command_line struct command_line : vla_tag<data::command_line, char, std::basic_string_view> { using vla_tag::vla_tag; - /** - * @brief The command line string - */ - [[nodiscard]] auto string() const noexcept -> range_type + //! Get the command line string + [[nodiscard]] auto string() const noexcept -> std::basic_string_view<char> { return {data(), size()}; } }; - /** - * @copydoc multiboot2::data::elf_symbols - */ + //! @copydoc multiboot2::data::elf_symbols template<elf::format Format> struct elf_symbols : vla_tag<data::elf_symbols, elf::section_header<Format> const, std::span> { using base = vla_tag<data::elf_symbols, elf::section_header<Format> const, std::span>; using base::base; + //! Get the name of the given section. [[nodiscard]] auto name(elf::section_header<Format> const & section) const noexcept -> std::string_view { if (!this->string_table_index) @@ -77,79 +68,73 @@ namespace multiboot2 } }; - /** - * @copydoc multiboot2::data::loader_name - */ + //! @copydoc multiboot2::data::loader_name struct loader_name : vla_tag<data::loader_name, char, std::basic_string_view> { using vla_tag::vla_tag; - /** - * @brief The name of the bootloader - */ + //! Get the name of the bootloader. [[nodiscard]] auto string() const noexcept -> std::string_view { return {data(), size()}; } }; - /** - * @copydoc multiboot2::data::memory_map - */ + //! @copydoc multiboot2::data::memory_map struct memory_map : vla_tag<data::memory_map, data::memory_map::region, std::span> { using vla_tag::vla_tag; - /** - * @brief The available memory regions - */ + //! The available memory regions [[nodiscard]] auto regions() const noexcept -> range_type { return {data(), size()}; } }; - /** - * @copydoc multiboot2::data::module - */ + //! @copydoc multiboot2::data::module struct module : vla_tag<data::module, char, std::basic_string_view> { using vla_tag::vla_tag; - /** - * @brief The module command line or name. - */ + //! Get the module command line or name. [[nodiscard]] auto string() const noexcept -> std::string_view { return {data(), vla_tag::size()}; } + //! Get the size of the module in bytes [[nodiscard]] constexpr auto size() const noexcept -> kstd::bytes { return kstd::bytes{end_address - start_address}; } }; + //! @copydoc multiboot2::data::acpi_rsdp struct acpi_rsdp : vla_tag<data::acpi_rsdp, std::byte, std::span> { using vla_tag::vla_tag; + //! The RSDP data. [[nodiscard]] auto pointer() const noexcept -> range_type { return {data(), size()}; } }; + //! @copydoc multiboot2::data::acpi_xsdp struct acpi_xsdp : vla_tag<data::acpi_xsdp, std::byte, std::span> { using vla_tag::vla_tag; + //! The XSDP data. [[nodiscard]] auto pointer() const noexcept -> range_type { return {data(), size()}; } }; + //! A view of the Multiboot 2 information structure. struct information_view { using iterator = iterator; @@ -162,7 +147,8 @@ namespace multiboot2 return kstd::bytes{m_size}; } - // Range access + //! @name Range access + //! @{ [[nodiscard]] auto begin() const noexcept -> iterator { @@ -174,7 +160,10 @@ namespace multiboot2 return iterator{}; } - // Tag access + //! @} + + //! @name Tag access + //! @{ template<typename Tag> [[nodiscard]] auto has() const noexcept -> bool @@ -286,6 +275,8 @@ namespace multiboot2 return maybe_acpi_xsdp().value(); } + //! @} + private: template<typename Tag> [[nodiscard]] constexpr auto get() const noexcept -> std::optional<Tag> diff --git a/libs/multiboot2/multiboot2/information/tag.hpp b/libs/multiboot2/multiboot2/information/tag.hpp index 2e907a72..ed999d0d 100644 --- a/libs/multiboot2/multiboot2/information/tag.hpp +++ b/libs/multiboot2/multiboot2/information/tag.hpp @@ -13,9 +13,7 @@ namespace multiboot2 { - /** - * @brief Header data and functionality shared by all tags. - */ + //! Header data and functionality shared by all tags. struct tag_header { tag_header() @@ -52,9 +50,7 @@ namespace multiboot2 std::uint32_t m_size; }; - /** - * @brief A tag containing no variable length array data. - */ + //! A tag containing no variable length array data. template<typename Data> struct tag : tag_header, Data { @@ -76,9 +72,7 @@ namespace multiboot2 {} }; - /** - * @brief A tag containing variable length array data. - */ + //! A tag containing variable length array data. template<typename Data, typename VlaData, template<typename> typename Range> struct vla_tag : tag<Data> { |
