00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef NOTIFYCATEGORY_H
00016 #define NOTIFYCATEGORY_H
00017
00018 #include "dtoolbase.h"
00019
00020 #include "notifySeverity.h"
00021 #include "configVariableEnum.h"
00022 #include "configFlags.h"
00023 #include "memoryBase.h"
00024
00025 #include <vector>
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_DTOOLCONFIG NotifyCategory : public MemoryBase, public ConfigFlags {
00037 private:
00038 NotifyCategory(const string &fullname, const string &basename,
00039 NotifyCategory *parent);
00040
00041 PUBLISHED:
00042 INLINE string get_fullname() const;
00043 INLINE string get_basename() const;
00044 INLINE NotifySeverity get_severity() const;
00045 INLINE void set_severity(NotifySeverity severity);
00046
00047 INLINE bool is_on(NotifySeverity severity) const;
00048
00049
00050
00051
00052
00053
00054
00055 #if defined(NOTIFY_DEBUG) || defined(CPPPARSER)
00056 INLINE bool is_spam() const;
00057 INLINE bool is_debug() const;
00058 #else
00059 INLINE static bool is_spam();
00060 INLINE static bool is_debug();
00061 #endif
00062 INLINE bool is_info() const;
00063 INLINE bool is_warning() const;
00064 INLINE bool is_error() const;
00065 INLINE bool is_fatal() const;
00066
00067 ostream &out(NotifySeverity severity, bool prefix = true) const;
00068 INLINE ostream &spam(bool prefix = true) const;
00069 INLINE ostream &debug(bool prefix = true) const;
00070 INLINE ostream &info(bool prefix = true) const;
00071 INLINE ostream &warning(bool prefix = true) const;
00072 INLINE ostream &error(bool prefix = true) const;
00073 INLINE ostream &fatal(bool prefix = true) const;
00074
00075 int get_num_children() const;
00076 NotifyCategory *get_child(int i) const;
00077
00078 static void set_server_delta(long delta);
00079
00080 private:
00081 string get_config_name() const;
00082 void update_severity_cache();
00083 static bool get_notify_timestamp();
00084 static bool get_check_debug_notify_protect();
00085
00086 string _fullname;
00087 string _basename;
00088 NotifyCategory *_parent;
00089 ConfigVariableEnum<NotifySeverity> _severity;
00090 typedef vector<NotifyCategory *> Children;
00091 Children _children;
00092
00093 static long _server_delta;
00094
00095 AtomicAdjust::Integer _local_modified;
00096 NotifySeverity _severity_cache;
00097
00098 friend class Notify;
00099 };
00100
00101 INLINE ostream &operator << (ostream &out, const NotifyCategory &cat);
00102
00103 #include "notifyCategory.I"
00104
00105 #endif