Claw 1.7.0
|
00001 /* 00002 CLAW - a C++ Library Absolutely Wonderful 00003 00004 CLAW is a free library without any particular aim but being useful to 00005 anyone. 00006 00007 Copyright (C) 2005-2011 Julien Jorge 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 contact: julien.jorge@gamned.org 00024 */ 00030 #ifndef __CLAW_LOG_STREAM_UNIQ_HPP__ 00031 #define __CLAW_LOG_STREAM_UNIQ_HPP__ 00032 00033 #include <string> 00034 #include <claw/log_stream.hpp> 00035 00036 #ifndef CLAW_LOGGER_EXPORT 00037 # ifdef CLAW_LOGGER_NO_EXPORT 00038 # define CLAW_LOGGER_EXPORT 00039 # else 00040 # ifdef _WIN32 00041 # ifdef claw_logger_EXPORTS 00042 # define CLAW_LOGGER_EXPORT __declspec(dllexport) 00043 # else 00044 # define CLAW_LOGGER_EXPORT __declspec(dllimport) 00045 # endif // def claw_logger_EXPORTS 00046 # else // def _WIN32 00047 # define CLAW_LOGGER_EXPORT 00048 # endif // def _WIN32 00049 # endif // def CLAW_LOGGER_NO_EXPORT 00050 #endif // ndef CLAW_LOGGER_EXPORT 00051 00052 namespace claw 00053 { 00058 class CLAW_LOGGER_EXPORT log_stream_uniq: 00059 public log_stream, 00060 public pattern::non_copyable 00061 { 00062 public: 00063 explicit log_stream_uniq( log_stream* s ); 00064 virtual ~log_stream_uniq(); 00065 00066 virtual void write( const std::string& str ); 00067 virtual void flush(); 00068 00069 private: 00070 void output_current_line(); 00071 00072 private: 00074 log_stream* m_stream; 00075 00077 std::string m_current_line; 00078 00080 std::string m_previous_line; 00081 00083 std::size_t m_repetition_count; 00084 00085 }; // class log_stream_uniq 00086 } // namespace claw 00087 00088 #endif // __CLAW_LOG_STREAM_UNIQ_HPP__