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