18 #include "dtoolbase.h" 19 #include "notifySeverity.h" 43 void set_ostream_ptr(ostream *ostream_ptr,
bool delete_later);
44 ostream *get_ostream_ptr()
const;
46 typedef bool AssertHandler(
const char *expression,
int line,
47 const char *source_file);
49 void set_assert_handler(AssertHandler *assert_handler);
50 void clear_assert_handler();
51 bool has_assert_handler()
const;
52 AssertHandler *get_assert_handler()
const;
54 INLINE
bool has_assert_failed()
const;
55 INLINE
const string &get_assert_error_message()
const;
56 INLINE
void clear_assert_failed();
62 const string &parent_fullname);
65 static ostream &out();
66 static ostream &null();
67 static void write_string(
const string &str);
71 static ios_fmtflags get_literal_flag();
73 bool assert_failure(
const string &expression,
int line,
74 const char *source_file);
75 bool assert_failure(
const char *expression,
int line,
76 const char *source_file);
78 static NotifySeverity string_severity(
const string &
string);
80 void config_initialized();
83 ostream *_ostream_ptr;
84 bool _owns_ostream_ptr;
85 ostream *_null_ostream_ptr;
87 AssertHandler *_assert_handler;
89 string _assert_error_message;
93 typedef map<string, NotifyCategory *> Categories;
94 Categories _categories;
96 static Notify *_global_ptr;
106 #define nout (Notify::out()) 136 #define nassertr(condition, return_value) 137 #define nassertv(condition) 138 #define nassertd(condition) if (false) 141 #define nassertr_always(condition, return_value) \ 143 if (!(condition)) { \ 144 return return_value; \ 148 #define nassertv_always(condition) \ 150 if (!(condition)) { \ 155 #define nassert_raise(message) Notify::write_string(message) 157 #define enter_debugger_if(condition) ((void)0) 161 #define nassertr(condition, return_value) \ 163 if (!(condition)) { \ 164 if (Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__)) { \ 165 return return_value; \ 170 #define nassertv(condition) \ 172 if (!(condition)) { \ 173 if (Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__)) { \ 179 #define nassertd(condition) \ 180 if (!(condition) && \ 181 Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__)) 183 #define nassertr_always(condition, return_value) nassertr(condition, return_value) 184 #define nassertv_always(condition) nassertv(condition) 186 #define nassert_raise(message) Notify::ptr()->assert_failure(message, __LINE__, __FILE__) 188 #define enter_debugger_if(condition) \ 190 Notify::ptr()->assert_failure(#condition, __LINE__, __FILE__); \ 197 #if __cplusplus >= 201103 198 #define __nassert_static(condition, line, file) static_assert((condition), #condition " at line " #line " of " file) 199 #define _nassert_static(condition, line, file) __nassert_static(condition, line, file) 200 #define nassert_static(condition) _nassert_static(condition, __LINE__, __FILE__) 202 #define __nassert_static(condition, suffix) typedef char nassert_static_ ## suffix [(condition) ? 1 : -1]; 203 #define _nassert_static(condition, suffix) __nassert_static(condition, suffix) 204 #define nassert_static(condition) _nassert_static(condition, __COUNTER__) A particular category of error messages.
An object that handles general error reporting to the user.