1#ifndef YAZE_APP_CORE_CONSTANTS_H
2#define YAZE_APP_CORE_CONSTANTS_H
6#define TAB_BAR(w) if (ImGui::BeginTabBar(w)) {
11#define TAB_ITEM(w) if (ImGui::BeginTabItem(w)) {
12#define END_TAB_ITEM() \
13 ImGui::EndTabItem(); \
16#define MENU_ITEM(w) if (ImGui::MenuItem(w))
17#define MENU_ITEM2(w, v) if (ImGui::MenuItem(w, v))
19#define BUTTON_COLUMN(w) \
20 ImGui::TableNextColumn(); \
23#define TEXT_COLUMN(w) \
24 ImGui::TableNextColumn(); \
27#define BEGIN_TABLE(l, n, f) if (ImGui::BeginTable(l, n, f, ImVec2(0, 0))) {
28#define SETUP_COLUMN(l) ImGui::TableSetupColumn(l);
30#define TABLE_HEADERS() \
31 ImGui::TableHeadersRow(); \
32 ImGui::TableNextRow();
34#define NEXT_COLUMN() ImGui::TableNextColumn();
40#define HOVER_HINT(string) \
41 if (ImGui::IsItemHovered()) ImGui::SetTooltip(string);
43#define PRINT_IF_ERROR(expression) \
45 auto error = expression; \
47 std::cout << error.ToString() << std::endl; \
51#define EXIT_IF_ERROR(expression) \
53 auto error = expression; \
55 std::cout << error.ToString() << std::endl; \
56 return EXIT_FAILURE; \
60#define RETURN_VOID_IF_ERROR(expression) \
62 auto error = expression; \
64 std::cout << error.ToString() << std::endl; \
69#define RETURN_IF_ERROR(expression) \
71 auto error = expression; \
77#define ASSIGN_OR_RETURN(type_variable_name, expression) \
78 ASSIGN_OR_RETURN_IMPL(APPEND_NUMBER(error_or_value, __LINE__), \
79 type_variable_name, expression)
81#define ASSIGN_OR_RETURN_IMPL(error_or_value, type_variable_name, expression) \
82 auto error_or_value = expression; \
83 if (!error_or_value.ok()) { \
84 return error_or_value.status(); \
86 type_variable_name = std::move(*error_or_value);
88#define ASSIGN_OR_LOG_ERROR(type_variable_name, expression) \
89 ASSIGN_OR_LOG_ERROR_IMPL(APPEND_NUMBER(error_or_value, __LINE__), \
90 type_variable_name, expression)
92#define ASSIGN_OR_LOG_ERROR_IMPL(error_or_value, type_variable_name, \
94 auto error_or_value = expression; \
95 if (!error_or_value.ok()) { \
96 std::cout << error_or_value.status().ToString() << std::endl; \
98 type_variable_name = std::move(*error_or_value);
100#define APPEND_NUMBER(expression, number) \
101 APPEND_NUMBER_INNER(expression, number)
103#define APPEND_NUMBER_INNER(expression, number) expression##number
105#define TEXT_WITH_SEPARATOR(text) \
109#define TABLE_BORDERS_RESIZABLE \
110 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable
112#define CLEAR_AND_RETURN_STATUS(status) \
113 if (!status.ok()) { \
114 auto temp = status; \
115 status = absl::OkStatus(); \
constexpr std::string_view kYazeVersion