1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IFSelect_CheckCounter.hxx>
16 #include <Interface_Check.hxx>
17 #include <Interface_CheckIterator.hxx>
18 #include <Interface_InterfaceModel.hxx>
19 #include <MoniTool_SignText.hxx>
20 #include <Standard_Transient.hxx>
21 #include <Standard_Type.hxx>
24 IMPLEMENT_STANDARD_RTTIEXT(IFSelect_CheckCounter,IFSelect_SignatureList)
26 //=======================================================================
27 //function : IFSelect_CheckCounter
29 //=======================================================================
30 IFSelect_CheckCounter::IFSelect_CheckCounter(const Standard_Boolean withlist)
31 : IFSelect_SignatureList (withlist)
37 //=======================================================================
38 //function : SetSignature
40 //=======================================================================
42 void IFSelect_CheckCounter::SetSignature(const Handle(MoniTool_SignText)& sign)
48 //=======================================================================
49 //function : Signature
51 //=======================================================================
53 Handle(MoniTool_SignText) IFSelect_CheckCounter::Signature () const
59 //=======================================================================
62 //=======================================================================
64 void IFSelect_CheckCounter::Analyse(const Interface_CheckIterator& list,
65 const Handle(Interface_InterfaceModel)& model,
66 const Standard_Boolean original,
67 const Standard_Boolean failsonly)
69 Standard_Integer i,nb,num, nbe = (model.IsNull() ? 0 : model->NbEntities());
71 sprintf (mess,"Check %s",list.Name());
73 for (list.Start(); list.More(); list.Next()) {
75 Handle(Standard_Transient) ent;
76 const Handle(Interface_Check) check = list.Value();
77 ent = check->Entity();
78 if (ent.IsNull() && num > 0 && num <= nbe) ent = model->Value(num);
79 nb = check->NbFails();
80 Standard_CString tystr = NULL;
82 if (!thesign.IsNull()) tystr = thesign->Text (ent,model).ToCString();
83 else if (!model.IsNull()) tystr = model->TypeName (ent);
85 Interface_InterfaceModel::ClassName(ent->DynamicType()->Name());
87 for (i = 1; i <= nb; i ++) {
88 if (ent.IsNull()) sprintf(mess,"F: %s",check->CFail(i,original));
89 else sprintf(mess,"F:%s: %s",tystr,check->CFail(i,original));
93 if (!failsonly) nb = check->NbWarnings();
94 for (i = 1; i <= nb; i ++) {
95 if (ent.IsNull()) sprintf(mess,"W: %s",check->CWarning(i,original));
96 else sprintf(mess,"W:%s: %s",tystr,check->CWarning(i,original));