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