You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Remove implicit dependency on String from error_macros.h.
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include "error_macros.h"
|
#include "error_macros.h"
|
||||||
|
|
||||||
#include "core/io/logger.h"
|
#include "core/io/logger.h"
|
||||||
|
#include "core/ustring.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
|
|
||||||
bool _err_error_exists = false;
|
bool _err_error_exists = false;
|
||||||
@@ -42,6 +43,11 @@ void _err_set_last_error(const char *p_err) {
|
|||||||
OS::get_singleton()->set_last_error(p_err);
|
OS::get_singleton()->set_last_error(p_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _err_set_last_error(const String &p_err) {
|
||||||
|
|
||||||
|
_err_set_last_error(p_err.utf8().get_data());
|
||||||
|
}
|
||||||
|
|
||||||
void _err_clear_last_error() {
|
void _err_clear_last_error() {
|
||||||
|
|
||||||
OS::get_singleton()->clear_last_error();
|
OS::get_singleton()->clear_last_error();
|
||||||
@@ -99,6 +105,10 @@ void _err_print_error(const char *p_function, const char *p_file, int p_line, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, ErrorHandlerType p_type) {
|
||||||
|
_err_print_error(p_function, p_file, p_line, p_error.utf8().get_data(), p_type);
|
||||||
|
}
|
||||||
|
|
||||||
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, bool 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, bool fatal) {
|
||||||
|
|
||||||
String fstr(fatal ? "FATAL: " : "");
|
String fstr(fatal ? "FATAL: " : "");
|
||||||
|
|||||||
@@ -55,8 +55,10 @@ enum ErrorHandlerType {
|
|||||||
ERR_HANDLER_SHADER,
|
ERR_HANDLER_SHADER,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class String;
|
||||||
typedef void (*ErrorHandlerFunc)(void *, const char *, const char *, int p_line, const char *, const char *, ErrorHandlerType p_type);
|
typedef void (*ErrorHandlerFunc)(void *, const char *, const char *, int p_line, const char *, const char *, ErrorHandlerType p_type);
|
||||||
void _err_set_last_error(const char *p_err);
|
void _err_set_last_error(const char *p_err);
|
||||||
|
void _err_set_last_error(const String &p_err);
|
||||||
void _err_clear_last_error();
|
void _err_clear_last_error();
|
||||||
|
|
||||||
struct ErrorHandlerList {
|
struct ErrorHandlerList {
|
||||||
@@ -77,6 +79,7 @@ void add_error_handler(ErrorHandlerList *p_handler);
|
|||||||
void remove_error_handler(ErrorHandlerList *p_handler);
|
void remove_error_handler(ErrorHandlerList *p_handler);
|
||||||
|
|
||||||
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
|
void _err_print_error(const char *p_function, const char *p_file, int p_line, const char *p_error, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
|
||||||
|
void _err_print_error(const char *p_function, const char *p_file, int p_line, const String &p_error, ErrorHandlerType p_type = ERR_HANDLER_ERROR);
|
||||||
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, bool fatal = 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, bool fatal = false);
|
||||||
|
|
||||||
#ifndef _STR
|
#ifndef _STR
|
||||||
@@ -100,7 +103,7 @@ extern bool _err_error_exists;
|
|||||||
}
|
}
|
||||||
#define ERR_EXPLAIN(m_string) \
|
#define ERR_EXPLAIN(m_string) \
|
||||||
{ \
|
{ \
|
||||||
_err_set_last_error(String(m_string).utf8().get_data()); \
|
_err_set_last_error(m_string); \
|
||||||
_err_error_exists = true; \
|
_err_error_exists = true; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +435,7 @@ extern bool _err_error_exists;
|
|||||||
|
|
||||||
#define ERR_PRINTS(m_string) \
|
#define ERR_PRINTS(m_string) \
|
||||||
{ \
|
{ \
|
||||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, String(m_string).utf8().get_data()); \
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string); \
|
||||||
_err_error_exists = false; \
|
_err_error_exists = false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,7 +460,7 @@ extern bool _err_error_exists;
|
|||||||
|
|
||||||
#define WARN_PRINTS(m_string) \
|
#define WARN_PRINTS(m_string) \
|
||||||
{ \
|
{ \
|
||||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, String(m_string).utf8().get_data(), ERR_HANDLER_WARNING); \
|
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, m_string, ERR_HANDLER_WARNING); \
|
||||||
_err_error_exists = false; \
|
_err_error_exists = false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user