yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
constants.h
Go to the documentation of this file.
1#ifndef YAZE_APP_CORE_CONSTANTS_H
2#define YAZE_APP_CORE_CONSTANTS_H
3
4#define TAB_ITEM(w) if (ImGui::BeginTabItem(w)) {
5#define END_TAB_ITEM() \
6 ImGui::EndTabItem(); \
7 }
8
9#define MENU_ITEM(w) if (ImGui::MenuItem(w))
10#define MENU_ITEM2(w, v) if (ImGui::MenuItem(w, v))
11
12#define BUTTON_COLUMN(w) \
13 ImGui::TableNextColumn(); \
14 ImGui::Button(w);
15
16#define TEXT_COLUMN(w) \
17 ImGui::TableNextColumn(); \
18 ImGui::Text(w);
19
20#define BEGIN_TABLE(l, n, f) if (ImGui::BeginTable(l, n, f, ImVec2(0, 0))) {
21#define SETUP_COLUMN(l) ImGui::TableSetupColumn(l);
22
23#define TABLE_HEADERS() \
24 ImGui::TableHeadersRow(); \
25 ImGui::TableNextRow();
26
27#define NEXT_COLUMN() ImGui::TableNextColumn();
28
29#define END_TABLE() \
30 ImGui::EndTable(); \
31 }
32
33#define HOVER_HINT(string) \
34 if (ImGui::IsItemHovered()) ImGui::SetTooltip(string);
35
36#define PRINT_IF_ERROR(expression) \
37 { \
38 auto error = expression; \
39 if (!error.ok()) { \
40 std::cout << error.ToString() << std::endl; \
41 } \
42 }
43
44#define EXIT_IF_ERROR(expression) \
45 { \
46 auto error = expression; \
47 if (!error.ok()) { \
48 std::cout << error.ToString() << std::endl; \
49 return EXIT_FAILURE; \
50 } \
51 }
52
53#define RETURN_VOID_IF_ERROR(expression) \
54 { \
55 auto error = expression; \
56 if (!error.ok()) { \
57 std::cout << error.ToString() << std::endl; \
58 return; \
59 } \
60 }
61
62#define RETURN_IF_ERROR(expression) \
63 { \
64 auto error = expression; \
65 if (!error.ok()) { \
66 return error; \
67 } \
68 }
69
70#define ASSIGN_OR_RETURN(type_variable_name, expression) \
71 ASSIGN_OR_RETURN_IMPL(APPEND_NUMBER(error_or_value, __LINE__), \
72 type_variable_name, expression)
73
74#define ASSIGN_OR_RETURN_IMPL(error_or_value, type_variable_name, expression) \
75 auto error_or_value = expression; \
76 if (!error_or_value.ok()) { \
77 return error_or_value.status(); \
78 } \
79 type_variable_name = std::move(*error_or_value);
80
81#define ASSIGN_OR_LOG_ERROR(type_variable_name, expression) \
82 ASSIGN_OR_LOG_ERROR_IMPL(APPEND_NUMBER(error_or_value, __LINE__), \
83 type_variable_name, expression)
84
85#define ASSIGN_OR_LOG_ERROR_IMPL(error_or_value, type_variable_name, \
86 expression) \
87 auto error_or_value = expression; \
88 if (!error_or_value.ok()) { \
89 std::cout << error_or_value.status().ToString() << std::endl; \
90 } \
91 type_variable_name = std::move(*error_or_value);
92
93#define APPEND_NUMBER(expression, number) \
94 APPEND_NUMBER_INNER(expression, number)
95
96#define APPEND_NUMBER_INNER(expression, number) expression##number
97
98#define TEXT_WITH_SEPARATOR(text) \
99 ImGui::Text(text); \
100 ImGui::Separator();
101
102#define TABLE_BORDERS_RESIZABLE \
103 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable
104
105#define CLEAR_AND_RETURN_STATUS(status) \
106 if (!status.ok()) { \
107 auto temp = status; \
108 status = absl::OkStatus(); \
109 return temp; \
110 }
111
112using ushort = unsigned short;
113using uint = unsigned int;
114using uchar = unsigned char;
115
116#endif
unsigned int uint
Definition constants.h:113
unsigned char uchar
Definition constants.h:114
unsigned short ushort
Definition constants.h:112