0024830: Remove redundant keyword 'mutable' in CDL declarations
[occt.git] / src / IGESSelect / IGESSelect_SignStatus.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 #include <IGESSelect_SignStatus.ixx>
15 #include <IGESData_IGESEntity.hxx>
16 #include <stdio.h>
17
18
19 static char theval[10];
20
21     IGESSelect_SignStatus::IGESSelect_SignStatus ()
22     : IFSelect_Signature ("D.E. Status")    {  }
23
24     Standard_CString  IGESSelect_SignStatus::Value
25   (const Handle(Standard_Transient)& ent,
26    const Handle(Interface_InterfaceModel)& /*model*/) const
27 {
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);
36   return theval;
37 }
38
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
43 {
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();
52   if (nb > 9) nb = 9;
53   for (n = 1; n <= nb; n ++)  theval[n-1] = text.Value(n);
54   theval[nb] = '\0';
55
56   Standard_Integer vir = 0, val = 0;
57   for (n = 0; n < nb; n ++) {
58     char car = theval[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;
67 //    Matches ?
68     if (vir == 0) {  // Blank
69       if (i == val && !exact) return Standard_True;
70       if (i != val &&  exact) return Standard_False;
71     }
72     if (vir == 1) {  // Subord.
73       if (j == val && !exact) return Standard_True;
74       if (j != val &&  exact) return Standard_False;
75     }
76     if (vir == 2) {  // UseFlag
77       if (k == val && !exact) return Standard_True;
78       if (k != val &&  exact) return Standard_False;
79     }
80     if (vir == 3) {  // Hierarchy
81       if (l == val && !exact) return Standard_True;
82       if (l != val &&  exact) return Standard_False;
83     }
84   }
85   return exact;  // un brin de reflexion pour arriver
86 }