aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/displayer_8cpp-source.html
blob: 78f0fb445adfeae288f3af67690cc7bfe9176e0f (plain)
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
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>displayer.cpp</h1><a href="displayer_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="stdmisc_8h.html">stdmisc.h</a>"</font>
00027 
00028 
00029 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
00030 <font class="preprocessor"></font><font class="preprocessor">#       include &lt;io.h&gt;</font>
00031 <font class="preprocessor">#       include &lt;fcntl.h&gt;</font>
00032 <font class="preprocessor">#       include &lt;sys/types.h&gt;</font>
00033 <font class="preprocessor">#       include &lt;sys/stat.h&gt;</font>
00034 <font class="preprocessor">#endif // NL_OS_WINDOWS</font>
00035 <font class="preprocessor"></font>
00036 <font class="preprocessor">#include &lt;stdio.h&gt;</font>
00037 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
00038 <font class="preprocessor">#include &lt;time.h&gt;</font>
00039 
00040 <font class="preprocessor">#include &lt;iostream&gt;</font>
00041 <font class="preprocessor">#include &lt;fstream&gt;</font>
00042 <font class="preprocessor">#include &lt;sstream&gt;</font>
00043 <font class="preprocessor">#include &lt;iomanip&gt;</font>
00044 
00045 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
00046 <font class="preprocessor">#include "<a class="code" href="mutex_8h.html">nel/misc/mutex.h</a>"</font>
00047 <font class="preprocessor">#include "<a class="code" href="report_8h.html">nel/misc/report.h</a>"</font>
00048 
00049 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
00050 
00051 
00052 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
00053 <font class="preprocessor"></font><font class="comment">// these defines is for IsDebuggerPresent(). it'll not compile on windows 95</font>
00054 <font class="comment">// just comment this and the IsDebuggerPresent to compile on windows 95</font>
00055 <font class="preprocessor">#       define _WIN32_WINDOWS   0x0410</font>
00056 <font class="preprocessor"></font><font class="preprocessor">#       define WINVER                   0x0400</font>
00057 <font class="preprocessor"></font><font class="preprocessor">#       include &lt;windows.h&gt;</font>
00058 <font class="preprocessor">#else</font>
<a name="l00059"></a><a class="code" href="displayer_8cpp.html#a0">00059</a> <font class="preprocessor"></font><font class="preprocessor">#       define IsDebuggerPresent() false</font>
00060 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00061 <font class="preprocessor"></font>
00062 <font class="preprocessor">#include "<a class="code" href="displayer_8h.html">nel/misc/displayer.h</a>"</font>
00063 
00064 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00065 
00066 <font class="keyword">namespace </font>NLMISC
00067 {
00068 
00069 <font class="keyword">static</font> <font class="keywordtype">char</font> *<a class="code" href="namespaceNLMISC.html#a192">LogTypeToString</a>[][8] = {
00070         { <font class="stringliteral">""</font>, <font class="stringliteral">"ERR"</font>, <font class="stringliteral">"WRN"</font>, <font class="stringliteral">"INF"</font>, <font class="stringliteral">"DBG"</font>, <font class="stringliteral">"STT"</font>, <font class="stringliteral">"AST"</font>, <font class="stringliteral">"UKN"</font> },
00071         { <font class="stringliteral">""</font>, <font class="stringliteral">"Error"</font>, <font class="stringliteral">"Warning"</font>, <font class="stringliteral">"Information"</font>, <font class="stringliteral">"Debug"</font>, <font class="stringliteral">"Statistic"</font>, <font class="stringliteral">"Assert"</font>, <font class="stringliteral">"Unknown"</font> },
00072         { <font class="stringliteral">""</font>, <font class="stringliteral">"A fatal error occurs. The program must quit"</font>, <font class="stringliteral">""</font>, <font class="stringliteral">""</font>, <font class="stringliteral">""</font>, <font class="stringliteral">""</font>, <font class="stringliteral">"A failed assertion occurs"</font>, <font class="stringliteral">""</font> },
00073 };
00074 
<a name="l00075"></a><a class="code" href="classNLMISC_1_1IDisplayer.html#e0">00075</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *IDisplayer::logTypeToString (CLog::TLogType logType, <font class="keywordtype">bool</font> longFormat)
00076 {
00077         <font class="keywordflow">if</font> (logType &lt; CLog::LOG_NO || logType &gt; CLog::LOG_UNKNOWN)
00078                 <font class="keywordflow">return</font> <font class="stringliteral">"&lt;NotDefined&gt;"</font>;
00079 
00080         <font class="keywordflow">return</font> <a class="code" href="namespaceNLMISC.html#a192">LogTypeToString</a>[longFormat?1:0][logType];
00081 }
00082 
00083 <font class="keyword">const</font> <font class="keywordtype">char</font> *IDisplayer::dateToHumanString ()
00084 {
00085         time_t date;
00086         time (&amp;date);
00087         <font class="keywordflow">return</font> <a class="code" href="classNLMISC_1_1IDisplayer.html#e2">dateToHumanString</a> (date);
00088 }
00089 
<a name="l00090"></a><a class="code" href="classNLMISC_1_1IDisplayer.html#e2">00090</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *IDisplayer::dateToHumanString (time_t date)
00091 {
00092         <font class="keyword">static</font> <font class="keywordtype">char</font> cstime[25];
00093         <font class="keyword">struct </font>tm *tms = localtime(&amp;date);
00094         <font class="keywordflow">if</font> (tms)
00095                 strftime (cstime, 25, <font class="stringliteral">"%Y/%m/%d %H:%M:%S"</font>, tms);
00096         <font class="keywordflow">else</font>
00097                 sprintf(cstime, <font class="stringliteral">"bad date %d"</font>, (uint32)date);
00098         <font class="keywordflow">return</font> cstime;
00099 }
00100 
<a name="l00101"></a><a class="code" href="classNLMISC_1_1IDisplayer.html#e3">00101</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *IDisplayer::dateToComputerString (time_t date)
00102 {
00103         <font class="keyword">static</font> <font class="keywordtype">char</font> cstime[25];
00104         <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (cstime, 25, <font class="stringliteral">"%ld"</font>, &amp;date);
00105         <font class="keywordflow">return</font> cstime;
00106 }
00107 
<a name="l00108"></a><a class="code" href="classNLMISC_1_1IDisplayer.html#e4">00108</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *IDisplayer::HeaderString ()
00109 {
00110         <font class="keyword">static</font> <font class="keywordtype">char</font> header[1024];
00111         <a class="code" href="namespaceNLMISC.html#a211">smprintf</a>(header, 1024, <font class="stringliteral">"\nLog Starting [%s]\n"</font>, <a class="code" href="classNLMISC_1_1IDisplayer.html#e2">dateToHumanString</a>());
00112         <font class="keywordflow">return</font> header;
00113 }
00114 
00115 
<a name="l00116"></a><a class="code" href="classNLMISC_1_1IDisplayer.html#a0">00116</a> IDisplayer::IDisplayer(<font class="keyword">const</font> <font class="keywordtype">char</font> *displayerName)
00117 {
00118         <a class="code" href="classNLMISC_1_1IDisplayer.html#o0">_Mutex</a> = <font class="keyword">new</font> <a class="code" href="mutex_8h.html#a1">CMutex</a> (string(displayerName)+<font class="stringliteral">"DISP"</font>);
00119         <a class="code" href="classNLMISC_1_1IDisplayer.html#m0">DisplayerName</a> = displayerName;
00120 }
00121 
<a name="l00122"></a><a class="code" href="classNLMISC_1_1IDisplayer.html#a1">00122</a> IDisplayer::~IDisplayer()
00123 {
00124         <font class="keyword">delete</font> <a class="code" href="classNLMISC_1_1IDisplayer.html#o0">_Mutex</a>;
00125 }
00126 
00127 <font class="comment">/*</font>
00128 <font class="comment"> * Display the string where it does.</font>
00129 <font class="comment"> */</font>
<a name="l00130"></a><a class="code" href="classNLMISC_1_1IDisplayer.html#a2">00130</a> <font class="keywordtype">void</font> IDisplayer::display ( <font class="keyword">const</font> TDisplayInfo&amp; args, <font class="keyword">const</font> <font class="keywordtype">char</font> *message )
00131 {
00132         <a class="code" href="classNLMISC_1_1IDisplayer.html#o0">_Mutex</a>-&gt;enter();
00133         <font class="keywordflow">try</font>
00134         {
00135                 <a class="code" href="classNLMISC_1_1IDisplayer.html#b0">doDisplay</a>( args, message );
00136         }
00137         <font class="keywordflow">catch</font> (Exception &amp;)
00138         {
00139                 <font class="comment">// silence</font>
00140         }
00141         <a class="code" href="classNLMISC_1_1IDisplayer.html#o0">_Mutex</a>-&gt;leave();
00142 }
00143 
00144 
00145 <font class="comment">// Log format : "&lt;LogType&gt; &lt;ThreadNo&gt; &lt;FileName&gt; &lt;Line&gt; &lt;ProcessName&gt; : &lt;Msg&gt;"</font>
<a name="l00146"></a><a class="code" href="classNLMISC_1_1CStdDisplayer.html#b0">00146</a> <font class="keywordtype">void</font> CStdDisplayer::doDisplay ( <font class="keyword">const</font> TDisplayInfo&amp; args, <font class="keyword">const</font> <font class="keywordtype">char</font> *message )
00147 {
00148         <font class="keywordtype">bool</font> needSpace = <font class="keyword">false</font>;
00149         stringstream ss;
00150 
00151         <font class="keywordflow">if</font> (args.LogType != CLog::LOG_NO)
00152         {
00153                 ss &lt;&lt; <a class="code" href="classNLMISC_1_1IDisplayer.html#e0">logTypeToString</a>(args.LogType);
00154                 needSpace = <font class="keyword">true</font>;
00155         }
00156 
00157         <font class="comment">// Write thread identifier</font>
00158         <font class="keywordflow">if</font> ( args.ThreadId != 0 )
00159         {
00160                 ss &lt;&lt; setw(5) &lt;&lt; args.ThreadId;
00161                 needSpace = <font class="keyword">true</font>;
00162         }
00163 
00164         <font class="keywordflow">if</font> (args.Filename != NULL)
00165         {
00166                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00167                 ss &lt;&lt; CFile::getFilename(args.Filename);
00168                 needSpace = <font class="keyword">true</font>;
00169         }
00170 
00171         <font class="keywordflow">if</font> (args.Line != -1)
00172         {
00173                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00174                 ss &lt;&lt; args.Line;
00175                 needSpace = <font class="keyword">true</font>;
00176         }
00177         
00178         <font class="keywordflow">if</font> (!args.ProcessName.empty())
00179         {
00180                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00181                 ss &lt;&lt; args.ProcessName;
00182                 needSpace = <font class="keyword">true</font>;
00183         }
00184 
00185         <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" : "</font>; needSpace = <font class="keyword">false</font>; }
00186 
00187         ss &lt;&lt; message;
00188 
00189         string <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> = ss.str();
00190 
00191         <font class="comment">// we don't use cout because sometimes, it crashs because cout isn't already init, printf doesn t crash.</font>
00192         printf (<font class="stringliteral">"%s"</font>, <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.c_str()); 
00193         printf (args.CallstackAndLog.c_str());
00194 
00195         fflush(stdout);
00196 
00197 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
00198 <font class="preprocessor"></font>        <font class="comment">// display the string in the debugger is the application is started with the debugger</font>
00199         <font class="keywordflow">if</font> (<a class="code" href="displayer_8cpp.html#a0">IsDebuggerPresent</a> ())
00200         {
00201                 stringstream ss2;
00202                 needSpace = <font class="keyword">false</font>;
00203 
00204                 <font class="keywordflow">if</font> (args.Filename != NULL) ss2 &lt;&lt; args.Filename;
00205 
00206                 <font class="keywordflow">if</font> (args.Line != -1)
00207                 {
00208                         ss2 &lt;&lt; <font class="charliteral">'('</font> &lt;&lt; args.Line &lt;&lt; <font class="charliteral">')'</font>;
00209                         needSpace = <font class="keyword">true</font>;
00210                 }
00211 
00212                 <font class="keywordflow">if</font> (needSpace) { ss2 &lt;&lt; <font class="stringliteral">" : "</font>; needSpace = <font class="keyword">false</font>; }
00213 
00214                 <font class="keywordflow">if</font> (args.LogType != CLog::LOG_NO)
00215                 {
00216                         ss2 &lt;&lt; <a class="code" href="classNLMISC_1_1IDisplayer.html#e0">logTypeToString</a>(args.LogType);
00217                         needSpace = <font class="keyword">true</font>;
00218                 }
00219 
00220                 <font class="comment">// Write thread identifier</font>
00221                 <font class="keywordflow">if</font> ( args.ThreadId != 0 )
00222                 {
00223                         ss2 &lt;&lt; setw(5) &lt;&lt; args.ThreadId &lt;&lt; <font class="stringliteral">": "</font>;
00224                 }
00225 
00226                 ss2 &lt;&lt; message;
00227 
00228                 <font class="keyword">const</font> sint maxOutString = 2*1024;
00229 
00230                 <font class="keywordflow">if</font>(ss2.str().size() &lt; maxOutString)
00231                 {
00233                         <font class="comment">// WARNING: READ THIS !!!!!!!!!!!!!!!! ///////////////////////////</font>
00234                         <font class="comment">// If at the release time, it freezes here, it's a microsoft bug:</font>
00235                         <font class="comment">// http://support.microsoft.com/support/kb/articles/q173/2/60.asp</font>
00236                         OutputDebugString(ss2.str().c_str());
00237                 }
00238                 <font class="keywordflow">else</font>
00239                 {
00240                         <font class="comment">/*OutputDebugString(ss2.str().c_str());</font>
00241 <font class="comment">                        OutputDebugString("\n\t\t\t");</font>
00242 <font class="comment">                        OutputDebugString("message end: ");</font>
00243 <font class="comment">                        OutputDebugString(&amp;message[strlen(message) - 1024]);</font>
00244 <font class="comment">                        OutputDebugString("\n");*/</font>
00245 
00246                         sint count = 0; 
00247                         uint n = strlen(message);
00248                         std::string <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>(&amp;ss2.str().c_str()[0], (ss2.str().size() - n));
00249                         OutputDebugString(<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.c_str());
00250                         
00251                         <font class="keywordflow">while</font>(true)
00252                         {                                                                                               
00253                                 
00254                                 <font class="keywordflow">if</font>((n - count) &lt; maxOutString )
00255                                 {
00256                                         <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> = std::string(&amp;message[count], (n - count));
00257                                         OutputDebugString(<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.c_str());
00258                                         OutputDebugString(<font class="stringliteral">"\n"</font>);
00259                                         <font class="keywordflow">break</font>;
00260                                 }       
00261                                 <font class="keywordflow">else</font>
00262                                 {
00263                                         <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a> = std::string(&amp;message[count] , count + maxOutString);
00264                                         OutputDebugString(<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.c_str());
00265                                         OutputDebugString(<font class="stringliteral">"\n\t\t\t"</font>);
00266                                         count += maxOutString;
00267                                 }
00268                         }
00269                 }
00270 
00271                 <font class="comment">// OutputDebugString is a big shit, we can't display big string in one time, we need to split</font>
00272                 uint32 pos = 0;
00273                 string splited;
00274                 <font class="keywordflow">while</font>(true)
00275                 {
00276                         <font class="keywordflow">if</font> (pos+1000 &lt; args.CallstackAndLog.size ())
00277                         {
00278                                 splited = args.CallstackAndLog.substr (pos, 1000);
00279                                 OutputDebugString(splited.c_str());
00280                                 pos += 1000;
00281                         }
00282                         <font class="keywordflow">else</font>
00283                         {
00284                                 splited = args.CallstackAndLog.substr (pos);
00285                                 OutputDebugString(splited.c_str());
00286                                 <font class="keywordflow">break</font>;
00287                         }
00288                 }
00289         }
00290 <font class="preprocessor">#endif</font>
00291 <font class="preprocessor"></font>}
00292 
<a name="l00293"></a><a class="code" href="classNLMISC_1_1CFileDisplayer.html#a0">00293</a> CFileDisplayer::CFileDisplayer (<font class="keyword">const</font> std::string &amp;filename, <font class="keywordtype">bool</font> eraseLastLog, <font class="keyword">const</font> <font class="keywordtype">char</font> *displayerName) : IDisplayer (displayerName), _NeedHeader(true)
00294 {
00295         <a class="code" href="classNLMISC_1_1CFileDisplayer.html#a2">setParam</a> (filename, eraseLastLog);
00296         <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> = (FILE*)1;
00297 }
00298 
<a name="l00299"></a><a class="code" href="classNLMISC_1_1CFileDisplayer.html#a1">00299</a> CFileDisplayer::CFileDisplayer () : IDisplayer (""), _NeedHeader(true)
00300 {
00301         <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> = (FILE*)1;
00302 }
00303 
<a name="l00304"></a><a class="code" href="classNLMISC_1_1CFileDisplayer.html#a2">00304</a> <font class="keywordtype">void</font> CFileDisplayer::setParam (<font class="keyword">const</font> std::string &amp;filename, <font class="keywordtype">bool</font> eraseLastLog)
00305 {
00306         <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o0">_FileName</a> = filename;
00307 
00308         <font class="keywordflow">if</font> (filename.empty())
00309         {
00310                 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CFileDisplayer::setParam(): Can't create file with empty filename, don't log"</font>);
00311                 <font class="keywordflow">return</font>;
00312         }
00313 
00314         <font class="keywordflow">if</font> (eraseLastLog)
00315         {
00316                 ofstream ofs (filename.c_str(), ios::out | ios::trunc);
00317                 <font class="keywordflow">if</font> (!ofs.is_open())
00318                 {
00319                         <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"CFileDisplayer::setParam(): Can't open and clear the log file '%s', don't log"</font>, filename.c_str());
00320                 }
00321         }
00322 }
00323 
00324 
00325 uint32  <a class="code" href="namespaceNLMISC.html#a294">toto</a> (FILE *fp)
00326 {
00327         <font class="keywordflow">if</font> (fp == NULL) <font class="keywordflow">return</font> 0;
00328         fseek (fp, 0, SEEK_END);
00329         <font class="keywordflow">return</font> ftell (fp);
00330 }
00331 
00332 <font class="comment">// Log format: "2000/01/15 12:05:30 &lt;ProcessName&gt; &lt;LogType&gt; &lt;ThreadId&gt; &lt;Filename&gt; &lt;Line&gt; : &lt;Msg&gt;"</font>
<a name="l00333"></a><a class="code" href="classNLMISC_1_1CFileDisplayer.html#b0">00333</a> <font class="keywordtype">void</font> CFileDisplayer::doDisplay ( <font class="keyword">const</font> TDisplayInfo&amp; args, <font class="keyword">const</font> <font class="keywordtype">char</font> *message )
00334 {
00335         <font class="keywordtype">bool</font> needSpace = <font class="keyword">false</font>;
00336         stringstream ss;
00337 
00338         <font class="comment">// if the filename is not set, don't log</font>
00339         <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o0">_FileName</a>.empty()) <font class="keywordflow">return</font>;
00340 
00341         <font class="keywordflow">if</font> (args.Date != 0)
00342         {
00343                 ss &lt;&lt; <a class="code" href="classNLMISC_1_1IDisplayer.html#e2">dateToHumanString</a>(args.Date);
00344                 needSpace = <font class="keyword">true</font>;
00345         }
00346 
00347         <font class="keywordflow">if</font> (args.LogType != CLog::LOG_NO)
00348         {
00349                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00350                 ss &lt;&lt; <a class="code" href="classNLMISC_1_1IDisplayer.html#e0">logTypeToString</a>(args.LogType);
00351                 needSpace = <font class="keyword">true</font>;
00352         }
00353 
00354         <font class="comment">// Write thread identifier</font>
00355         <font class="keywordflow">if</font> ( args.ThreadId != 0 )
00356         {
00357                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00358                 ss &lt;&lt; args.ThreadId;
00359                 needSpace = <font class="keyword">true</font>;
00360         }
00361 
00362         <font class="keywordflow">if</font> (!args.ProcessName.empty())
00363         {
00364                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00365                 ss &lt;&lt; args.ProcessName;
00366                 needSpace = <font class="keyword">true</font>;
00367         }
00368 
00369         <font class="keywordflow">if</font> (args.Filename != NULL)
00370         {
00371                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00372                 ss &lt;&lt; CFile::getFilename(args.Filename);
00373                 needSpace = <font class="keyword">true</font>;
00374         }
00375 
00376         <font class="keywordflow">if</font> (args.Line != -1)
00377         {
00378                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00379                 ss &lt;&lt; args.Line;
00380                 needSpace = <font class="keyword">true</font>;
00381         }
00382         
00383         <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" : "</font>; needSpace = <font class="keyword">false</font>; }
00384 
00385         ss &lt;&lt; message;
00386 
00387         <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> &gt; (FILE*)1)
00388         {
00389                 <font class="comment">// if the file is too big (&gt;5mb), rename it and create another one</font>
00390                 <font class="keywordflow">if</font> (ftell (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a>) &gt; 5*1024*1024)
00391                 {
00392                         fclose (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a>);
00393                         rename (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o0">_FileName</a>.c_str(), CFile::findNewFile (_FileName).c_str());
00394                         fclose (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a>);
00395                         <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> = (FILE*) 1;
00396                 }
00397         }
00398 
00399         <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> == (FILE*)1)
00400         {
00401                 <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> = fopen (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o0">_FileName</a>.c_str(), <font class="stringliteral">"at"</font>);
00402                 <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> == NULL)
00403                         perror (<font class="stringliteral">"Can't open log file"</font>);
00404         }
00405         
00406         <font class="keywordflow">if</font> (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a> != 0)
00407         {
00408                 <font class="keywordflow">if</font> (_NeedHeader)
00409                 {
00410                         <font class="keyword">const</font> <font class="keywordtype">char</font> *hs = <a class="code" href="classNLMISC_1_1IDisplayer.html#e4">HeaderString</a>();
00411                         fwrite (hs, strlen (hs), 1, <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a>);
00412                         <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o2">_NeedHeader</a> = <font class="keyword">false</font>;
00413                 }
00414                 
00415                 fwrite (ss.str().c_str(), ss.str().size (), 1, <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a>);
00416                 fwrite (args.CallstackAndLog.c_str(), args.CallstackAndLog.size (), 1, <a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a>);
00417                 fflush (<a class="code" href="classNLMISC_1_1CFileDisplayer.html#o1">_FilePointer</a>);
00418         }
00419 }
00420 
00421 <font class="comment">// Log format in clipboard: "2000/01/15 12:05:30 &lt;LogType&gt; &lt;ProcessName&gt; &lt;FileName&gt; &lt;Line&gt;: &lt;Msg&gt;"</font>
00422 <font class="comment">// Log format on the screen: in debug   "&lt;ProcessName&gt; &lt;FileName&gt; &lt;Line&gt;: &lt;Msg&gt;"</font>
00423 <font class="comment">//                           in release "&lt;Msg&gt;"</font>
<a name="l00424"></a><a class="code" href="classNLMISC_1_1CMsgBoxDisplayer.html#b0">00424</a> <font class="keywordtype">void</font> CMsgBoxDisplayer::doDisplay ( <font class="keyword">const</font> TDisplayInfo&amp; args, <font class="keyword">const</font> <font class="keywordtype">char</font> *message)
00425 {
00426 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
00427 <font class="preprocessor"></font>
00428         <font class="keywordtype">bool</font> needSpace = <font class="keyword">false</font>;
00429         stringstream ss;
00430 
00431         <font class="comment">// create the string for the clipboard</font>
00432 
00433         <font class="keywordflow">if</font> (args.Date != 0)
00434         {
00435                 ss &lt;&lt; <a class="code" href="classNLMISC_1_1IDisplayer.html#e2">dateToHumanString</a>(args.Date);
00436                 needSpace = <font class="keyword">true</font>;
00437         }
00438 
00439         <font class="keywordflow">if</font> (args.LogType != CLog::LOG_NO)
00440         {
00441                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00442                 ss &lt;&lt; <a class="code" href="classNLMISC_1_1IDisplayer.html#e0">logTypeToString</a>(args.LogType);
00443                 needSpace = <font class="keyword">true</font>;
00444         }
00445 
00446         <font class="keywordflow">if</font> (!args.ProcessName.empty())
00447         {
00448                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00449                 ss &lt;&lt; args.ProcessName;
00450                 needSpace = <font class="keyword">true</font>;
00451         }
00452         
00453         <font class="keywordflow">if</font> (args.Filename != NULL)
00454         {
00455                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00456                 ss &lt;&lt; CFile::getFilename(args.Filename);
00457                 needSpace = <font class="keyword">true</font>;
00458         }
00459 
00460         <font class="keywordflow">if</font> (args.Line != -1)
00461         {
00462                 <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00463                 ss &lt;&lt; args.Line;
00464                 needSpace = <font class="keyword">true</font>;
00465         }
00466 
00467         <font class="keywordflow">if</font> (needSpace) { ss &lt;&lt; <font class="stringliteral">": "</font>; needSpace = <font class="keyword">false</font>; }
00468 
00469         ss &lt;&lt; message;
00470 
00471         <font class="keywordflow">if</font> (OpenClipboard (NULL))
00472         {
00473                 HGLOBAL mem = GlobalAlloc (GHND|GMEM_DDESHARE, ss.str().size()+1);
00474                 <font class="keywordflow">if</font> (mem)
00475                 {
00476                         <font class="keywordtype">char</font> *pmem = (<font class="keywordtype">char</font> *)GlobalLock (mem);
00477                         strcpy (pmem, ss.str().c_str());
00478                         GlobalUnlock (mem);
00479                         EmptyClipboard ();
00480                         SetClipboardData (CF_TEXT, mem);
00481                 }
00482                 CloseClipboard ();
00483         }
00484         
00485         <font class="comment">// create the string on the screen</font>
00486         needSpace = <font class="keyword">false</font>;
00487         stringstream ss2;
00488 
00489 <font class="preprocessor">#ifdef NL_DEBUG</font>
00490 <font class="preprocessor"></font>        <font class="keywordflow">if</font> (!args.ProcessName.empty())
00491         {
00492                 <font class="keywordflow">if</font> (needSpace) { ss2 &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00493                 ss2 &lt;&lt; args.ProcessName;
00494                 needSpace = <font class="keyword">true</font>;
00495         }
00496         
00497         <font class="keywordflow">if</font> (args.Filename != NULL)
00498         {
00499                 <font class="keywordflow">if</font> (needSpace) { ss2 &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00500                 ss2 &lt;&lt; CFile::getFilename(args.Filename);
00501                 needSpace = <font class="keyword">true</font>;
00502         }
00503 
00504         <font class="keywordflow">if</font> (args.Line != -1)
00505         {
00506                 <font class="keywordflow">if</font> (needSpace) { ss2 &lt;&lt; <font class="stringliteral">" "</font>; needSpace = <font class="keyword">false</font>; }
00507                 ss2 &lt;&lt; args.Line;
00508                 needSpace = <font class="keyword">true</font>;
00509         }
00510 
00511         <font class="keywordflow">if</font> (needSpace) { ss2 &lt;&lt; <font class="stringliteral">": "</font>; needSpace = <font class="keyword">false</font>; }
00512 <font class="preprocessor">#endif // NL_DEBUG</font>
00513 <font class="preprocessor"></font>
00514         ss2 &lt;&lt; message;
00515         ss2 &lt;&lt; endl &lt;&lt; endl &lt;&lt; <font class="stringliteral">"(this message was copied in the clipboard)"</font>;
00516 
00517 <font class="comment">/*      if (IsDebuggerPresent ())</font>
00518 <font class="comment">        {</font>
00519 <font class="comment">                // Must break in assert call</font>
00520 <font class="comment">                DebugNeedAssert = true;</font>
00521 <font class="comment">        }</font>
00522 <font class="comment">        else</font>
00523 <font class="comment">*/</font>      {
00524 
00525                 <font class="comment">// Display the report</font>
00526 
00527                 string body;
00528 
00529                 body += <a class="code" href="namespaceNLMISC.html#a243">toString</a>(<a class="code" href="namespaceNLMISC.html#a192">LogTypeToString</a>[2][args.LogType]) + <font class="stringliteral">"\n"</font>;
00530                 body += <font class="stringliteral">"ProcName: "</font> + args.ProcessName + <font class="stringliteral">"\n"</font>;
00531                 body += <font class="stringliteral">"Date: "</font> + string(<a class="code" href="classNLMISC_1_1IDisplayer.html#e2">dateToHumanString</a>(args.Date)) + <font class="stringliteral">"\n"</font>;
00532                 <font class="keywordflow">if</font>(args.Filename == NULL)
00533                         body += <font class="stringliteral">"File: &lt;Unknown&gt;\n"</font>;
00534                 <font class="keywordflow">else</font>
00535                         body += <font class="stringliteral">"File: "</font> + string(args.Filename) + <font class="stringliteral">"\n"</font>;
00536                 body += <font class="stringliteral">"Line: "</font> + <a class="code" href="namespaceNLMISC.html#a243">toString</a>(args.Line) + <font class="stringliteral">"\n"</font>;
00537                 body += <font class="stringliteral">"Reason: "</font> + <a class="code" href="namespaceNLMISC.html#a243">toString</a>(message);
00538 
00539                 body += args.CallstackAndLog;
00540 
00541                 string subject;
00542 
00543                 <font class="comment">// procname is host/service_name-sid we only want the service_name to avoid redondant mail</font>
00544                 string procname;
00545                 sint pos = args.ProcessName.find (<font class="stringliteral">"/"</font>);
00546                 <font class="keywordflow">if</font> (pos == string::npos)
00547                 {
00548                         procname =  args.ProcessName;
00549                 }
00550                 <font class="keywordflow">else</font>
00551                 {
00552                         sint pos2 = args.ProcessName.find (<font class="stringliteral">"-"</font>, pos+1);
00553                         <font class="keywordflow">if</font> (pos2 == string::npos)
00554                         {
00555                                 procname =  args.ProcessName.substr (pos+1);
00556                         }
00557                         <font class="keywordflow">else</font>
00558                         {
00559                                 procname =  args.ProcessName.substr (pos+1, pos2-pos-1);
00560                         }
00561                 }
00562 
00563                 subject += procname + <font class="stringliteral">" NeL "</font> + <a class="code" href="namespaceNLMISC.html#a243">toString</a>(<a class="code" href="namespaceNLMISC.html#a192">LogTypeToString</a>[0][args.LogType]) + <font class="stringliteral">" "</font> + string(args.Filename) + <font class="stringliteral">" "</font> + <a class="code" href="namespaceNLMISC.html#a243">toString</a>(args.Line);
00564 
00565                 <font class="comment">// Check the envvar NEL_IGNORE_ASSERT</font>
00566                 <font class="keywordflow">if</font> (getenv (<font class="stringliteral">"NEL_IGNORE_ASSERT"</font>) == NULL)
00567                 {
00568                         <font class="keywordflow">if</font>  (<a class="code" href="namespaceNLMISC.html#a320a172">ReportDebug</a> == <a class="code" href="namespaceNLMISC.html#a312">report</a> (args.ProcessName + <font class="stringliteral">" NeL "</font> + toString(<a class="code" href="classNLMISC_1_1IDisplayer.html#e0">logTypeToString</a>(args.LogType, <font class="keyword">true</font>)), <font class="stringliteral">""</font>, subject, body, <font class="keyword">true</font>, 2, <font class="keyword">true</font>, 1, <font class="keyword">true</font>, <a class="code" href="classNLMISC_1_1CMsgBoxDisplayer.html#m0">IgnoreNextTime</a>))
00569                         {
00570                                 <a class="code" href="namespaceNLMISC.html#a15">DebugNeedAssert</a> = <font class="keyword">true</font>;
00571                         }
00572                 }
00573 
00574 <font class="comment">/*              // Check the envvar NEL_IGNORE_ASSERT</font>
00575 <font class="comment">                if (getenv ("NEL_IGNORE_ASSERT") == NULL)</font>
00576 <font class="comment">                {</font>
00577 <font class="comment">                        // Ask the user to continue, debug or ignore</font>
00578 <font class="comment">                        int result = MessageBox (NULL, ss2.str().c_str (), logTypeToString(args.LogType, true), MB_ABORTRETRYIGNORE | MB_ICONSTOP);</font>
00579 <font class="comment">                        if (result == IDABORT)</font>
00580 <font class="comment">                        {</font>
00581 <font class="comment">                                // Exit the program now</font>
00582 <font class="comment">                                exit (EXIT_FAILURE);</font>
00583 <font class="comment">                        }</font>
00584 <font class="comment">                        else if (result == IDRETRY)</font>
00585 <font class="comment">                        {</font>
00586 <font class="comment">                                // Give the debugger a try</font>
00587 <font class="comment">                                DebugNeedAssert = true;</font>
00588 <font class="comment">                        }</font>
00589 <font class="comment">                        else if (result == IDIGNORE)</font>
00590 <font class="comment">                        {</font>
00591 <font class="comment">                                // Continue, do nothing</font>
00592 <font class="comment">                        }</font>
00593 <font class="comment">                }</font>
00594 <font class="comment">*/</font>      }
00595 
00596 <font class="preprocessor">#endif</font>
00597 <font class="preprocessor"></font>}
00598 
00599 
00600 
00601 <font class="comment">/***************************************************************/</font>
00602 <font class="comment">/******************* THE FOLLOWING CODE IS COMMENTED OUT *******/</font>
00603 <font class="comment">/***************************************************************</font>
00604 <font class="comment">void CStdDisplayer::display (const std::string&amp; str)</font>
00605 <font class="comment">{</font>
00606 <font class="comment">//      printf("%s", str.c_str ());</font>
00607 <font class="comment">        cout &lt;&lt; str;</font>
00608 <font class="comment"></font>
00609 <font class="comment">#ifdef NL_OS_WINDOWS</font>
00610 <font class="comment">        // display the string in the debugger is the application is started with the debugger</font>
00611 <font class="comment">        if (IsDebuggerPresent ())</font>
00612 <font class="comment">                OutputDebugString(str.c_str ());</font>
00613 <font class="comment">#endif</font>
00614 <font class="comment">}</font>
00615 <font class="comment"></font>
00616 <font class="comment"></font>
00617 <font class="comment">void CFileDisplayer::display (const std::string&amp; str)</font>
00618 <font class="comment">{</font>
00619 <font class="comment">        if (_FileName.size () == 0) return;</font>
00620 <font class="comment"></font>
00621 <font class="comment">        ofstream ofs (_FileName.c_str (), ios::out | ios::app);</font>
00622 <font class="comment">        if (ofs.is_open ())</font>
00623 <font class="comment">        {</font>
00624 <font class="comment">                ofs &lt;&lt; str;</font>
00625 <font class="comment">                ofs.close();</font>
00626 <font class="comment">        }</font>
00627 <font class="comment"></font>
00628 <font class="comment"></font>
00629 <font class="comment">//      FILE *fp = fopen (_FileName.c_str (), "a");</font>
00630 <font class="comment">//      if (fp == NULL) return;</font>
00631 <font class="comment"></font>
00632 <font class="comment">//      fprintf (fp, "%s", str.c_str ());</font>
00633 <font class="comment">        </font>
00634 <font class="comment">//      fclose (fp);</font>
00635 <font class="comment">}</font>
00636 <font class="comment"></font>
00637 <font class="comment"></font>
00638 <font class="comment"></font>
00639 <font class="comment">void CMsgBoxDisplayer::display (const std::string&amp; str)</font>
00640 <font class="comment">{</font>
00641 <font class="comment">#ifdef NL_OS_WINDOWS</font>
00642 <font class="comment"></font>
00643 <font class="comment">        if (OpenClipboard (NULL))</font>
00644 <font class="comment">        {</font>
00645 <font class="comment">                HGLOBAL mem = GlobalAlloc (GHND|GMEM_DDESHARE, str.size()+1);</font>
00646 <font class="comment">                if (mem)</font>
00647 <font class="comment">                {</font>
00648 <font class="comment">                        char *pmem = (char *)GlobalLock (mem);</font>
00649 <font class="comment">                        strcpy (pmem, str.c_str());</font>
00650 <font class="comment">                        GlobalUnlock (mem);</font>
00651 <font class="comment">                        EmptyClipboard ();</font>
00652 <font class="comment">                        SetClipboardData (CF_TEXT, mem);</font>
00653 <font class="comment">                }</font>
00654 <font class="comment">                CloseClipboard ();</font>
00655 <font class="comment">        }</font>
00656 <font class="comment">        </font>
00657 <font class="comment">        string strf = str;</font>
00658 <font class="comment">        strf += "\n\n(this message was copied in the clipboard)";</font>
00659 <font class="comment">        MessageBox (NULL, strf.c_str (), "", MB_OK | MB_ICONEXCLAMATION);</font>
00660 <font class="comment">#endif</font>
00661 <font class="comment">}</font>
00662 <font class="comment">**************************************************************************/</font>
00663 
00664 
00665 } <font class="comment">// NLMISC</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>