1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NLMISC::CStdDisplayer class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"> <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NLMISC::CStdDisplayer Class Reference</h1><code>#include <<a class="el" href="a05638.html">displayer.h</a>></code>
<p>
<p>Inheritance diagram for NLMISC::CStdDisplayer:
<p><center><img src="a03443.png" usemap="#NLMISC::CStdDisplayer_map" border="0" alt=""></center>
<map name="NLMISC::CStdDisplayer_map">
<area href="a02526.html" alt="NLMISC::IDisplayer" shape="rect" coords="0,0,146,24">
</map>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Std displayer. Put string to stdout. log_howto <dl compact><dt><b>Author:</b></dt><dd>Vianney Lecroart <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl>
<p>
<p>
Definition at line <a class="el" href="a05638.html#l00102">102</a> of file <a class="el" href="a05638.html">displayer.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03443.html#NLMISC_1_1CStdDisplayera0">CStdDisplayer</a> (const char *displayerName="")</td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02526.html#NLMISC_1_1IDisplayera0">display</a> (const <a class="el" href="a02814.html">CLog::TDisplayInfo</a> &args, const char *message)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Display the string where it does. <a href="#NLMISC_1_1IDisplayera0"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a02526.html#NLMISC_1_1IDisplayere0">dateToComputerString</a> (time_t date)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert date to "784551148" string (time in second from 1975). <a href="#NLMISC_1_1IDisplayere0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a02526.html#NLMISC_1_1IDisplayere1">dateToHumanString</a> (time_t date)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert date to "2000/01/14 10:05:17" string. <a href="#NLMISC_1_1IDisplayere1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a02526.html#NLMISC_1_1IDisplayere2">dateToHumanString</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert the current date to human string. <a href="#NLMISC_1_1IDisplayere2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a02526.html#NLMISC_1_1IDisplayere3">logTypeToString</a> (<a class="el" href="a02813.html#NLNET_1_1CNetLogw8">CLog::TLogType</a> logType, bool longFormat=false)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Convert log type to string. <a href="#NLMISC_1_1IDisplayere3"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>std::string </td><td class="memItemRight" valign=bottom><a class="el" href="a02526.html#NLMISC_1_1IDisplayero0">DisplayerName</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">This is the idenfiant for a displayer, it is used to fond or remove a displayer. <a href="#NLMISC_1_1IDisplayero0"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="a03443.html#NLMISC_1_1CStdDisplayerb0">doDisplay</a> (const <a class="el" href="a02814.html">CLog::TDisplayInfo</a> &args, const char *message)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Display the string to stdout and OutputDebugString on Windows. <a href="#NLMISC_1_1CStdDisplayerb0"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Static Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="a02526.html#NLMISC_1_1IDisplayerf0">HeaderString</a> ()</td></tr>
</table>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="NLMISC_1_1CStdDisplayera0" doxytag="NLMISC::CStdDisplayer::CStdDisplayer" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> NLMISC::CStdDisplayer::CStdDisplayer </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const char * </td>
<td class="mdname1" valign="top" nowrap> <em>displayerName</em> = "" </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05638.html#l00105">105</a> of file <a class="el" href="a05638.html">displayer.h</a>.
<p>
<div class="fragment"><pre>00105 : <a class="code" href="a02526.html#NLMISC_1_1IDisplayera1">IDisplayer</a> (displayerName) {}
</pre></div> </td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NLMISC_1_1IDisplayere0" doxytag="NLMISC::CStdDisplayer::dateToComputerString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const char * NLMISC::IDisplayer::dateToComputerString </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">time_t </td>
<td class="mdname1" valign="top" nowrap> <em>date</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Convert date to "784551148" string (time in second from 1975).
<p>
<p>
Definition at line <a class="el" href="a05637.html#l00103">103</a> of file <a class="el" href="a05637.html">displayer.cpp</a>.
<p>
References <a class="el" href="a05586.html#l00161">NLMISC::smprintf()</a>.
<p>
<div class="fragment"><pre>00104 {
00105 <span class="keyword">static</span> <span class="keywordtype">char</span> cstime[25];
00106 <a class="code" href="a05378.html#a259">smprintf</a> (cstime, 25, <span class="stringliteral">"%ld"</span>, &date);
00107 <span class="keywordflow">return</span> cstime;
00108 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLMISC_1_1IDisplayere1" doxytag="NLMISC::CStdDisplayer::dateToHumanString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const char * NLMISC::IDisplayer::dateToHumanString </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">time_t </td>
<td class="mdname1" valign="top" nowrap> <em>date</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Convert date to "2000/01/14 10:05:17" string.
<p>
<p>
Definition at line <a class="el" href="a05637.html#l00092">92</a> of file <a class="el" href="a05637.html">displayer.cpp</a>.
<p>
References <a class="el" href="a05981.html#l00100">uint32</a>.
<p>
<div class="fragment"><pre>00093 {
00094 <span class="keyword">static</span> <span class="keywordtype">char</span> cstime[25];
00095 <span class="keyword">struct </span>tm *tms = localtime(&date);
00096 <span class="keywordflow">if</span> (tms)
00097 strftime (cstime, 25, <span class="stringliteral">"%Y/%m/%d %H:%M:%S"</span>, tms);
00098 <span class="keywordflow">else</span>
00099 sprintf(cstime, <span class="stringliteral">"bad date %d"</span>, (<a class="code" href="a04558.html#a11">uint32</a>)date);
00100 <span class="keywordflow">return</span> cstime;
00101 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLMISC_1_1IDisplayere2" doxytag="NLMISC::CStdDisplayer::dateToHumanString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const char * NLMISC::IDisplayer::dateToHumanString </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Convert the current date to human string.
<p>
<p>
Definition at line <a class="el" href="a05637.html#l00085">85</a> of file <a class="el" href="a05637.html">displayer.cpp</a>.
<p>
Referenced by <a class="el" href="a06094.html#l00123">NLNET::CNetDisplayer::doDisplay()</a>, <a class="el" href="a05976.html#l00330">NLMISC::CMemDisplayer::doDisplay()</a>, <a class="el" href="a05637.html#l00479">NLMISC::CMsgBoxDisplayer::doDisplay()</a>, <a class="el" href="a05637.html#l00379">NLMISC::CFileDisplayer::doDisplay()</a>, and <a class="el" href="a05637.html#l00110">NLMISC::IDisplayer::HeaderString()</a>.
<p>
<div class="fragment"><pre>00086 {
00087 time_t date;
00088 time (&date);
00089 <span class="keywordflow">return</span> <a class="code" href="a02526.html#NLMISC_1_1IDisplayere2">dateToHumanString</a> (date);
00090 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLMISC_1_1IDisplayera0" doxytag="NLMISC::CStdDisplayer::display" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLMISC::IDisplayer::display </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02814.html">CLog::TDisplayInfo</a> & </td>
<td class="mdname" nowrap> <em>args</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>message</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Display the string where it does.
<p>
<p>
Definition at line <a class="el" href="a05637.html#l00132">132</a> of file <a class="el" href="a05637.html">displayer.cpp</a>.
<p>
References <a class="el" href="a02526.html#NLMISC_1_1IDisplayerb0">NLMISC::IDisplayer::doDisplay()</a>.
<p>
<div class="fragment"><pre>00133 {
00134 _Mutex->enter();
00135 <span class="keywordflow">try</span>
00136 {
00137 <a class="code" href="a03443.html#NLMISC_1_1CStdDisplayerb0">doDisplay</a>( args, message );
00138 }
00139 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">Exception</a> &)
00140 {
00141 <span class="comment">// silence</span>
00142 }
00143 _Mutex->leave();
00144 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLMISC_1_1CStdDisplayerb0" doxytag="NLMISC::CStdDisplayer::doDisplay" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> void NLMISC::CStdDisplayer::doDisplay </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">const <a class="el" href="a02814.html">CLog::TDisplayInfo</a> & </td>
<td class="mdname" nowrap> <em>args</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>const char * </td>
<td class="mdname" nowrap> <em>message</em></td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [protected, virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Display the string to stdout and OutputDebugString on Windows.
<p>
<p>
Implements <a class="el" href="a02526.html#NLMISC_1_1IDisplayerb0">NLMISC::IDisplayer</a>.
<p>
Definition at line <a class="el" href="a05637.html#l00148">148</a> of file <a class="el" href="a05637.html">displayer.cpp</a>.
<p>
References <a class="el" href="a05944.html#l00071">NLMISC::CLog::TDisplayInfo::CallstackAndLog</a>, <a class="el" href="a05646.html#l00240">count</a>, <a class="el" href="a05944.html#l00068">NLMISC::CLog::TDisplayInfo::Filename</a>, <a class="el" href="a05637.html#l00061">IsDebuggerPresent</a>, <a class="el" href="a05944.html#l00069">NLMISC::CLog::TDisplayInfo::Line</a>, <a class="el" href="a05944.html#l00065">NLMISC::CLog::TDisplayInfo::LogType</a>, <a class="el" href="a05637.html#l00077">NLMISC::IDisplayer::logTypeToString()</a>, <a class="el" href="a05944.html#l00066">NLMISC::CLog::TDisplayInfo::ProcessName</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05944.html#l00067">NLMISC::CLog::TDisplayInfo::ThreadId</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00100">uint32</a>.
<p>
<div class="fragment"><pre>00149 {
00150 <span class="keywordtype">bool</span> needSpace = <span class="keyword">false</span>;
00151 <span class="comment">//stringstream ss;</span>
00152 string str;
00153
00154 <span class="keywordflow">if</span> (args.LogType != CLog::LOG_NO)
00155 {
00156 <span class="comment">//ss << logTypeToString(args.LogType);</span>
00157 str += <a class="code" href="a02526.html#NLMISC_1_1IDisplayere3">logTypeToString</a>(args.LogType);
00158 needSpace = <span class="keyword">true</span>;
00159 }
00160
00161 <span class="comment">// Write thread identifier</span>
00162 <span class="keywordflow">if</span> ( args.ThreadId != 0 )
00163 {
00164 <span class="comment">//ss << setw(5) << args.ThreadId;</span>
00165 str += <a class="code" href="a05378.html#a244">NLMISC::toString</a>(<span class="stringliteral">"%5u"</span>, args.ThreadId);
00166 needSpace = <span class="keyword">true</span>;
00167 }
00168
00169 <span class="keywordflow">if</span> (args.Filename != NULL)
00170 {
00171 <span class="comment">//if (needSpace) { ss << " "; needSpace = false; }</span>
00172 <span class="keywordflow">if</span> (needSpace) { str += <span class="stringliteral">" "</span>; needSpace = <span class="keyword">false</span>; }
00173 <span class="comment">//ss << CFile::getFilename(args.Filename);</span>
00174 str += CFile::getFilename(args.Filename);
00175 needSpace = <span class="keyword">true</span>;
00176 }
00177
00178 <span class="keywordflow">if</span> (args.Line != -1)
00179 {
00180 <span class="comment">//if (needSpace) { ss << " "; needSpace = false; }</span>
00181 <span class="keywordflow">if</span> (needSpace) { str += <span class="stringliteral">" "</span>; needSpace = <span class="keyword">false</span>; }
00182 <span class="comment">//ss << args.Line;</span>
00183 str += <a class="code" href="a05378.html#a244">NLMISC::toString</a>(args.Line);
00184 needSpace = <span class="keyword">true</span>;
00185 }
00186
00187 <span class="keywordflow">if</span> (!args.ProcessName.empty())
00188 {
00189 <span class="comment">//if (needSpace) { ss << " "; needSpace = false; }</span>
00190 <span class="keywordflow">if</span> (needSpace) { str += <span class="stringliteral">" "</span>; needSpace = <span class="keyword">false</span>; }
00191 <span class="comment">//ss << args.ProcessName;</span>
00192 str + args.ProcessName;
00193 needSpace = <span class="keyword">true</span>;
00194 }
00195
00196 <span class="comment">//if (needSpace) { ss << " : "; needSpace = false; }</span>
00197 <span class="keywordflow">if</span> (needSpace) { str += <span class="stringliteral">" : "</span>; needSpace = <span class="keyword">false</span>; }
00198
00199 <span class="comment">//ss << message;</span>
00200 str += message;
00201
00202 <span class="comment">// string s = ss.str();</span>
00203
00204 <span class="keyword">static</span> <span class="keywordtype">bool</span> consoleMode = <span class="keyword">true</span>;
00205
00206 <span class="preprocessor">#if defined(NL_OS_WINDOWS)</span>
00207 <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keywordtype">bool</span> consoleModeTest = <span class="keyword">false</span>;
00208 <span class="keywordflow">if</span> (!consoleModeTest)
00209 {
00210 HANDLE handle = CreateFile (<span class="stringliteral">"CONOUT$"</span>, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
00211 consoleMode = handle != INVALID_HANDLE_VALUE;
00212 <span class="keywordflow">if</span> (consoleMode)
00213 CloseHandle (handle);
00214 consoleModeTest = <span class="keyword">true</span>;
00215 }
00216 <span class="preprocessor">#endif // NL_OS_WINDOWS</span>
00217 <span class="preprocessor"></span>
00218 <span class="comment">// Printf ?</span>
00219 <span class="keywordflow">if</span> (consoleMode)
00220 {
00221 <span class="comment">// we don't use cout because sometimes, it crashs because cout isn't already init, printf doesn t crash.</span>
00222 <span class="keywordflow">if</span> (!str.empty())
00223 printf (<span class="stringliteral">"%s"</span>, str.c_str());
00224
00225 <span class="keywordflow">if</span> (!args.CallstackAndLog.empty())
00226 printf (args.CallstackAndLog.c_str());
00227
00228 fflush(stdout);
00229 }
00230
00231 <span class="preprocessor">#ifdef NL_OS_WINDOWS</span>
00232 <span class="preprocessor"></span> <span class="comment">// display the string in the debugger is the application is started with the debugger</span>
00233 <span class="keywordflow">if</span> (<a class="code" href="a04214.html#a0">IsDebuggerPresent</a> ())
00234 {
00235 <span class="comment">//stringstream ss2;</span>
00236 string str2;
00237 needSpace = <span class="keyword">false</span>;
00238
00239 <span class="keywordflow">if</span> (args.Filename != NULL) str2 += args.Filename;
00240
00241 <span class="keywordflow">if</span> (args.Line != -1)
00242 {
00243 str2 += <span class="stringliteral">"("</span> + <a class="code" href="a05378.html#a244">NLMISC::toString</a>(args.Line) + <span class="stringliteral">")"</span>;
00244 needSpace = <span class="keyword">true</span>;
00245 }
00246
00247 <span class="keywordflow">if</span> (needSpace) { str2 += <span class="stringliteral">" : "</span>; needSpace = <span class="keyword">false</span>; }
00248
00249 <span class="keywordflow">if</span> (args.LogType != CLog::LOG_NO)
00250 {
00251 str2 += <a class="code" href="a02526.html#NLMISC_1_1IDisplayere3">logTypeToString</a>(args.LogType);
00252 needSpace = <span class="keyword">true</span>;
00253 }
00254
00255 <span class="comment">// Write thread identifier</span>
00256 <span class="keywordflow">if</span> ( args.ThreadId != 0 )
00257 {
00258 str2 += <a class="code" href="a05378.html#a244">NLMISC::toString</a>(<span class="stringliteral">"%5u: "</span>, args.ThreadId);
00259 }
00260
00261 str2 += message;
00262
00263 <span class="keyword">const</span> <a class="code" href="a04558.html#a14">sint</a> maxOutString = 2*1024;
00264
00265 <span class="keywordflow">if</span>(str2.size() < maxOutString)
00266 {
00268 <span class="comment">// WARNING: READ THIS !!!!!!!!!!!!!!!! ///////////////////////////</span>
00269 <span class="comment">// If at the release time, it freezes here, it's a microsoft bug:</span>
00270 <span class="comment">// http://support.microsoft.com/support/kb/articles/q173/2/60.asp</span>
00271 OutputDebugString(str2.c_str());
00272 }
00273 <span class="keywordflow">else</span>
00274 {
00275 <span class="comment">/*OutputDebugString(ss2.str().c_str());</span>
00276 <span class="comment"> OutputDebugString("\n\t\t\t");</span>
00277 <span class="comment"> OutputDebugString("message end: ");</span>
00278 <span class="comment"> OutputDebugString(&message[strlen(message) - 1024]);</span>
00279 <span class="comment"> OutputDebugString("\n");*/</span>
00280
00281 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a577">count</a> = 0;
00282 <a class="code" href="a04558.html#a15">uint</a> n = strlen(message);
00283 std::string <a class="code" href="a04223.html#a626">s</a>(&str2.c_str()[0], (str2.size() - n));
00284 OutputDebugString(<a class="code" href="a04223.html#a626">s</a>.c_str());
00285
00286 <span class="keywordflow">while</span>(<span class="keyword">true</span>)
00287 {
00288
00289 <span class="keywordflow">if</span>((n - <a class="code" href="a04223.html#a577">count</a>) < maxOutString )
00290 {
00291 <a class="code" href="a04223.html#a626">s</a> = std::string(&message[count], (n - count));
00292 OutputDebugString(<a class="code" href="a04223.html#a626">s</a>.c_str());
00293 OutputDebugString(<span class="stringliteral">"\n"</span>);
00294 <span class="keywordflow">break</span>;
00295 }
00296 <span class="keywordflow">else</span>
00297 {
00298 <a class="code" href="a04223.html#a626">s</a> = std::string(&message[count] , count + maxOutString);
00299 OutputDebugString(<a class="code" href="a04223.html#a626">s</a>.c_str());
00300 OutputDebugString(<span class="stringliteral">"\n\t\t\t"</span>);
00301 <a class="code" href="a04223.html#a577">count</a> += maxOutString;
00302 }
00303 }
00304 }
00305
00306 <span class="comment">// OutputDebugString is a big shit, we can't display big string in one time, we need to split</span>
00307 <a class="code" href="a04558.html#a11">uint32</a> pos = 0;
00308 string splited;
00309 <span class="keywordflow">while</span>(<span class="keyword">true</span>)
00310 {
00311 <span class="keywordflow">if</span> (pos+1000 < args.CallstackAndLog.size ())
00312 {
00313 splited = args.CallstackAndLog.substr (pos, 1000);
00314 OutputDebugString(splited.c_str());
00315 pos += 1000;
00316 }
00317 <span class="keywordflow">else</span>
00318 {
00319 splited = args.CallstackAndLog.substr (pos);
00320 OutputDebugString(splited.c_str());
00321 <span class="keywordflow">break</span>;
00322 }
00323 }
00324 }
00325 <span class="preprocessor">#endif</span>
00326 <span class="preprocessor"></span>}
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLMISC_1_1IDisplayerf0" doxytag="NLMISC::CStdDisplayer::HeaderString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const char * NLMISC::IDisplayer::HeaderString </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [static, protected, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
<p>
Definition at line <a class="el" href="a05637.html#l00110">110</a> of file <a class="el" href="a05637.html">displayer.cpp</a>.
<p>
References <a class="el" href="a05637.html#l00085">NLMISC::IDisplayer::dateToHumanString()</a>, and <a class="el" href="a05586.html#l00161">NLMISC::smprintf()</a>.
<p>
Referenced by <a class="el" href="a05976.html#l00330">NLMISC::CMemDisplayer::doDisplay()</a>, and <a class="el" href="a05637.html#l00379">NLMISC::CFileDisplayer::doDisplay()</a>.
<p>
<div class="fragment"><pre>00111 {
00112 <span class="keyword">static</span> <span class="keywordtype">char</span> header[1024];
00113 <a class="code" href="a05378.html#a259">smprintf</a>(header, 1024, <span class="stringliteral">"\nLog Starting [%s]\n"</span>, <a class="code" href="a02526.html#NLMISC_1_1IDisplayere2">dateToHumanString</a>());
00114 <span class="keywordflow">return</span> header;
00115 }
</pre></div> </td>
</tr>
</table>
<a class="anchor" name="NLMISC_1_1IDisplayere3" doxytag="NLMISC::CStdDisplayer::logTypeToString" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> const char * NLMISC::IDisplayer::logTypeToString </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="a02813.html#NLNET_1_1CNetLogw8">CLog::TLogType</a> </td>
<td class="mdname" nowrap> <em>logType</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td></td>
<td class="md" nowrap>bool </td>
<td class="mdname" nowrap> <em>longFormat</em> = false</td>
</tr>
<tr>
<td></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [static, inherited]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Convert log type to string.
<p>
<p>
Definition at line <a class="el" href="a05637.html#l00077">77</a> of file <a class="el" href="a05637.html">displayer.cpp</a>.
<p>
References <a class="el" href="a05637.html#l00071">NLMISC::LogTypeToString</a>.
<p>
Referenced by <a class="el" href="a06751.html#l00130">NLMISC::CWindowDisplayer::doDisplay()</a>, <a class="el" href="a06094.html#l00123">NLNET::CNetDisplayer::doDisplay()</a>, <a class="el" href="a05976.html#l00330">NLMISC::CMemDisplayer::doDisplay()</a>, <a class="el" href="a05637.html#l00479">NLMISC::CMsgBoxDisplayer::doDisplay()</a>, <a class="el" href="a05637.html#l00379">NLMISC::CFileDisplayer::doDisplay()</a>, and <a class="el" href="a05637.html#l00148">doDisplay()</a>.
<p>
<div class="fragment"><pre>00078 {
00079 <span class="keywordflow">if</span> (logType < CLog::LOG_NO || logType > CLog::LOG_UNKNOWN)
00080 <span class="keywordflow">return</span> <span class="stringliteral">"<NotDefined>"</span>;
00081
00082 <span class="keywordflow">return</span> <a class="code" href="a05378.html#a20">LogTypeToString</a>[longFormat?1:0][logType];
00083 }
</pre></div> </td>
</tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NLMISC_1_1IDisplayero0" doxytag="NLMISC::CStdDisplayer::DisplayerName" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> std::string <a class="el" href="a02526.html#NLMISC_1_1IDisplayero0">NLMISC::IDisplayer::DisplayerName</a><code> [inherited]</code>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
This is the idenfiant for a displayer, it is used to fond or remove a displayer.
<p>
<p>
Definition at line <a class="el" href="a05638.html#l00063">63</a> of file <a class="el" href="a05638.html">displayer.h</a>.
<p>
Referenced by <a class="el" href="a05637.html#l00118">NLMISC::IDisplayer::IDisplayer()</a>. </td>
</tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a05638.html">displayer.h</a><li><a class="el" href="a05637.html">displayer.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:34:56 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
</a>1.3.6 </small></address>
</body>
</html>
|