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.
14 #include <IGESSelect_SignStatus.ixx>
15 #include <IGESData_IGESEntity.hxx>
19 static char theval[10];
21 IGESSelect_SignStatus::IGESSelect_SignStatus ()
22 : IFSelect_Signature ("D.E. Status") { }
24 Standard_CString IGESSelect_SignStatus::Value
25 (const Handle(Standard_Transient)& ent,
26 const Handle(Interface_InterfaceModel)& /*model*/) const
28 Handle(IGESData_IGESEntity) igesent = Handle(IGESData_IGESEntity)::DownCast(ent);
29 if (igesent.IsNull()) return "";
30 Standard_Integer i,j,k,l;
31 i = igesent->BlankStatus ();
32 j = igesent->SubordinateStatus ();
33 k = igesent->UseFlag ();
34 l = igesent->HierarchyStatus ();
35 sprintf (theval,"%d,%d,%d,%d",i,j,k,l);
39 Standard_Boolean IGESSelect_SignStatus::Matches
40 (const Handle(Standard_Transient)& ent,
41 const Handle(Interface_InterfaceModel)& /*model*/,
42 const TCollection_AsciiString& text, const Standard_Boolean exact) const
44 Handle(IGESData_IGESEntity) igesent = Handle(IGESData_IGESEntity)::DownCast(ent);
45 if (igesent.IsNull()) return Standard_False;
46 Standard_Integer i,j,k,l;
47 i = igesent->BlankStatus ();
48 j = igesent->SubordinateStatus ();
49 k = igesent->UseFlag ();
50 l = igesent->HierarchyStatus ();
51 Standard_Integer n,nb = text.Length();
53 for (n = 1; n <= nb; n ++) theval[n-1] = text.Value(n);
56 Standard_Integer vir = 0, val = 0;
57 for (n = 0; n < nb; n ++) {
59 if (car == ',') { vir ++; continue; }
60 val = Standard_Integer (car-48);
61 if (car == 'V' && vir == 0) val = 0;
62 if (car == 'B' && vir == 0) val = 1;
63 if (car == 'I' && vir == 1) val = 0;
64 if (car == 'P' && vir == 1) val = 1;
65 if (car == 'L' && vir == 1) val = 2;
66 if (car == 'D' && vir == 1) val = 3;
68 if (vir == 0) { // Blank
69 if (i == val && !exact) return Standard_True;
70 if (i != val && exact) return Standard_False;
72 if (vir == 1) { // Subord.
73 if (j == val && !exact) return Standard_True;
74 if (j != val && exact) return Standard_False;
76 if (vir == 2) { // UseFlag
77 if (k == val && !exact) return Standard_True;
78 if (k != val && exact) return Standard_False;
80 if (vir == 3) { // Hierarchy
81 if (l == val && !exact) return Standard_True;
82 if (l != val && exact) return Standard_False;
85 return exact; // un brin de reflexion pour arriver