b311480e |
1 | -- Created on: 1997-07-31 |
2 | -- Created by: Denis PASCAL |
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 | |
24 | class Name from TDataStd inherits Attribute from TDF |
25 | |
26 | ---Purpose: Used to define a name attribute containing a string which specifies the name. |
27 | |
28 | uses Attribute from TDF, |
29 | Label from TDF, |
30 | GUID from Standard, |
31 | ExtendedString from TCollection, |
32 | ListOfExtendedString from TDataStd, |
33 | DataSet from TDF, |
34 | RelocationTable from TDF, |
35 | AttributeSequence from TDF, |
36 | AttributeList from TDF, |
37 | Data from TDF, |
38 | AttributeDelta from TDF |
39 | |
40 | |
41 | raises |
42 | |
43 | DomainError from Standard |
44 | |
45 | |
46 | is |
47 | |
48 | |
49 | ---Purpose: class methods working on the name itself |
50 | -- ======================================== |
51 | |
52 | |
53 | GetID (myclass) |
54 | ---C++: return const & |
55 | ---Purpose: Returns the GUID for name attributes. |
56 | returns GUID from Standard; |
57 | |
58 | |
59 | Set (myclass; label: Label from TDF; string : ExtendedString from TCollection) |
60 | ---Purpose: Creates (if does not exist) and sets the name in the name attribute. |
61 | -- myEmpty becomes False |
62 | returns Name from TDataStd; |
63 | |
64 | |
65 | |
66 | ---Warning: ====================================================== |
67 | -- As already announced next methods will be moved soon in 2 tools |
68 | -- |
69 | -- * one to search label from name following the framework |
70 | -- label hierarchy. |
71 | -- |
72 | -- * one to search label from name following the treenode hierachy. |
73 | -- =============================================================== |
74 | |
75 | --Find (myclass; L : Label from TDF; father : in out Name from TDataStd) |
76 | ---Purpose: from any label <L> search in father labels (L is not |
77 | -- concerned) the first name attribute.if found set it in |
78 | -- <father>. |
79 | --returns Boolean from Standard; |
80 | |
81 | |
82 | ---Purpose: class methods working on the name tree |
83 | -- ====================================== |
84 | |
85 | --Find (myclass; framework : Data from TDF; |
86 | -- fullPath : ListOfExtendedString from TDataStd; |
87 | -- name : in out Name from TDataStd) |
88 | --returns Boolean from Standard; |
89 | ---Purpose: Search in the whole TDF_Data the Name attribute which |
90 | -- fit with <fullPath>. Returns True if found. |
91 | |
92 | --Find (myclass; current : Label from TDF; |
93 | -- string : ExtendedString from TCollection; |
94 | -- name : in out Name from TDataStd) |
95 | --returns Boolean from Standard; |
96 | ---Purpose: Search under <currentLabel> a label which fit with |
97 | -- <name>. Returns True if found. Shortcut which avoids |
98 | -- building a ListOfExtendedStrin. |
99 | |
100 | --Find (myclass; framework : Data from TDF; |
101 | -- string : ExtendedString from TCollection; |
102 | -- name : in out Name from TDataStd) |
103 | --returns Boolean from Standard; |
104 | ---Purpose: Search in the whole TDF_Data the label which fit with name |
105 | -- Returns True if found. |
106 | |
107 | ---Purpose: tools methods to translate path <-> pathlist |
108 | -- =========================================== |
109 | |
110 | --MakePath (myclass; path : ExtendedString from TCollection; |
111 | -- pathlist : in out ListOfExtendedString from TDataStd; |
112 | -- Separator: ExtCharacter from Standard = ':') |
113 | --returns Boolean from Standard; |
114 | ---Purpose: move to draw For Draw test we may provide this tool method which convert a path in a |
115 | -- sequence of string to call after the FindLabel methods. |
116 | -- Example: if it's given "Assembly:Part_1:Sketch_5" it will return in <pathlist> |
117 | -- the list of 3 strings: "Assembly","Part_1","Sketch_5". |
118 | |
119 | --MakePath (myclass; pathlist : AttributeList from TDF; |
120 | -- path : in out ExtendedString from TCollection; |
121 | -- Separator: ExtCharacter from Standard = ':') |
122 | ---Purpose: move to draw from <pathlist> build the string path |
123 | --returns Boolean from Standard; |
124 | |
125 | |
126 | ---Purpose: Name methods |
127 | -- ============ |
128 | |
129 | Create |
130 | returns mutable Name from TDataStd; |
131 | |
132 | |
133 | --Father (me; father : in out Name from TDataStd) |
134 | -- Purpose: Returns the Father Name. The search is done in <me> |
135 | -- fathers labels. If noone father is found returns |
136 | -- False. |
137 | --returns Boolean from Standard; |
138 | |
139 | --FullPath (me; path : in out AttributeList from TDF) |
140 | --returns Boolean from Standard; |
141 | |
142 | --ChildNames (me; list : in out AttributeList from TDF) |
143 | -- Purpose: puts in list the childs names of me. returns TRUE if |
144 | -- found |
145 | --returns Boolean from Standard; |
146 | |
147 | --Find (me; relativePath : ListOfExtendedString from TDataStd; |
148 | -- name : in out Name from TDataStd) |
149 | --returns Boolean from Standard; |
150 | |
151 | Set (me : mutable; S : ExtendedString from TCollection) |
152 | raises DomainError from Standard; |
153 | ---Purpose: Sets <S> as name. Raises if <S> is not a valid name. |
154 | |
155 | Get (me) |
156 | returns ExtendedString from TCollection; |
157 | ---Purpose: |
158 | -- Returns the name contained in this name attribute. |
159 | ---C++: return const & |
160 | |
161 | --SetEmpty(me: mutable); |
162 | ---Purpose: Set myEmpty field |
163 | |
164 | --IsEmpty(me) returns Boolean from Standard; |
165 | |
166 | ---Category: TDF_Attribute methods |
167 | -- ===================== |
168 | |
169 | ID (me) |
170 | ---C++: return const & |
171 | returns GUID from Standard; |
172 | |
173 | Restore (me: mutable; with : Attribute from TDF); |
174 | |
175 | NewEmpty (me) |
176 | returns mutable Attribute from TDF; |
177 | |
178 | Paste (me; into : mutable Attribute from TDF; |
179 | RT : mutable RelocationTable from TDF); |
180 | |
181 | Dump(me; anOS : in out OStream from Standard) |
182 | returns OStream from Standard |
183 | is redefined; |
184 | ---C++: return & |
185 | |
186 | fields |
187 | |
188 | myString : ExtendedString from TCollection; --To store name |
189 | myEmpty : Boolean from Standard; --Is set to True if name isn't set |
190 | |
191 | end Name; |