- Timestamp:
- 04/23/15 03:16:55 (10 years ago)
- Location:
- cpp/frams/mhandlers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/mhandlers/mhandlers.cpp
r372 r373 31 31 int MessageHandlerManager::add(MessageHandlerBase *h) 32 32 { 33 h->m gr = this;33 h->manager = this; 34 34 handlers += h; 35 35 return handlers.size() - 1; … … 39 39 { 40 40 MessageHandlerBase *h = handlers(i); 41 h->m gr = 0;41 h->manager = NULL; 42 42 handlers.remove(i); 43 43 } … … 61 61 { 62 62 if (!isEnabled()) return; 63 int level = m gr->find(this);64 if (level >= 0) m gr->send(level - 1, o, m, bl, w);63 int level = manager->find(this); 64 if (level >= 0) manager->send(level - 1, o, m, bl, w); 65 65 } 66 66 … … 110 110 if (w >= HMLV_ERROR) errcount++; 111 111 112 if (w >= storlevel)112 if (w >= minleveltostore) 113 113 { 114 stor count++;114 storedcount++; 115 115 if (options & (StoreFirstMessage | StoreAllMessages)) 116 116 { -
cpp/frams/mhandlers/mhandlers.h
r372 r373 39 39 friend class MessageHandlerManager; 40 40 protected: 41 MessageHandlerManager* m gr;41 MessageHandlerManager* manager; 42 42 int options; 43 43 … … 52 52 void send(const char *o, const char *m, const char *bl, int w); 53 53 54 bool isEnabled() { return m gr ? 1 : 0; }54 bool isEnabled() { return manager ? true : false; } 55 55 void enable(); 56 56 void disable(); … … 59 59 void resume(); 60 60 61 MessageHandlerBase(int opts = 0) :m gr(0), options(opts)61 MessageHandlerBase(int opts = 0) :manager(NULL), options(opts) 62 62 { 63 63 if (options&Enable) enable(); … … 76 76 { 77 77 protected: 78 int maxlevel, errcount, warncount, storlevel, storcount, infocount;78 int maxlevel, minleveltostore, errcount, warncount, storedcount, infocount; 79 79 SString msgs; 80 80 81 81 public: 82 82 83 void reset() { maxlevel = HMLV_INFO - 1; errcount = warncount = stor count = infocount = 0; msgs = 0; }83 void reset() { maxlevel = HMLV_INFO - 1; errcount = warncount = storedcount = infocount = 0; msgs = 0; } 84 84 85 85 enum Options2 … … 91 91 int getWarningCount() { return warncount; } 92 92 int getInfoCount() { return infocount; } 93 int getStoredCount() { return stor count; }93 int getStoredCount() { return storedcount; } 94 94 int getErrorLevel() { return maxlevel; } 95 95 const SString& getMessages() { return msgs; } 96 96 97 MessageHandlerToMemory(int opts = 0, int minimal_level_to_store = HMLV_ERROR) :MessageHandlerBase(opts), storlevel(minimal_level_to_store)97 MessageHandlerToMemory(int opts = 0, int minimal_level_to_store = HMLV_ERROR) :MessageHandlerBase(opts), minleveltostore(minimal_level_to_store) 98 98 { 99 99 reset(); … … 105 105 class RedirectingMessageHandler : public MessageHandlerBase 106 106 { 107 MessageHandlerManager *other_m gr;107 MessageHandlerManager *other_manager; 108 108 public: 109 RedirectingMessageHandler(MessageHandlerManager *o m,int opts=0)110 :MessageHandlerBase(opts), other_m gr(om) {}109 RedirectingMessageHandler(MessageHandlerManager *other_mgr,int opts=0) 110 :MessageHandlerBase(opts), other_manager(other_mgr) {} 111 111 112 112 void handle(const char *o, const char *m, const char *bl, int w) 113 113 { 114 other_m gr->send(o, m, bl, w);114 other_manager->send(o, m, bl, w); 115 115 } 116 116 };
Note: See TracChangeset
for help on using the changeset viewer.