00001 00005 /* Copyright, 2000, 2001 Nevrax Ltd. 00006 * 00007 * This file is part of NEVRAX NEL. 00008 * NEVRAX NEL is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2, or (at your option) 00011 * any later version. 00012 00013 * NEVRAX NEL is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * General Public License for more details. 00017 00018 * You should have received a copy of the GNU General Public License 00019 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00020 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00021 * MA 02111-1307, USA. 00022 */ 00023 00024 #ifndef NL_MEM_DISPLAYER_H 00025 #define NL_MEM_DISPLAYER_H 00026 00027 #include "types_nl.h" 00028 #include "displayer.h" 00029 00030 #include <deque> 00031 #include <string> 00032 00033 00034 namespace NLMISC { 00035 00036 00043 class CMemDisplayer : public IDisplayer 00044 { 00045 public: 00047 CMemDisplayer (const char *displayerName = ""); 00048 00050 void setParam (uint32 maxStrings = 50); 00051 00053 void write (CLog *log = NULL, bool quiet=true); 00054 void write (std::string &str, bool crLf=false); 00055 00056 const std::deque<std::string> &lockStrings () { _CanUseStrings = false; return _Strings; } 00057 00058 void unlockStrings() { _CanUseStrings = true; } 00059 00060 void clear () { if (_CanUseStrings) _Strings.clear (); } 00061 00062 protected: 00064 virtual void doDisplay ( const CLog::TDisplayInfo& args, const char *message ); 00065 00066 bool _NeedHeader; 00067 00068 uint32 _MaxStrings; // number of string in the _Strings queue (default is 50) 00069 00070 bool _CanUseStrings; 00071 00072 std::deque<std::string> _Strings; 00073 00074 }; 00075 00082 class CLightMemDisplayer : public CMemDisplayer 00083 { 00084 public: 00086 CLightMemDisplayer (const char *displayerName = "") : CMemDisplayer(displayerName) { } 00087 00088 protected: 00090 virtual void doDisplay ( const CLog::TDisplayInfo& args, const char *message ); 00091 }; 00092 00093 00094 00095 } // NLMISC 00096 00097 00098 #endif // NL_MEM_DISPLAYER_H 00099 00100 /* End of mem_displayer.h */
1.6.1