From 4311f06ade8e666b861eb0c73a5c2e62805ef68c Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 19 Jan 2012 20:50:42 +0000 Subject: [PATCH] added: to TextStream<> and Log: operator<<(const tm & tm_) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@797 e52654a7-88a9-db11-a3e9-0013d4bc506e --- core/log.cpp | 11 +++++++++++ core/log.h | 1 + core/textstream.h | 26 +++++++++++++++++++++++--- plugins/ticket/init.cpp | 2 ++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/core/log.cpp b/core/log.cpp index 3bf4ad3..868987f 100755 --- a/core/log.cpp +++ b/core/log.cpp @@ -255,6 +255,17 @@ return *this; } +Log & Log::operator<<(const tm & tm_) +{ + if( current_level <= log_level ) + { + buffer << tm_; + } + +return *this; + +} + Log & Log::operator<<(LogManipulators m) { diff --git a/core/log.h b/core/log.h index dd1923e..ecba197 100755 --- a/core/log.h +++ b/core/log.h @@ -46,6 +46,7 @@ public: Log & operator<<(const PT::Space * space); Log & operator<<(const PT::Space & space); Log & operator<<(LogManipulators m); + Log & operator<<(const tm & tm_); template diff --git a/core/textstream.h b/core/textstream.h index 096973e..34e79a3 100755 --- a/core/textstream.h +++ b/core/textstream.h @@ -11,6 +11,7 @@ #define headerfile_winix_core_textstream #include +#include #include "misc.h" #include "confparser/space.h" @@ -58,7 +59,7 @@ public: TextStream & operator<<(const void *);// printing a pointer TextStream & operator<<(const PT::Space * space); TextStream & operator<<(const PT::Space & space); - + TextStream & operator<<(const tm & tm_); TextStream & Write(const char * buf, size_t len); TextStream & Write(const wchar_t * buf, size_t len); @@ -309,10 +310,9 @@ TextStream & TextStream::write(const wchar_t * buf, size template TextStream & TextStream::operator<<(const PT::Space * space) { - // !! check me pls space->Serialize(*this, true, false); - return *this; +return *this; } @@ -323,6 +323,26 @@ TextStream & TextStream::operator<<(const PT::Space & sp } +template +TextStream & TextStream::operator<<(const tm & tm_) +{ +char buf[50]; + + sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d", + tm_.tm_year + 1900, + tm_.tm_mon + 1, + tm_.tm_mday, + tm_.tm_hour, + tm_.tm_min, + tm_.tm_sec); + + for(size_t i=0 ; buf[i] ; ++i) + buffer += buf[i]; + +return *this; +} + + #endif diff --git a/plugins/ticket/init.cpp b/plugins/ticket/init.cpp index ed02c25..59adf2d 100755 --- a/plugins/ticket/init.cpp +++ b/plugins/ticket/init.cpp @@ -49,6 +49,8 @@ void SelectDefaultFunction(PluginInfo & info) { if( info.system->mounts.pmount->type == ticket_info.mount_type_ticket ) { + // !! moze dac fun_ticket tylko dla itemow ktore nie sa plikami statycznymi... + if( info.cur->request->is_item ) info.cur->request->function = &fun_ticket; else