Merge pull request #1011 from mihe/error-macros
Update error macros to match core
This commit is contained in:
@@ -31,61 +31,56 @@
|
||||
#include <godot_cpp/core/error_macros.hpp>
|
||||
|
||||
#include <godot_cpp/godot.hpp>
|
||||
#include <godot_cpp/variant/string.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
|
||||
namespace godot {
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, bool p_is_warning) {
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, bool p_editor_notify, bool p_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gde_interface->print_warning(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_warning(p_error, p_function, p_file, p_line, p_editor_notify);
|
||||
} else {
|
||||
internal::gde_interface->print_error(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_error(p_error, p_function, p_file, p_line, p_editor_notify);
|
||||
}
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const char *p_message, bool p_is_warning) {
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, bool p_editor_notify, bool p_is_warning) {
|
||||
_err_print_error(p_function, p_file, p_line, p_error.utf8().get_data(), p_editor_notify, p_is_warning);
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_message, bool p_editor_notify, bool p_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gde_interface->print_warning(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_warning_with_message(p_error, p_message, p_function, p_file, p_line, p_editor_notify);
|
||||
} else {
|
||||
internal::gde_interface->print_error(p_message, p_function, p_file, p_line);
|
||||
internal::gde_interface->print_error_with_message(p_error, p_message, p_function, p_file, p_line, p_editor_notify);
|
||||
}
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const String &p_message, bool p_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gde_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
} else {
|
||||
internal::gde_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
}
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const char *p_message, bool p_editor_notify, bool p_is_warning) {
|
||||
_err_print_error(p_function, p_file, p_line, p_error.utf8().get_data(), p_message, p_editor_notify, p_is_warning);
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_is_warning) {
|
||||
if (p_is_warning) {
|
||||
internal::gde_interface->print_warning(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
} else {
|
||||
internal::gde_interface->print_error(p_message.utf8().get_data(), p_function, p_file, p_line);
|
||||
}
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, const String &p_message, bool p_editor_notify, bool p_is_warning) {
|
||||
_err_print_error(p_function, p_file, p_line, p_error, p_message.utf8().get_data(), p_editor_notify, p_is_warning);
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, bool p_is_warning) {
|
||||
_err_print_error(p_function, p_file, p_line, "", p_error, p_is_warning);
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, const String &p_message, bool p_editor_notify, bool p_is_warning) {
|
||||
_err_print_error(p_function, p_file, p_line, p_error.utf8().get_data(), p_message.utf8().get_data(), p_editor_notify, p_is_warning);
|
||||
}
|
||||
|
||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, bool p_is_warning) {
|
||||
_err_print_error(p_function, p_file, p_line, "", p_error, p_is_warning);
|
||||
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message, bool p_editor_notify, bool p_fatal) {
|
||||
String fstr(p_fatal ? "FATAL: " : "");
|
||||
String err(fstr + "Index " + p_index_str + " = " + itos(p_index) + " is out of bounds (" + p_size_str + " = " + itos(p_size) + ").");
|
||||
_err_print_error(p_function, p_file, p_line, err.utf8().get_data(), p_message, p_editor_notify, false);
|
||||
}
|
||||
|
||||
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const char *p_message, bool fatal) {
|
||||
std::string fstr(fatal ? "FATAL: " : "");
|
||||
std::string err(fstr + "Index " + p_index_str + " = " + std::to_string(p_index) + " is out of bounds (" + p_size_str + " = " + std::to_string(p_size) + ").");
|
||||
_err_print_error(p_function, p_file, p_line, err.c_str(), p_message);
|
||||
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool p_editor_notify, bool p_fatal) {
|
||||
_err_print_index_error(p_function, p_file, p_line, p_index, p_size, p_index_str, p_size_str, p_message.utf8().get_data(), p_editor_notify, p_fatal);
|
||||
}
|
||||
|
||||
void _err_print_index_error(const char *p_function, const char *p_file, int p_line, int64_t p_index, int64_t p_size, const char *p_index_str, const char *p_size_str, const String &p_message, bool fatal) {
|
||||
std::string fstr(fatal ? "FATAL: " : "");
|
||||
std::string err(fstr + "Index " + p_index_str + " = " + std::to_string(p_index) + " is out of bounds (" + p_size_str + " = " + std::to_string(p_size) + ").");
|
||||
_err_print_error(p_function, p_file, p_line, err.c_str(), p_message);
|
||||
void _err_flush_stdout() {
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
} // namespace godot
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <godot_cpp/variant/transform2d.hpp>
|
||||
|
||||
#include <godot_cpp/variant/string.hpp>
|
||||
|
||||
namespace godot {
|
||||
|
||||
void Transform2D::invert() {
|
||||
|
||||
Reference in New Issue
Block a user