From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03727.html | 1517 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1517 insertions(+) create mode 100644 docs/doxygen/nel/a03727.html (limited to 'docs/doxygen/nel/a03727.html') diff --git a/docs/doxygen/nel/a03727.html b/docs/doxygen/nel/a03727.html new file mode 100644 index 00000000..8281902b --- /dev/null +++ b/docs/doxygen/nel/a03727.html @@ -0,0 +1,1517 @@ + + +NeL: NLMISC::CWindowDisplayer class Reference + + + +
+

NLMISC::CWindowDisplayer Class Reference

#include <window_displayer.h> +

+

Inheritance diagram for NLMISC::CWindowDisplayer: +

+ +NLMISC::IDisplayer + +

Detailed Description

+this displayer displays on a win32 windows. MT = Main Thread, DT = Display Thread
Author:
Vianney Lecroart

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 48 of file window_displayer.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void create (std::string titleBar="", bool iconified=false, sint x=-1, sint y=-1, sint w=-1, sint h=-1, sint hs=-1, sint fs=0, const std::string &fn="", bool ww=false, CLog *log=InfoLog)
uint createLabel (const char *value="?")
 CWindowDisplayer (const char *displayerName="")
void display (const CLog::TDisplayInfo &args, const char *message)
 Display the string where it does.

virtual void getWindowPos (uint32 &x, uint32 &y, uint32 &w, uint32 &h)
void setLabel (uint label, const std::string &value)
virtual void setTitleBar (const std::string &titleBar)
bool update ()
virtual ~CWindowDisplayer ()

Static Public Member Functions

const char * dateToComputerString (time_t date)
 Convert date to "784551148" string (time in second from 1975).

const char * dateToHumanString (time_t date)
 Convert date to "2000/01/14 10:05:17" string.

const char * dateToHumanString ()
 Convert the current date to human string.

const char * logTypeToString (CLog::TLogType logType, bool longFormat=false)
 Convert log type to string.


Data Fields

std::string DisplayerName
 This is the idenfiant for a displayer, it is used to fond or remove a displayer.


Protected Member Functions

virtual void display_main ()=0
virtual void doDisplay (const CLog::TDisplayInfo &args, const char *message)=0
 Method to implement in the deriver.

virtual void doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message)
virtual void open (std::string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)=0

Static Protected Member Functions

const char * HeaderString ()

Protected Attributes

CSynchronized< std::list<
+ std::pair< uint32, std::string > > > 
_Buffer
CSynchronized< std::vector<
+ std::string > > 
_CommandsToExecute
bool _Continue
std::vector< std::string > _History
sint _HistorySize
bool _Init
sint _InputEditHeight
CSynchronized< std::vector<
+ CLabelEntry > > 
_Labels
uint _PosInHistory
NLMISC::IThread_Thread
sint _ToolBarHeight
CLogLog
bool needSlashR

Friends

class CUpdateThread
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + +
NLMISC::CWindowDisplayer::CWindowDisplayer const char *  displayerName = ""  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 52 of file window_displayer.h. +

+References _CommandsToExecute, _Continue, _HistorySize, _InputEditHeight, _Labels, _PosInHistory, and _ToolBarHeight. +

+

00052                                                           :
+00053           IDisplayer(displayerName), 
+00054                 _Buffer("CWindowDisplayer::_Buffer"), _Labels("CWindowDisplayer::_Labels"), _CommandsToExecute("CWindowDisplayer::_CommandsToExecute"),
+00055                 _Continue(true), _PosInHistory(0), _Init(false), _HistorySize(0), _ToolBarHeight(22), _InputEditHeight(25), _Thread(0), Log(0)
+00056           { }
+
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CWindowDisplayer::~CWindowDisplayer  )  [virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 68 of file window_displayer.cpp. +

+References _Continue, nlassert, and NLMISC::IThread::wait(). +

+

00069 {
+00070         // we have to wait the exit of the thread
+00071         _Continue = false;
+00072         nlassert (_Thread != NULL);
+00073         _Thread->wait();
+00074         delete _Thread;
+00075 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLMISC::CWindowDisplayer::create std::string  titleBar = "",
bool  iconified = false,
sint  x = -1,
sint  y = -1,
sint  w = -1,
sint  h = -1,
sint  hs = -1,
sint  fs = 0,
const std::string &  fn = "",
bool  ww = false,
CLog log = InfoLog
+
+ + + + + +
+   + + +

+ +

+Definition at line 120 of file window_displayer.cpp. +

+References CUpdateThread, nlassert, sint, NLMISC::IThread::start(), w, x, and y. +

+Referenced by NLNET::IService::main(). +

+

00121 {
+00122         nlassert (_Thread == NULL);
+00123         _Thread = IThread::create (new CUpdateThread(this, windowNameEx, iconified, x, y, w, h, hs, fs, fn, ww, log));
+00124 
+00125         Log = log;
+00126 
+00127         _Thread->start ();
+00128 }
+
+

+ + + + +
+ + + + + + + + + + +
uint NLMISC::CWindowDisplayer::createLabel const char *  value = "?"  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 96 of file window_displayer.cpp. +

+References _Labels, uint, and value. +

+Referenced by NLNET::IService::main(). +

+

00097 {
+00098         int pos;
+00099         {
+00100                 CSynchronized<std::vector<CLabelEntry> >::CAccessor access (&_Labels);
+00101                 access.value().push_back (CLabelEntry(value));
+00102                 pos = access.value().size()-1;
+00103         }
+00104         return pos;
+00105 }
+
+

+ + + + +
+ + + + + + + + + + +
const char * NLMISC::IDisplayer::dateToComputerString time_t  date  )  [static, inherited]
+
+ + + + + +
+   + + +

+Convert date to "784551148" string (time in second from 1975). +

+ +

+Definition at line 103 of file displayer.cpp. +

+References NLMISC::smprintf(). +

+

00104 {
+00105         static char cstime[25];
+00106         smprintf (cstime, 25, "%ld", &date);
+00107         return cstime;
+00108 }
+
+

+ + + + +
+ + + + + + + + + + +
const char * NLMISC::IDisplayer::dateToHumanString time_t  date  )  [static, inherited]
+
+ + + + + +
+   + + +

