0024023: Revamp the OCCT Handle -- general
[occt.git] / src / IFSelect / IFSelect_SignValidity.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14#include <IFSelect_SignValidity.ixx>
15#include <Interface_Check.hxx>
16
17
18static Standard_CString nulsign = "";
19
20
21//=======================================================================
22//function : IFSelect_SignValidity
23//purpose :
24//=======================================================================
25
26IFSelect_SignValidity::IFSelect_SignValidity() : IFSelect_Signature ("Validity")
27{
28 AddCase ("UNKNOWN");
29 AddCase ("UNLOADED");
30 AddCase ("Load-Error");
31 AddCase ("Data-Error");
32 AddCase ("Load-Warning");
33 AddCase ("Data-Warning");
34 AddCase ("OK");
35}
36
37
38//=======================================================================
39//function : CVal
40//purpose :
41//=======================================================================
42
43Standard_CString IFSelect_SignValidity::CVal(const Handle(Standard_Transient)& ent,
44 const Handle(Interface_InterfaceModel)& model)
45{
46 if (ent.IsNull() || model.IsNull()) return nulsign;
47 Standard_Integer num = model->Number(ent);
48 Standard_Integer cas = 0;
49 if (model->IsUnknownEntity(num)) return "UNKNOWN";
50 if (model->IsRedefinedContent(num)) return "UNLOADED";
51
52 const Handle(Interface_Check) ch1 = model->Check(num,Standard_True);
53 const Handle(Interface_Check) ch2 = model->Check(num,Standard_False);
54 if (ch1->NbFails() > 0) return "Load-Error";
55 else if (ch1->NbWarnings() > 0) cas = 1;
56
57 if (ch2->NbFails() > 0) return "Data-Error";
58 else if (cas == 1) return "Load-Warning";
59 else if (ch2->NbWarnings() > 0) return "Data-Warning";
60
61 return "OK";
62}
63
64
65//=======================================================================
66//function : Value
67//purpose :
68//=======================================================================
69
70Standard_CString IFSelect_SignValidity::Value
71 (const Handle(Standard_Transient)& ent,
72 const Handle(Interface_InterfaceModel)& model) const
73{
74 return IFSelect_SignValidity::CVal(ent,model);
75}