15 #ifndef NOTIFYCATEGORYPROXY_H
16 #define NOTIFYCATEGORYPROXY_H
18 #include "dtoolbase.h"
20 #include "notifyCategory.h"
21 #include "notifySeverity.h"
60 template<
class GetCategory>
82 INLINE
bool is_on(NotifySeverity severity);
84 #if defined(NOTIFY_DEBUG) || defined(CPPPARSER)
85 INLINE
bool is_spam();
86 INLINE
bool is_debug();
88 CONSTEXPR
static bool is_spam();
89 CONSTEXPR
static bool is_debug();
91 INLINE
bool is_info();
92 INLINE
bool is_warning();
93 INLINE
bool is_error();
94 INLINE
bool is_fatal();
96 INLINE ostream &out(NotifySeverity severity,
bool prefix =
true);
97 INLINE ostream &spam(
bool prefix =
true);
98 INLINE ostream &debug(
bool prefix =
true);
99 INLINE ostream &info(
bool prefix =
true);
100 INLINE ostream &warning(
bool prefix =
true);
101 INLINE ostream &error(
bool prefix =
true);
102 INLINE ostream &fatal(
bool prefix =
true);
115 template<
class GetCategory>
116 INLINE ostream &operator << (ostream &out, NotifyCategoryProxy<GetCategory> &proxy) {
117 return out << proxy->get_fullname();
128 #if defined(WIN32_VC) && !defined(CPPPARSER)
130 #define NotifyCategoryDecl(basename, expcl, exptp) \
131 class expcl NotifyCategoryGetCategory_ ## basename { \
133 NotifyCategoryGetCategory_ ## basename(); \
134 static NotifyCategory *get_category(); \
136 exptp template class expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename>; \
137 extern expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
141 #define NotifyCategoryDecl(basename, expcl, exptp) \
142 class NotifyCategoryGetCategory_ ## basename { \
144 NotifyCategoryGetCategory_ ## basename(); \
145 static NotifyCategory *get_category(); \
147 extern NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
154 #define NotifyCategoryDeclNoExport(basename) \
155 class NotifyCategoryGetCategory_ ## basename { \
157 NotifyCategoryGetCategory_ ## basename(); \
158 static NotifyCategory *get_category(); \
160 extern NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
169 #define NotifyCategoryDefName(basename, actual_name, parent_category)
170 #define NotifyCategoryDef(basename, parent_category)
173 #define NotifyCategoryDefName(basename, actual_name, parent_category) \
174 NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat; \
175 static NotifyCategoryGetCategory_ ## basename force_init_ ## basename ## _cat; \
176 NotifyCategoryGetCategory_ ## basename:: \
177 NotifyCategoryGetCategory_ ## basename() { \
178 basename ## _cat.init(); \
180 NotifyCategory *NotifyCategoryGetCategory_ ## basename:: \
182 return Notify::ptr()->get_category(string(actual_name), parent_category); \
184 #define NotifyCategoryDef(basename, parent_category) \
185 NotifyCategoryDefName(basename, #basename, parent_category);
190 #include "notifyCategoryProxy.I"
NotifyCategory & operator*()
This operator handles the case of dereferencing the proxy object as if it were a pointer, e.g.
NotifyCategory * get_unsafe_ptr()
Returns a pointer which is assumed to have been already initialized.
A handy wrapper around a NotifyCategory pointer.
A particular category of error messages.
NotifyCategory * operator->()
This magic operator function defines the syntax proxy->info(), etc., for all of the methods that are ...
NotifyCategory * get_safe_ptr()
Returns a pointer which is *not* assumed to have been already initialized; if necessary, it will be initialized before it returns.
NotifyCategory * init()
Initializes the proxy object by calling get_category() on the template class.