Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
DebugDialogs.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <expected>
4#include <string>
5#include <string_view>
6
7struct SDL_Window;
8
9namespace monopoly::debugui
10{
11 inline constexpr int ErrorExitStatus = 20;
12
13 enum class Question
14 {
17 YesNo
18 };
19
21 {
22 std::string positiveText;
23 std::string negativeText;
26 friend bool operator==(
27 const QuestionPlan&, const QuestionPlan&) = default;
28 };
29
31 Question question, bool defaultPositive = true);
32
33 [[nodiscard]] std::expected<void, std::string> displayMessage(
34 std::string_view title,
35 std::string_view message,
36 SDL_Window* window = nullptr);
37
38 [[nodiscard]] std::expected<bool, std::string> retryMessage(
39 std::string_view title,
40 std::string_view message,
41 SDL_Window* window = nullptr);
42
43 [[nodiscard]] std::expected<bool, std::string> okCancelMessage(
44 std::string_view title,
45 std::string_view message,
46 SDL_Window* window = nullptr);
47
48 [[nodiscard]] std::expected<bool, std::string> yesNoMessage(
49 std::string_view title,
50 std::string_view message,
51 bool defaultYes,
52 SDL_Window* window = nullptr);
53
54 [[noreturn]] void errorExit(
55 std::string_view message,
56 SDL_Window* window = nullptr);
57}
unsigned index
void errorExit(std::string_view message, SDL_Window *window)
std::expected< bool, std::string > retryMessage(std::string_view title, std::string_view message, SDL_Window *window)
std::expected< bool, std::string > okCancelMessage(std::string_view title, std::string_view message, SDL_Window *window)
QuestionPlan questionPlan(Question question, bool defaultPositive)
constexpr int ErrorExitStatus
std::expected< void, std::string > displayMessage(std::string_view title, std::string_view message, SDL_Window *window)
std::expected< bool, std::string > yesNoMessage(std::string_view title, std::string_view message, bool defaultYes, SDL_Window *window)
friend bool operator==(const QuestionPlan &, const QuestionPlan &)=default