00001 #include "TextMsgEvent.h"
00002 #include <sstream>
00003
00004 std::string
00005 TextMsgEvent::getDescription(bool showTypeSpecific, unsigned int verbosity) const {
00006 if(!showTypeSpecific)
00007 return EventBase::getDescription(showTypeSpecific,verbosity);
00008 std::ostringstream logdata;
00009 logdata << EventBase::getDescription(showTypeSpecific,verbosity) << '\t' << _text;
00010 return logdata.str();
00011 }
00012
00013 unsigned int
00014 TextMsgEvent::getBinSize() const {
00015 unsigned int used=EventBase::getBinSize();
00016 used+=creatorSize("EventBase::TextMsgEvent");
00017 used+=_text.size()+stringpad;
00018
00019 return used;
00020 }
00021
00022 unsigned int
00023 TextMsgEvent::LoadBuffer(const char buf[], unsigned int len) {
00024 unsigned int origlen=len;
00025 unsigned int used;
00026 if(0==(used=EventBase::LoadBuffer(buf,len))) return 0;
00027 len-=used; buf+=used;
00028 if(0==(used=checkCreator("EventBase::TextMsgEvent",buf,len,true))) return 0;
00029 len-=used; buf+=used;
00030 if(0==(used=decode(_text,buf,len))) return 0;
00031 len-=used; buf+=used;
00032
00033
00034 return origlen-len;
00035 }
00036
00037 unsigned int
00038 TextMsgEvent::SaveBuffer(char buf[], unsigned int len) const {
00039 unsigned int origlen=len;
00040 unsigned int used;
00041 if(0==(used=EventBase::SaveBuffer(buf,len))) return 0;
00042 len-=used; buf+=used;
00043 if(0==(used=saveCreator("EventBase::TextMsgEvent",buf,len))) return 0;
00044 len-=used; buf+=used;
00045 if(0==(used=encode(_text,buf,len))) return 0;
00046 len-=used; buf+=used;
00047
00048
00049 return origlen-len;
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061