a54d5be7a8c98678e6742b491a3b5d3ecb4f80d6
[occt.git] / src / Interface / Interface_Check.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Interface_Check.hxx>
16 #include <Message.hxx>
17 #include <Message_Messenger.hxx>
18 #include <Message_Msg.hxx>
19 #include <Standard_OutOfRange.hxx>
20 #include <Standard_Transient.hxx>
21 #include <Standard_Type.hxx>
22 #include <TCollection_HAsciiString.hxx>
23
24 IMPLEMENT_STANDARD_RTTIEXT(Interface_Check,Standard_Transient)
25
26 // Un Check est cree au depart sans liste de message : celle ci est creee
27 // seulement si au moins une erreur doit y etre enregitree (Fail-Warning)
28 //=======================================================================
29 //function : Interface_Check
30 //purpose  : 
31 //=======================================================================
32 Interface_Check::Interface_Check()
33 {
34 }    // construit a vide
35
36
37 //=======================================================================
38 //function : Interface_Check
39 //purpose  : 
40 //=======================================================================
41
42 Interface_Check::Interface_Check(const Handle(Standard_Transient)& anentity)
43 {
44   theent = anentity;
45 }
46
47 // ....      Ajout de message d Erreur vraie (Fail)
48
49
50 //=======================================================================
51 //function : SendFail
52 //purpose  : 
53 //=======================================================================
54
55 void Interface_Check::SendFail(const Message_Msg& amsg)
56 {
57   AddFail (amsg);
58 }
59
60
61 //=======================================================================
62 //function : AddFail
63 //purpose  : 
64 //=======================================================================
65
66 void Interface_Check::AddFail (const Handle(TCollection_HAsciiString)& mess)
67 {
68   if (thefails.IsNull()) thefails = new TColStd_HSequenceOfHAsciiString();
69   if (thefailo.IsNull()) thefailo = new TColStd_HSequenceOfHAsciiString();
70   thefails->Append(mess);  thefailo->Append(mess);
71 }
72
73
74 //=======================================================================
75 //function : AddFail
76 //purpose  : 
77 //=======================================================================
78
79 void Interface_Check::AddFail(const Handle(TCollection_HAsciiString)& mess,
80                               const Handle(TCollection_HAsciiString)& orig)
81 {
82   if (thefails.IsNull()) thefails = new TColStd_HSequenceOfHAsciiString();
83   if (thefailo.IsNull()) thefailo = new TColStd_HSequenceOfHAsciiString();
84   thefails->Append(mess);  thefailo->Append(orig);
85 }
86
87
88 //=======================================================================
89 //function : AddFail
90 //purpose  : 
91 //=======================================================================
92
93 void Interface_Check::AddFail(const Standard_CString amess,
94                               const Standard_CString orig)
95 {
96   if (amess[0] == '\0') return;
97   if (!orig || orig[0] == '\0') AddFail (new TCollection_HAsciiString(amess));
98   else AddFail (new TCollection_HAsciiString(amess),
99                 new TCollection_HAsciiString(orig) );
100 }
101
102
103 //=======================================================================
104 //function : AddFail
105 //purpose  : 
106 //=======================================================================
107
108 void Interface_Check::AddFail(const Message_Msg& amsg)
109 {
110   if (amsg.IsEdited()) AddFail (new TCollection_HAsciiString(TCollection_AsciiString(amsg.Value())),
111                                 new TCollection_HAsciiString(TCollection_AsciiString(amsg.Original())));
112   else AddFail (new TCollection_HAsciiString(TCollection_AsciiString(amsg.Value())));
113 }
114
115
116 //=======================================================================
117 //function : HasFailed
118 //purpose  : 
119 //=======================================================================
120
121 Standard_Boolean Interface_Check::HasFailed () const
122 {
123   return (!thefails.IsNull());
124 }
125
126
127 //=======================================================================
128 //function : NbFails
129 //purpose  : 
130 //=======================================================================
131
132 Standard_Integer Interface_Check::NbFails () const
133 {
134   return (thefails.IsNull() ? 0 : thefails->Length());
135 }
136
137
138 //=======================================================================
139 //function : Fail
140 //purpose  : 
141 //=======================================================================
142
143 const Handle(TCollection_HAsciiString)& Interface_Check::Fail
144        (const Standard_Integer num, const Standard_Boolean final) const
145 {
146   if (thefails.IsNull()) throw Standard_OutOfRange();
147   return (final ? thefails->Value(num) : thefailo->Value(num));
148 }
149
150
151 //=======================================================================
152 //function : CFail
153 //purpose  : 
154 //=======================================================================
155
156 Standard_CString Interface_Check::CFail(const Standard_Integer num,
157                                         const Standard_Boolean final) const
158 {
159   return Fail(num,final)->ToCString();
160 }
161
162
163 //=======================================================================
164 //function : Fails
165 //purpose  : 
166 //=======================================================================
167
168 Handle(TColStd_HSequenceOfHAsciiString) Interface_Check::Fails
169        (const Standard_Boolean final) const
170 {
171   if (thefails.IsNull()) return new TColStd_HSequenceOfHAsciiString();
172   return (final ? thefails : thefailo);
173 }
174
175 //  ....        Ajout de message de Warning
176
177
178 //=======================================================================
179 //function : SendWarning
180 //purpose  : 
181 //=======================================================================
182
183 void Interface_Check::SendWarning(const Message_Msg& amsg)
184 {
185   AddWarning (amsg);
186 }
187
188
189 //=======================================================================
190 //function : AddWarning
191 //purpose  : 
192 //=======================================================================
193
194 void Interface_Check::AddWarning (const Handle(TCollection_HAsciiString)& mess)
195 {
196   if (thewarns.IsNull()) thewarns = new TColStd_HSequenceOfHAsciiString();
197   if (thewarno.IsNull()) thewarno = new TColStd_HSequenceOfHAsciiString();
198   thewarns->Append(mess);  thewarno->Append(mess);
199 }
200
201
202 //=======================================================================
203 //function : AddWarning
204 //purpose  : 
205 //=======================================================================
206
207 void Interface_Check::AddWarning(const Handle(TCollection_HAsciiString)& mess,
208                                  const Handle(TCollection_HAsciiString)& orig)
209 {
210   if (thewarns.IsNull()) thewarns = new TColStd_HSequenceOfHAsciiString();
211   if (thewarno.IsNull()) thewarno = new TColStd_HSequenceOfHAsciiString();
212   thewarns->Append(mess);  thewarno->Append(orig);
213 }
214
215
216 //=======================================================================
217 //function : AddWarning
218 //purpose  : 
219 //=======================================================================
220
221 void Interface_Check::AddWarning(const Standard_CString amess,
222                                  const Standard_CString orig)
223 {
224   if (amess[0] == '\0') return;
225   if (!orig || orig[0] == '\0') AddWarning (new TCollection_HAsciiString(amess));
226   else AddWarning (new TCollection_HAsciiString(amess),
227                    new TCollection_HAsciiString(orig) );
228 }
229
230
231 //=======================================================================
232 //function : AddWarning
233 //purpose  : 
234 //=======================================================================
235
236 void Interface_Check::AddWarning(const Message_Msg& amsg)
237 {
238   if (amsg.IsEdited()) AddWarning (new TCollection_HAsciiString(TCollection_AsciiString(amsg.Value())),
239                                    new TCollection_HAsciiString(TCollection_AsciiString(amsg.Original())));
240   else AddWarning (new TCollection_HAsciiString(TCollection_AsciiString(amsg.Value())));
241 }
242
243
244 //=======================================================================
245 //function : HasWarnings
246 //purpose  : 
247 //=======================================================================
248
249 Standard_Boolean Interface_Check::HasWarnings () const
250 {
251   return (!thewarns.IsNull());
252 }
253
254
255 //=======================================================================
256 //function : NbWarnings
257 //purpose  : 
258 //=======================================================================
259
260 Standard_Integer Interface_Check::NbWarnings () const
261 {
262   return (thewarns.IsNull() ? 0 : thewarns->Length());
263 }
264
265
266 //=======================================================================
267 //function : Warning
268 //purpose  : 
269 //=======================================================================
270
271 const Handle(TCollection_HAsciiString)& Interface_Check::Warning
272        (const Standard_Integer num, const Standard_Boolean final) const
273 {
274   if (thewarns.IsNull()) throw Standard_OutOfRange();
275   return (final ? thewarns->Value(num) : thewarno->Value(num));
276 }
277
278
279 //=======================================================================
280 //function : CWarning
281 //purpose  : 
282 //=======================================================================
283
284 Standard_CString Interface_Check::CWarning(const Standard_Integer num,
285                                            const Standard_Boolean final) const
286 {
287   return Warning(num,final)->ToCString();
288 }
289
290
291 //=======================================================================
292 //function : Warnings
293 //purpose  : 
294 //=======================================================================
295
296 Handle(TColStd_HSequenceOfHAsciiString) Interface_Check::Warnings
297        (const Standard_Boolean final) const
298 {
299   if (thewarns.IsNull()) return new TColStd_HSequenceOfHAsciiString();
300   return (final ? thewarns : thewarno);
301 }
302
303
304 //  ....        Ajout de message d Info simple (not yet completed)
305
306
307 //=======================================================================
308 //function : SendMsg
309 //purpose  : 
310 //=======================================================================
311
312 void Interface_Check::SendMsg (const Message_Msg& amsg)
313 {
314   Handle(TCollection_HAsciiString) mess =
315     new TCollection_HAsciiString (amsg.Value());
316   Handle(TCollection_HAsciiString) orig = mess;
317   if (amsg.IsEdited()) orig = new TCollection_HAsciiString (amsg.Original());
318
319   if (theinfos.IsNull()) theinfos = new TColStd_HSequenceOfHAsciiString();
320   if (theinfoo.IsNull()) theinfoo = new TColStd_HSequenceOfHAsciiString();
321   theinfos->Append(mess);  theinfoo->Append(mess);
322 }
323
324
325 //=======================================================================
326 //function : NbInfoMsgs
327 //purpose  : 
328 //=======================================================================
329
330 Standard_Integer Interface_Check::NbInfoMsgs () const
331 {
332   return (theinfos.IsNull() ? 0 : theinfos->Length());
333 }
334
335
336 //=======================================================================
337 //function : InfoMsg
338 //purpose  : 
339 //=======================================================================
340
341 const Handle(TCollection_HAsciiString)& Interface_Check::InfoMsg
342   (const Standard_Integer num, const Standard_Boolean final) const
343 {
344   if (theinfos.IsNull()) throw Standard_OutOfRange();
345   return (final ? theinfos->Value(num) : theinfoo->Value(num));
346 }
347
348
349 //=======================================================================
350 //function : CInfoMsg
351 //purpose  : 
352 //=======================================================================
353
354 Standard_CString Interface_Check::CInfoMsg
355   (const Standard_Integer num, const Standard_Boolean final) const
356 {
357   return InfoMsg(num,final)->ToCString();
358 }
359
360
361 //=======================================================================
362 //function : InfoMsgs
363 //purpose  : 
364 //=======================================================================
365
366 Handle(TColStd_HSequenceOfHAsciiString) Interface_Check::InfoMsgs
367   (const Standard_Boolean final) const
368 {
369   if (theinfos.IsNull()) return new TColStd_HSequenceOfHAsciiString();
370   return (final ? theinfos : theinfoo);
371 }
372
373
374 //    ....  Gestion generale
375
376
377 //=======================================================================
378 //function : Status
379 //purpose  : 
380 //=======================================================================
381
382 Interface_CheckStatus Interface_Check::Status () const
383 {
384   if (!thefails.IsNull()) return Interface_CheckFail;
385   if (!thewarns.IsNull()) return Interface_CheckWarning;
386   return Interface_CheckOK;
387 }
388
389
390 //=======================================================================
391 //function : Complies
392 //purpose  : 
393 //=======================================================================
394
395 Standard_Boolean  Interface_Check::Complies(const Interface_CheckStatus status) const
396 {
397   Standard_Boolean now = thewarns.IsNull();
398   Standard_Boolean nof = thefails.IsNull();
399   switch (status) {
400   case Interface_CheckOK      :  return ( nof &&  now);
401   case Interface_CheckWarning :  return ( nof && !now);
402   case Interface_CheckFail    :  return  !nof;
403   case Interface_CheckAny     :  return Standard_True;
404   case Interface_CheckMessage :  return (!nof || !now);
405   case Interface_CheckNoFail  :  return   nof;
406   default                     :  break;
407   }
408   return Standard_False;
409 }
410
411
412 //=======================================================================
413 //function : Complies
414 //purpose  : 
415 //=======================================================================
416
417 Standard_Boolean Interface_Check::Complies(const Handle(TCollection_HAsciiString)& mess,
418                                            const Standard_Integer incl,
419                                            const Interface_CheckStatus status) const
420 {
421   if (mess.IsNull()) return Standard_False;
422   Standard_Integer lng = mess->Length();
423   if (status == Interface_CheckWarning || status == Interface_CheckAny) {
424     Standard_Integer i, nb = NbWarnings();
425     for (i = nb; i > 0; i --) {
426       Handle(TCollection_HAsciiString) ames = Warning(i);
427       if (incl == 0)  {  if (mess->IsSameString (ames)) return Standard_True;  }
428       if (incl <  0)  {  if (ames->Location(mess,1,ames->Length()) > 0) return Standard_True;  }
429       if (incl <  0)  {  if (mess->Location(mess,1,lng) > 0) return Standard_True;  }
430     }
431   }
432   if (status == Interface_CheckFail || status == Interface_CheckAny) {
433     Standard_Integer i, nb = NbWarnings();
434     for (i = nb; i > 0; i --) {
435       Handle(TCollection_HAsciiString) ames = Warning(i);
436       if (incl == 0)  {  if (mess->IsSameString (ames)) return Standard_True;  }
437       if (incl <  0)  {  if (ames->Location(mess,1,ames->Length()) > 0) return Standard_True;  }
438       if (incl <  0)  {  if (mess->Location(mess,1,lng) > 0) return Standard_True;  }
439     }
440   }
441   return Standard_False;
442 }
443
444
445 //=======================================================================
446 //function : HasEntity
447 //purpose  : 
448 //=======================================================================
449
450 Standard_Boolean Interface_Check::HasEntity () const
451 {
452   return (!theent.IsNull());
453 }
454
455
456 //=======================================================================
457 //function : Entity
458 //purpose  : 
459 //=======================================================================
460
461 const Handle(Standard_Transient)& Interface_Check::Entity () const
462 {
463   return theent;
464 }
465
466
467 //=======================================================================
468 //function : Clear
469 //purpose  : 
470 //=======================================================================
471
472 void Interface_Check::Clear ()
473 {
474   thefails.Nullify();  thefailo.Nullify();
475   thewarns.Nullify();  thewarno.Nullify();
476   theinfos.Nullify();  theinfoo.Nullify();
477   theent.Nullify();
478 }
479
480
481 //=======================================================================
482 //function : ClearFails
483 //purpose  : 
484 //=======================================================================
485
486 void Interface_Check::ClearFails ()
487 {
488   thefails.Nullify();
489   thefailo.Nullify();
490 }
491
492
493 //=======================================================================
494 //function : ClearWarnings
495 //purpose  : 
496 //=======================================================================
497
498 void Interface_Check::ClearWarnings ()
499 {
500   thewarns.Nullify();
501   thewarno.Nullify();
502 }
503
504
505 //=======================================================================
506 //function : ClearInfoMsgs
507 //purpose  : 
508 //=======================================================================
509
510 void Interface_Check::ClearInfoMsgs ()
511 {
512   theinfos.Nullify();
513   theinfoo.Nullify();
514 }
515
516
517
518 //=======================================================================
519 //function : Remove
520 //purpose  : 
521 //=======================================================================
522
523 Standard_Boolean Interface_Check::Remove(const Handle(TCollection_HAsciiString)& mess,
524                                          const Standard_Integer incl,
525                                          const Interface_CheckStatus status)
526 {
527   if (mess.IsNull()) return Standard_False;
528   Standard_Boolean res = Standard_False;
529   Standard_Integer lng = mess->Length();
530   if (status == Interface_CheckWarning || status == Interface_CheckAny) {
531     Standard_Integer i, nb = NbWarnings();
532     for (i = nb; i > 0; i --) {
533       Standard_Boolean rem = Standard_False;
534       Handle(TCollection_HAsciiString) ames = Warning(i);
535       if (incl == 0)  rem = mess->IsSameString (ames);
536       if (incl <  0)  rem = (ames->Location(mess,1,ames->Length()) > 0);
537       if (incl <  0)  rem = (mess->Location(mess,1,lng) > 0);
538       if (rem)  {  thewarns->Remove(i);  thewarno->Remove(i);  res = rem;  }
539     }
540   }
541   if (status == Interface_CheckFail || status == Interface_CheckAny) {
542     Standard_Integer i, nb = NbWarnings();
543     for (i = nb; i > 0; i --) {
544       Standard_Boolean rem = Standard_False;
545       Handle(TCollection_HAsciiString) ames = Warning(i);
546       if (incl == 0)  rem = mess->IsSameString (ames);
547       if (incl <  0)  rem = (ames->Location(mess,1,ames->Length()) > 0);
548       if (incl <  0)  rem = (mess->Location(mess,1,lng) > 0);
549       if (rem)  {  thefails->Remove(i);  thefailo->Remove(i);  res = rem;  }
550     }
551   }
552   return res;
553 }
554
555
556 //=======================================================================
557 //function : Mend
558 //purpose  : 
559 //=======================================================================
560
561 Standard_Boolean  Interface_Check::Mend(const Standard_CString pref,
562                                         const Standard_Integer num)
563 {
564   Standard_Integer i, n1 = num, n2 = num;
565   if (pref && pref[2] == '\0') {
566     if (pref[0] == 'F' && pref[1] == 'M') return Mend ("Mended",num);
567     if (pref[0] == 'C' && pref[1] == 'A') {  Clear();  return Standard_True;  }
568     if (pref[0] == 'C' && pref[1] == 'W') {
569       if (num == 0)  {  ClearWarnings();  return Standard_True;  }
570       if (num < 0 || num > NbWarnings())  return Standard_False;
571       thewarns->Remove(num);  thewarno->Remove(num);
572       return Standard_True;
573     }
574     if (pref[0] == 'C' && pref[1] == 'F') {
575       if (num == 0)  {  ClearFails();  return Standard_True;  }
576       if (num < 0 || num > NbFails())  return Standard_False;
577       thefails->Remove(num);  thefailo->Remove(num);
578       return Standard_True;
579     }
580   }
581   //  Cas courant
582   if (num == 0)  {
583     n1 = 1;  n2 = NbFails();
584     for (i = n2; i >= n1; i --) Mend (pref,i);
585     return Standard_True;
586   }
587   else if (num < 0 || num > NbFails()) return Standard_False;
588   //  Un message
589   Handle(TCollection_HAsciiString) strf = thefails->Value(num);
590   Handle(TCollection_HAsciiString) stro = thefailo->Value(num);
591   if (pref && pref[0] != '\0') {
592     strf->Insert (1," : ");  strf->Insert (1,pref);
593     if (stro != strf)  {     stro->Insert (1," : ");  stro->Insert (1,pref);  }
594   }
595   thefails->Remove(num);  thefailo->Remove(num);
596   if (stro == strf)  AddFail (strf);
597   else               AddFail (strf,stro);
598   return Standard_True;
599 }
600
601
602 //=======================================================================
603 //function : SetEntity
604 //purpose  : 
605 //=======================================================================
606
607 void Interface_Check::SetEntity(const Handle(Standard_Transient)& anentity)
608 {
609   theent = anentity;
610 }
611
612
613 //=======================================================================
614 //function : GetEntity
615 //purpose  : 
616 //=======================================================================
617
618 void Interface_Check::GetEntity(const Handle(Standard_Transient)& anentity)
619 {
620   if (theent.IsNull()) SetEntity(anentity);
621 }
622
623 // .. GetMessages, reprend les messages en les cumulant aux siens propres
624 // .. GetAsWarning, reprend les messages en les cumulant et en les
625 //    considerant tous comme "Warning" . En outre, selon <failsonly>
626 //      failsonly True  : ne pas reprendre les Warnings originaux
627 //      failsonly False : les prendre aussi
628
629
630 //=======================================================================
631 //function : GetMessages
632 //purpose  : 
633 //=======================================================================
634
635 void Interface_Check::GetMessages (const Handle(Interface_Check)& other)
636 {
637   Standard_Integer nb,i;
638   if ( (nb = other->NbFails()) != 0) {
639     if (thefails.IsNull()) thefails = new TColStd_HSequenceOfHAsciiString();
640     if (thefailo.IsNull()) thefailo = new TColStd_HSequenceOfHAsciiString();
641     for (i = 1; i <= nb; i ++) thefails->Append(other->Fail(i,Standard_True));
642     for (i = 1; i <= nb; i ++) thefailo->Append(other->Fail(i,Standard_False));
643   }
644   if ( (nb = other->NbWarnings()) != 0) {
645     if (thewarns.IsNull()) thewarns = new TColStd_HSequenceOfHAsciiString();
646     if (thewarno.IsNull()) thewarno = new TColStd_HSequenceOfHAsciiString();
647     for (i = 1; i <= nb; i ++) thewarns->Append(other->Warning(i,Standard_True));
648     for (i = 1; i <= nb; i ++) thewarno->Append(other->Warning(i,Standard_False));
649   }
650   if ( (nb = other->NbInfoMsgs()) != 0) {
651     if (theinfos.IsNull()) theinfos = new TColStd_HSequenceOfHAsciiString();
652     if (theinfoo.IsNull()) theinfoo = new TColStd_HSequenceOfHAsciiString();
653     for (i = 1; i <= nb; i ++) theinfos->Append(other->InfoMsg(i,Standard_True));
654     for (i = 1; i <= nb; i ++) theinfoo->Append(other->InfoMsg(i,Standard_False));
655   }
656 }
657
658
659 //=======================================================================
660 //function : GetAsWarning
661 //purpose  : 
662 //=======================================================================
663
664 void Interface_Check::GetAsWarning(const Handle(Interface_Check)& other,
665                                    const Standard_Boolean failsonly)
666 {
667   Standard_Integer nb,i;
668   if ( (nb = other->NbFails()) != 0) {
669     if (thewarns.IsNull()) thewarns = new TColStd_HSequenceOfHAsciiString();
670     if (thewarno.IsNull()) thewarno = new TColStd_HSequenceOfHAsciiString();
671     for (i = 1; i <= nb; i ++) thewarns->Append(other->Fail(i,Standard_True));
672     for (i = 1; i <= nb; i ++) thewarno->Append(other->Fail(i,Standard_False));
673   }
674   if ( (nb = other->NbWarnings()) != 0 || !failsonly) {
675     if (thewarns.IsNull()) thewarns = new TColStd_HSequenceOfHAsciiString();
676     if (thewarno.IsNull()) thewarno = new TColStd_HSequenceOfHAsciiString();
677     for (i = 1; i <= nb; i ++) thewarns->Append(other->Warning(i,Standard_True));
678     for (i = 1; i <= nb; i ++) thewarno->Append(other->Warning(i,Standard_False));
679   }
680 }
681
682
683 //=======================================================================
684 //function : Print
685 //purpose  : 
686 //=======================================================================
687
688 void Interface_Check::Print(const Handle(Message_Messenger)& S, const Standard_Integer level,
689                             const Standard_Integer final) const
690 {
691   Standard_Integer j, nb = NbFails();
692
693   if (level >= 1) {
694     nb = NbFails();
695 //    if (nb > 0) S<<" -->   Fails    : "<<nb<<std::endl;
696     for (j = 1; j <= nb; j ++) {
697       if (final >= 0) 
698         S<<CFail(j,Standard_True)<<"\n";
699       else
700         S<<CFail(j,Standard_False)<<"\n";
701 //      if (final == 0)
702 //      if (Fail(j,Standard_True) != Fail(j,Standard_False))
703 //        S<<"[original:"<<CFail(j,Standard_False)<<"]\n";
704     }
705   }
706
707   if (level >= 2) {
708     nb = NbWarnings();
709 //    if (nb > 0) S<<" -->   Warnings : "<<nb<<std::endl;
710     for (j = 1; j <= nb; j ++) {
711       if (final >= 0)
712         S<<CWarning(j,Standard_True)<<"\n";
713       else
714         S<<CWarning(j,Standard_False)<<"\n";
715 //      if (final == 0)
716 //      if (Warning(j,Standard_True) != Warning(j,Standard_False))
717 //        S<<"[original:"<<CWarning(j,Standard_False)<<"]\n";
718     }
719   }
720
721 //   InfoMsg : regle causant (user message)
722   if (level >= 0) {
723     nb = NbInfoMsgs();
724 //    if (nb > 0) S<<" -->   Infos    : "<<nb<<std::endl;
725     for (j = 1; j <= nb; j ++) {
726       if (final >= 0) 
727         S<<CInfoMsg(j,Standard_True)<<"\n";
728       else
729         S<<CInfoMsg(j,Standard_False)<<"\n";
730 //      if (final == 0)
731 //      if (InfoMsg(j,Standard_True) != InfoMsg(j,Standard_False))
732 //        S<<"[original:"<<CInfoMsg(j,Standard_False)<<"]\n";
733     }
734   }
735
736 }
737
738
739 //=======================================================================
740 //function : Trace
741 //purpose  : 
742 //=======================================================================
743
744 void Interface_Check::Trace(const Standard_Integer level,
745                             const Standard_Integer final) const
746 {
747   Print (Message::DefaultMessenger(), level, final);
748 }