b311480e |
1 | -- Created on: 1997-01-03 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
8 | -- This library is free software; you can redistribute it and/or modify it under |
9 | -- the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | -- by the Free Software Foundation, with special exception defined in the file |
11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | -- distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class PDescr from StepData inherits TShared |
18 | |
19 | ---Purpose : This class is intended to describe the authorized form for a |
20 | -- parameter, as a type or a value for a field |
21 | -- |
22 | -- A PDescr firstly describes a type, which can be SELECT, i.e. |
23 | -- have several members |
24 | |
25 | uses CString, Type from Standard, AsciiString from TCollection, |
26 | Check from Interface, |
27 | EnumTool from StepData, Field from StepData, EDescr from StepData |
28 | |
29 | is |
30 | |
31 | Create returns PDescr; |
32 | |
33 | SetName (me : mutable; name : CString); |
34 | Name (me) returns CString; |
35 | |
36 | -- basic settings |
37 | |
38 | Kind (me) returns Integer is private; |
39 | |
40 | SetSelect (me : mutable); |
41 | ---Purpose : Declares this PDescr to be a Select, hence to have members |
42 | -- <me> itself can be the first member |
43 | |
44 | AddMember (me : mutable; member : PDescr); |
45 | ---Purpose : Adds a member to a SELECT description |
46 | |
47 | SetMemberName (me : mutable; memname : CString); |
48 | ---Purpose : Sets a name for SELECT member. To be used if a member is for |
49 | -- an immediate type |
50 | |
51 | SetInteger (me : mutable); |
52 | ---Purpose : Sets <me> for an Integer value |
53 | |
54 | SetReal (me : mutable); |
55 | ---Purpose : Sets <me> for a Real value |
56 | |
57 | SetString (me : mutable); |
58 | ---Purpose : Sets <me> for a String value |
59 | |
60 | SetBoolean (me : mutable); |
61 | ---Purpose : Sets <me> for a Boolean value (false,true) |
62 | |
63 | SetLogical (me : mutable); |
64 | ---Purpose : Sets <me> for a Logical value (false,true,unknown) |
65 | |
66 | SetEnum (me : mutable); |
67 | ---Purpose : Sets <me> for an Enum value |
68 | -- Then, call AddEnumDef ordered from the first one (value 0) |
69 | |
70 | AddEnumDef (me : mutable; enumdef : CString); |
71 | ---Purpose : Adds an enum value as a string |
72 | |
73 | SetType (me : mutable; atype : Type from Standard); |
74 | ---Purpose : Sets <me> for an Entity which must match a Type (early-bound) |
75 | |
76 | SetDescr (me : mutable; dscnam : CString); |
77 | ---Purpose : Sets <me> for a Described Entity, whose Description must match |
78 | -- the type name <dscnam> |
79 | |
80 | AddArity (me : mutable; arity : Integer = 1); |
81 | ---Purpose : Adds an arity count to <me>, by default 1 |
82 | -- 1 : a simple field passes to a LIST/ARRAY etc |
83 | -- or a LIST to a LIST OF LIST |
84 | -- 2 : a simple field passes to a LIST OF LIST |
85 | |
86 | SetArity (me : mutable; arity : Integer = 1); |
87 | ---Purpose : Directly sets the arity count |
88 | -- 0 : simple field |
89 | -- 1 : LIST or ARRAY etc |
90 | -- 2 : LIST OF LIST |
91 | |
92 | -- complements |
93 | |
94 | SetFrom (me : mutable; other : PDescr); |
95 | ---Purpose : Sets <me> as <other> but duplicated |
96 | -- Hence, some definition may be changed |
97 | |
98 | SetOptional (me : mutable; opt : Boolean = Standard_True); |
99 | ---Purpose : Sets/Unsets <me> to accept undefined values |
100 | |
101 | SetDerived (me : mutable; der : Boolean = Standard_True); |
102 | ---Purpose : Sets/Unsets <me> to be for a derived field |
103 | |
104 | SetField (me : mutable; name : CString; rank : Integer); |
105 | ---Purpose : Sets <me> to describe a field of an entity |
106 | -- With a name and a rank |
107 | |
108 | -- querying |
109 | |
110 | IsSelect (me) returns Boolean; |
111 | ---Purpose : Tells if <me> is for a SELECT |
112 | |
113 | Member (me; name : CString) returns PDescr; |
114 | ---Purpose : For a SELECT, returns the member whose name matches <name> |
115 | -- To this member, the following question can then be asked |
116 | -- Null Handle if <name> not matched or <me> not a SELECT |
117 | -- |
118 | -- Remark : not to be asked for an entity type |
119 | -- Hence, following IsInteger .. Enum* only apply on <me> and |
120 | -- require Member |
121 | -- While IsType applies on <me> and all Select Members |
122 | |
123 | IsInteger (me) returns Boolean; |
124 | ---Purpose : Tells if <me> is for an Integer |
125 | |
126 | IsReal (me) returns Boolean; |
127 | ---Purpose : Tells if <me> is for a Real value |
128 | |
129 | IsString (me) returns Boolean; |
130 | ---Purpose : Tells if <me> is for a String value |
131 | |
132 | IsBoolean (me) returns Boolean; |
133 | ---Purpose : Tells if <me> is for a Boolean value (false,true) |
134 | |
135 | IsLogical (me) returns Boolean; |
136 | ---Purpose : Tells if <me> is for a Logical value (false,true,unknown) |
137 | |
138 | IsEnum (me) returns Boolean; |
139 | ---Purpose : Tells if <me> is for an Enum value |
140 | -- Then, call AddEnumDef ordered from the first one (value 0) |
141 | -- Managed by an EnumTool |
142 | |
143 | EnumMax (me) returns Integer; |
144 | ---Purpose : Returns the maximum integer for a suitable value (count - 1) |
145 | |
146 | EnumValue (me; name : CString) returns Integer; |
147 | ---Purpose : Returns the numeric value found for an enum text |
148 | -- The text must be in capitals and limited by dots |
149 | -- A non-suitable text gives a negative value to be returned |
150 | |
151 | EnumText (me; val : Integer) returns CString; |
152 | ---Purpose : Returns the text which corresponds to a numeric value, |
153 | -- between 0 and EnumMax. It is limited by dots |
154 | |
155 | IsEntity (me) returns Boolean; |
156 | ---Purpose : Tells if <me> is for an Entity, either Described or CDL Type |
157 | |
158 | IsType (me; atype : Type from Standard) returns Boolean; |
159 | ---Purpose : Tells if <me> is for an entity of a given CDL type (early-bnd) |
160 | -- (works for <me> + nexts if <me> is a Select) |
161 | |
162 | Type (me) returns Type from Standard; |
163 | ---Purpose : Returns the type to match (IsKind), for a CDL Entity |
164 | -- (else, null handle) |
165 | |
166 | IsDescr (me; descr : EDescr from StepData) returns Boolean; |
167 | ---Purpose : Tells if <me> is for a Described entity of a given EDescr |
168 | -- (does this EDescr match description name ?). For late-bnd |
169 | -- (works for <me> + nexts if <me> is a Select) |
170 | |
171 | DescrName (me) returns CString; |
172 | ---Purpose : Returns the description (type name) to match, for a Described |
173 | -- (else, empty string) |
174 | |
175 | Arity (me) returns Integer; |
176 | ---Purpose : Returns the arity of <me> |
177 | |
178 | Simple (me) returns PDescr; |
179 | ---Purpose : For a LIST or LIST OF LIST, Returns the PDescr for the simpler |
180 | -- PDescr. Else, returns <me> |
181 | -- This allows to have different attributes for Optional for |
182 | -- instance, on a field, and on the parameter of a LIST : |
183 | -- [OPTIONAL] LIST OF [OPTIONAL] ... |
184 | |
185 | IsOptional (me) returns Boolean; |
186 | ---Purpose : Tells if <me> is Optional |
187 | |
188 | IsDerived (me) returns Boolean; |
189 | ---Purpose : Tells if <me> is Derived |
190 | |
191 | IsField (me) returns Boolean; |
192 | ---Purpose : Tells if <me> is a Field. Else it is a Type |
193 | |
194 | FieldName (me) returns CString; |
195 | FieldRank (me) returns Integer; |
196 | |
197 | Check (me; afild : Field; ach : in out Check) is virtual; |
198 | ---Purpose : Semantic Check of a Field : does it complies with the given |
199 | -- description ? |
200 | |
201 | fields |
202 | |
203 | thename : AsciiString from TCollection; |
204 | thesel : Integer; -- 0 no 1 entity 2 immediate 3 heterog. 4 unknown |
205 | thesnam : AsciiString from TCollection; |
206 | thenext : PDescr; -- list of members |
207 | thekind : Integer; -- as Field |
208 | theenum : EnumTool from StepData; |
209 | thetype : Type from Standard; |
210 | thednam : AsciiString from TCollection; |
211 | thearit : Integer; |
212 | thefrom : PDescr; -- for SetFrom |
213 | theopt : Boolean; |
214 | theder : Boolean; |
215 | thefnam : AsciiString from TCollection; |
216 | thefnum : Integer; |
217 | |
218 | end PDescr; |