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#include <string_view>
5
6#define TAB_BAR(w) if (ImGui::BeginTabBar(w)) {
7#define END_TAB_BAR() \
8 ImGui::EndTabBar(); \
9 }
10
11#define TAB_ITEM(w) if (ImGui::BeginTabItem(w)) {
12#define END_TAB_ITEM() \
13 ImGui::EndTabItem(); \
14 }
15
16#define MENU_ITEM(w) if (ImGui::MenuItem(w))
17#define MENU_ITEM2(w, v) if (ImGui::MenuItem(w, v))
18
19#define BUTTON_COLUMN(w) \
20 ImGui::TableNextColumn(); \
21 ImGui::Button(w);
22
23#define TEXT_COLUMN(w) \
24 ImGui::TableNextColumn(); \
25 ImGui::Text(w);
26
27#define BEGIN_TABLE(l, n, f) if (ImGui::BeginTable(l, n, f, ImVec2(0, 0))) {
28#define SETUP_COLUMN(l) ImGui::TableSetupColumn(l);
29
30#define TABLE_HEADERS() \
31 ImGui::TableHeadersRow(); \
32 ImGui::TableNextRow();
33
34#define NEXT_COLUMN() ImGui::TableNextColumn();
35
36#define END_TABLE() \
37 ImGui::EndTable(); \
38 }
39
40#define HOVER_HINT(string) \
41 if (ImGui::IsItemHovered()) ImGui::SetTooltip(string);
42
43#define PRINT_IF_ERROR(expression) \
44 { \
45 auto error = expression; \
46 if (!error.ok()) { \
47 std::cout << error.ToString() << std::endl; \
48 } \
49 }
50
51#define EXIT_IF_ERROR(expression) \
52 { \
53 auto error = expression; \
54 if (!error.ok()) { \
55 std::cout << error.ToString() << std::endl; \
56 return EXIT_FAILURE; \
57 } \
58 }
59
60#define RETURN_VOID_IF_ERROR(expression) \
61 { \
62 auto error = expression; \
63 if (!error.ok()) { \
64 std::cout << error.ToString() << std::endl; \
65 return; \
66 } \
67 }
68
69#define RETURN_IF_ERROR(expression) \
70 { \
71 auto error = expression; \
72 if (!error.ok()) { \
73 return error; \
74 } \
75 }
76
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)
80
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(); \
85 } \
86 type_variable_name = std::move(*error_or_value);
87
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)
91
92#define ASSIGN_OR_LOG_ERROR_IMPL(error_or_value, type_variable_name, \
93 expression) \
94 auto error_or_value = expression; \
95 if (!error_or_value.ok()) { \
96 std::cout << error_or_value.status().ToString() << std::endl; \
97 } \
98 type_variable_name = std::move(*error_or_value);
99
100#define APPEND_NUMBER(expression, number) \
101 APPEND_NUMBER_INNER(expression, number)
102
103#define APPEND_NUMBER_INNER(expression, number) expression##number
104
105#define TEXT_WITH_SEPARATOR(text) \
106 ImGui::Text(text); \
107 ImGui::Separator();
108
109#define TABLE_BORDERS_RESIZABLE \
110 ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable
111
112#define CLEAR_AND_RETURN_STATUS(status) \
113 if (!status.ok()) { \
114 auto temp = status; \
115 status = absl::OkStatus(); \
116 return temp; \
117 }
118
119using ushort = unsigned short;
120using uint = unsigned int;
121using uchar = unsigned char;
122
123namespace yaze {
124namespace app {
125namespace core {
126
127constexpr std::string_view kYazeVersion = "0.2.1";
128
129} // namespace core
130} // namespace app
131} // namespace yaze
132
133#endif
unsigned int uint
Definition constants.h:120
unsigned char uchar
Definition constants.h:121
unsigned short ushort
Definition constants.h:119
constexpr std::string_view kYazeVersion
Definition constants.h:127
Definition common.cc:21