opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
tab_registry.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <concepts>
8#include <cstddef>
9#include <memory>
10#include <optional>
11#include <string_view>
12
13namespace osc { class Widget; }
14
15namespace osc
16{
17 template<typename T>
19 std::derived_from<T, Tab> and
20 std::constructible_from<T, Widget*> and
21 requires (T) {
22 { T::id() } -> std::same_as<CStringView>;
23 };
24
25 // container for alphabetically-sorted tab entries
27 public:
30 using iterator = const TabRegistryEntry*;
32
34 TabRegistry(const TabRegistry&) = delete;
39
41
44 {
46 T::id(),
47 [](Widget* parent) { return std::make_unique<T>(parent); },
48 });
49 }
50
53 [[nodiscard]] bool empty() const { return size() <= 0; }
54 size_type size() const;
56 std::optional<TabRegistryEntry> find_by_name(std::string_view) const;
57
58 private:
59 class Impl;
60 std::unique_ptr<Impl> impl_;
61 };
62}
Definition tab_registry_entry.h:14
Definition tab_registry.h:26
std::optional< TabRegistryEntry > find_by_name(std::string_view) const
TabRegistryEntry operator[](size_type) const
bool empty() const
Definition tab_registry.h:53
size_t size_type
Definition tab_registry.h:29
size_type size() const
TabRegistry(const TabRegistry &)=delete
const_iterator end() const
TabRegistry(TabRegistry &&) noexcept
const_iterator begin() const
void register_tab()
Definition tab_registry.h:43
Definition widget.h:26
Definition tab_registry.h:18
Definition custom_decoration_generator.h:5
constexpr U to(T &&value)
Definition conversion.h:56
and
Definition algorithms.h:158