Skip to content

Commit

Permalink
hideo-about: Converted to modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Feb 19, 2025
1 parent 7d2904f commit 12cd98d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
6 changes: 5 additions & 1 deletion src/apps/hideo-about/app.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module;

#include <karm-base/witty.h>
#include <karm-image/loader.h>
#include <karm-kira/about-dialog.h>
Expand All @@ -11,9 +13,11 @@
#include <mdi/information.h>
#include <mdi/license.h>

export module Hideo.About;

namespace Hideo::About {

Ui::Child app() {
export Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::INFORMATION,
.title = "About"s,
Expand Down
9 changes: 0 additions & 9 deletions src/apps/hideo-about/app.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/apps/hideo-about/main/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <karm-sys/entry.h>
#include <karm-ui/app.h>

#include "../app.h"
import Hideo.About;

Async::Task<> entryPointAsync(Sys::Context& ctx) {
co_return Ui::runApp(ctx, Hideo::About::app());
Expand Down
25 changes: 17 additions & 8 deletions src/libs/karm-meta/pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,28 @@ namespace Karm::Meta {
template <typename T, typename... Ts>
concept Contains = (Same<T, Ts> or ...);

template <typename...>
inline constexpr usize _indexOf = 0;
template <typename T, typename... Ts>
struct _IndexOf;

template <typename T, typename First>
inline constexpr usize _indexOf<T, First> = 0;
template <typename T, Meta::Same<T> First>
struct _IndexOf<T, First> {
static constexpr usize value = 0;
};

template <typename T, typename First, typename... Rest>
inline constexpr usize _indexOf<T, First, Rest...> = Same<T, First> ? 0 : _indexOf<T, Rest...> + 1;
struct _IndexOf<T, First, Rest...> {
static constexpr usize value = [] {
if constexpr (Same<T, First>)
return 0;
else
return 1 + _IndexOf<T, Rest...>::value;
}();
};

template <typename T, typename... Ts>
requires Contains<T, Ts...>
static consteval usize indexOf() {
return _indexOf<T, Ts...>;
requires(Contains<T, Ts...>)
consteval usize indexOf() {
return _IndexOf<T, Ts...>::value;
}

template <typename...>
Expand Down

0 comments on commit 12cd98d

Please sign in to comment.