+Convert date to "2000/01/14 10:05:17" string. +

+ +

+Definition at line 92 of file displayer.cpp. +

+References uint32. +

+

00093 {
+00094         static char cstime[25];
+00095         struct tm *tms = localtime(&date);
+00096         if (tms)
+00097                 strftime (cstime, 25, "%Y/%m/%d %H:%M:%S", tms);
+00098         else
+00099                 sprintf(cstime, "bad date %d", (uint32)date);
+00100         return cstime;
+00101 }
+
+

+ + + + +
+ + + + + + + + + +
const char * NLMISC::IDisplayer::dateToHumanString  )  [static, inherited]
+
+ + + + + +
+   + + +

+Convert the current date to human string. +

+ +

+Definition at line 85 of file displayer.cpp. +

+Referenced by NLNET::CNetDisplayer::doDisplay(), NLMISC::CMemDisplayer::doDisplay(), NLMISC::CMsgBoxDisplayer::doDisplay(), NLMISC::CFileDisplayer::doDisplay(), and NLMISC::IDisplayer::HeaderString(). +

+

00086 {
+00087         time_t date;
+00088         time (&date);
+00089         return dateToHumanString (date);
+00090 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::IDisplayer::display const CLog::TDisplayInfo args,
const char *  message
[inherited]
+
+ + + + + +
+   + + +

+Display the string where it does. +

+ +

+Definition at line 132 of file displayer.cpp. +

+References NLMISC::IDisplayer::doDisplay(). +

+

00133 {
+00134         _Mutex->enter();
+00135         try
+00136         {
+00137                 doDisplay( args, message );
+00138         }
+00139         catch (Exception &)
+00140         {
+00141                 // silence
+00142         }
+00143         _Mutex->leave();
+00144 }
+
+

+ + + + +
+ + + + + + + + + +
virtual void NLMISC::CWindowDisplayer::display_main  )  [protected, pure virtual]
+
+ + + + + +
+   + + +

+ +

+Referenced by NLMISC::CUpdateThread::run().

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
virtual void NLMISC::IDisplayer::doDisplay const CLog::TDisplayInfo args,
const char *  message
[protected, pure virtual, inherited]
+
+ + + + + +
+   + + +

+Method to implement in the deriver. +

+ +

+Implemented in NLMISC::CStdDisplayer, NLMISC::CFileDisplayer, NLMISC::CMsgBoxDisplayer, NLMISC::CMemDisplayer, and NLMISC::CLightMemDisplayer. +

+Referenced by NLMISC::IDisplayer::display().

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CWindowDisplayer::doDisplay const NLMISC::CLog::TDisplayInfo args,
const char *  message
[protected, virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 130 of file window_displayer.cpp. +

+References _HistorySize, NLMISC::CLog::TDisplayInfo::CallstackAndLog, NLMISC::CLog::TDisplayInfo::Filename, NLMISC::CLog::TDisplayInfo::Line, NLMISC::CLog::TDisplayInfo::LogType, NLMISC::IDisplayer::logTypeToString(), needSlashR, NLMISC::CLog::TDisplayInfo::ThreadId, NLMISC::toString(), uint, and uint32. +

+

00131 {
+00132         bool needSpace = false;
+00133         //stringstream ss;
+00134         string str;
+00135 
+00136         uint32 color = 0xFF000000;
+00137 
+00138         if (args.LogType != CLog::LOG_NO)
+00139         {
+00140                 str += logTypeToString(args.LogType);
+00141                 if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) color = 0x00FF0000;
+00142                 else if (args.LogType == CLog::LOG_WARNING) color = 0x00800000;
+00143                 else if (args.LogType == CLog::LOG_DEBUG) color = 0x00808080;
+00144                 else color = 0;
+00145                 needSpace = true;
+00146         }
+00147 
+00148         // Write thread identifier
+00149         if ( args.ThreadId != 0 )
+00150         {
+00151                 if (needSpace) { str += " "; needSpace = false; }
+00152                 str += NLMISC::toString("%4u", args.ThreadId);
+00153                 needSpace = true;
+00154         }
+00155 
+00156         if (args.Filename != NULL)
+00157         {
+00158                 if (needSpace) { str += " "; needSpace = false; }
+00159                 str += NLMISC::toString("%20s", CFile::getFilename(args.Filename).c_str());
+00160                 needSpace = true;
+00161         }
+00162 
+00163         if (args.Line != -1)
+00164         {
+00165                 if (needSpace) { str += " "; needSpace = false; }
+00166                 str += NLMISC::toString("%4u", args.Line);
+00167                 //ss << setw(4) << args.Line;
+00168                 needSpace = true;
+00169         }
+00170 
+00171         if (needSpace) { str += ": "; needSpace = false; }
+00172 
+00173         uint nbl = 1;
+00174 
+00175         char *npos, *pos = const_cast<char *>(message);
+00176         while ((npos = strchr (pos, '\n')))
+00177         {
+00178                 *npos = '\0';
+00179                 str += pos;
+00180                 if (needSlashR)
+00181                         str += "\r";
+00182                 str += "\n";
+00183                 *npos = '\n';
+00184                 pos = npos+1;
+00185                 nbl++;
+00186         }
+00187         str += pos;
+00188 
+00189         pos = const_cast<char *>(args.CallstackAndLog.c_str());
+00190         while ((npos = strchr (pos, '\n')))
+00191         {
+00192                 *npos = '\0';
+00193                 str += pos;
+00194                 if (needSlashR)
+00195                         str += "\r";
+00196                 str += "\n";
+00197                 *npos = '\n';
+00198                 pos = npos+1;
+00199                 nbl++;
+00200         }
+00201         str += pos;
+00202 
+00203         {
+00204                 CSynchronized<std::list<std::pair<uint32, std::string> > >::CAccessor access (&_Buffer);
+00205                 if (_HistorySize > 0 && access.value().size() >= (uint)_HistorySize)
+00206                 {
+00207                         access.value().erase (access.value().begin());
+00208                 }
+00209                 access.value().push_back (make_pair (color, str));
+00210         }
+00211 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
virtual void NLMISC::CWindowDisplayer::getWindowPos uint32 x,
uint32 y,
uint32 w,
uint32 h
[inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 75 of file window_displayer.h. +

+References uint32, w, x, and y. +

+

00075 { x=y=w=h=0; }
+
+

+ + + + +
+ + + + + + + + + +
const char * NLMISC::IDisplayer::HeaderString  )  [static, protected, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 110 of file displayer.cpp. +

+References NLMISC::IDisplayer::dateToHumanString(), and NLMISC::smprintf(). +

+Referenced by NLMISC::CMemDisplayer::doDisplay(), and NLMISC::CFileDisplayer::doDisplay(). +

+

00111 {
+00112         static char header[1024];
+00113         smprintf(header, 1024, "\nLog Starting [%s]\n", dateToHumanString());
+00114         return header;
+00115 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
const char * NLMISC::IDisplayer::logTypeToString CLog::TLogType  logType,
bool  longFormat = false
[static, inherited]
+
+ + + + + +
+   + + +

+Convert log type to string. +

+ +

+Definition at line 77 of file displayer.cpp. +

+References NLMISC::LogTypeToString. +

+Referenced by doDisplay(), NLNET::CNetDisplayer::doDisplay(), NLMISC::CMemDisplayer::doDisplay(), NLMISC::CMsgBoxDisplayer::doDisplay(), NLMISC::CFileDisplayer::doDisplay(), and NLMISC::CStdDisplayer::doDisplay(). +

+

00078 {
+00079         if (logType < CLog::LOG_NO || logType > CLog::LOG_UNKNOWN)
+00080                 return "<NotDefined>";
+00081 
+00082         return LogTypeToString[longFormat?1:0][logType];
+00083 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
virtual void NLMISC::CWindowDisplayer::open std::string  titleBar,
bool  iconified,
sint  x,
sint  y,
sint  w,
sint  h,
sint  hs,
sint  fs,
const std::string &  fn,
bool  ww,
CLog log
[protected, pure virtual]
+
+ + + + + +
+   + + +

+ +

+Referenced by NLMISC::CUpdateThread::run().

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CWindowDisplayer::setLabel uint  label,
const std::string &  value
+
+ + + + + +
+   + + +

+ +

+Definition at line 107 of file window_displayer.cpp. +

+References _Labels, nlassert, uint, and value. +

+Referenced by NLNET::IService::main(). +

+

00108 {
+00109         {
+00110                 CSynchronized<std::vector<CLabelEntry> >::CAccessor access (&_Labels);
+00111                 nlassert (label < access.value().size());
+00112                 if (access.value()[label].Value != value)
+00113                 {
+00114                         access.value()[label].Value = value;
+00115                         access.value()[label].NeedUpdate = true;
+00116                 }
+00117         }
+00118 }
+
+

+ + + + +
+ + + + + + + + + + +
virtual void NLMISC::CWindowDisplayer::setTitleBar const std::string &  titleBar  )  [inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 73 of file window_displayer.h. +

+Referenced by NLNET::IService::main(). +

+

00073 { }
+
+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CWindowDisplayer::update  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 77 of file window_displayer.cpp. +

+References _CommandsToExecute, _Continue, nlassert, and uint. +

+Referenced by NLNET::IService::main(). +

+

00078 {
+00079         vector<string> copy;
+00080         {
+00081                 CSynchronized<std::vector<std::string> >::CAccessor access (&_CommandsToExecute);
+00082                 copy = access.value();
+00083                 access.value().clear ();
+00084         }
+00085 
+00086         // execute all commands in the main thread
+00087         for (uint i = 0; i < copy.size(); i++)
+00088         {
+00089                 nlassert (Log != NULL);
+00090                 ICommand::execute (copy[i], *Log);
+00091         }
+00092 
+00093         return _Continue;
+00094 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CUpdateThread [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 120 of file window_displayer.h. +

+Referenced by create().

+


Field Documentation

+

+ + + + +
+ + +
CSynchronized<std::list<std::pair<uint32, std::string> > > NLMISC::CWindowDisplayer::_Buffer [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 95 of file window_displayer.h.

+

+ + + + +
+ + +
CSynchronized<std::vector<std::string> > NLMISC::CWindowDisplayer::_CommandsToExecute [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 97 of file window_displayer.h. +

+Referenced by CWindowDisplayer(), and update().

+

+ + + + +
+ + +
bool NLMISC::CWindowDisplayer::_Continue [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 106 of file window_displayer.h. +

+Referenced by CWindowDisplayer(), update(), and ~CWindowDisplayer().

+

+ + + + +
+ + +
std::vector<std::string> NLMISC::CWindowDisplayer::_History [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 108 of file window_displayer.h.

+

+ + + + +
+ + +
sint NLMISC::CWindowDisplayer::_HistorySize [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 111 of file window_displayer.h. +

+Referenced by CWindowDisplayer(), and doDisplay().

+

+ + + + +
+ + +
bool NLMISC::CWindowDisplayer::_Init [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 110 of file window_displayer.h.

+

+ + + + +
+ + +
sint NLMISC::CWindowDisplayer::_InputEditHeight [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 113 of file window_displayer.h. +

+Referenced by CWindowDisplayer().

+

+ + + + +
+ + +
CSynchronized<std::vector<CLabelEntry> > NLMISC::CWindowDisplayer::_Labels [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 96 of file window_displayer.h. +

+Referenced by createLabel(), CWindowDisplayer(), and setLabel().

+

+ + + + +
+ + +
uint NLMISC::CWindowDisplayer::_PosInHistory [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 109 of file window_displayer.h. +

+Referenced by CWindowDisplayer().

+

+ + + + +
+ + +
NLMISC::IThread* NLMISC::CWindowDisplayer::_Thread [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 116 of file window_displayer.h.

+

+ + + + +
+ + +
sint NLMISC::CWindowDisplayer::_ToolBarHeight [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 112 of file window_displayer.h. +

+Referenced by CWindowDisplayer().

+

+ + + + +
+ + +
std::string NLMISC::IDisplayer::DisplayerName [inherited] +
+
+ + + + + +
+   + + +

+This is the idenfiant for a displayer, it is used to fond or remove a displayer. +

+ +

+Definition at line 63 of file displayer.h. +

+Referenced by NLMISC::IDisplayer::IDisplayer().

+

+ + + + +
+ + +
CLog* NLMISC::CWindowDisplayer::Log [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 118 of file window_displayer.h.

+

+ + + + +
+ + +
bool NLMISC::CWindowDisplayer::needSlashR [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 83 of file window_displayer.h. +

+Referenced by doDisplay().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 13:43:19 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1