b311480e |
1 | -- Created on: 1994-11-04 |
2 | -- Created by: Christian CAILLET |
3 | -- Copyright (c) 1994-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 AttrList from MoniTool |
24 | |
25 | ---Purpose : a AttrList allows to record a list of attributes as Transients |
26 | -- which can be edited, changed ... |
27 | -- Each one is identified by a name |
28 | |
29 | uses CString, Type, Transient, |
30 | DictionaryOfTransient from Dico, ValueType from MoniTool |
31 | |
32 | is |
33 | |
34 | Create returns AttrList; |
35 | ---Purpose : Creates an AttrList, empty |
36 | |
37 | Create (other : AttrList) returns AttrList; |
38 | ---Purpose : Creates an AttrList from another one, definitions are shared |
39 | -- (calls SameAttributes) |
40 | |
41 | -- -- Attributes |
42 | |
43 | |
44 | SetAttribute (me : in out; name : CString; val : Transient); |
45 | ---Purpose : Adds an attribute with a given name (replaces the former one |
46 | -- with the same name if already exists) |
47 | |
48 | RemoveAttribute (me : in out; name : CString) returns Boolean; |
49 | ---Purpose : Removes an attribute |
50 | -- Returns True when done, False if this attribute did not exist |
51 | |
52 | GetAttribute (me; name : CString; type : Type from Standard; |
53 | val : out mutable Transient) returns Boolean; |
54 | ---Purpose : Returns an attribute from its name, filtered by a type |
55 | -- If no attribute has this name, or if it is not kind of this |
56 | -- type, <val> is Null and returned value is False |
57 | -- Else, it is True |
58 | |
59 | Attribute (me; name : CString) returns Transient; |
60 | ---Purpose : Returns an attribute from its name. Null Handle if not |
61 | -- recorded (whatever Transient, Integer, Real ...) |
62 | -- Integer is recorded as IntVal |
63 | -- Real is recorded as RealVal |
64 | -- Text is recorded as HAsciiString |
65 | |
66 | AttributeType (me; name : CString) returns ValueType from MoniTool; |
67 | ---Purpose : Returns the type of an attribute : |
68 | -- ValueInt , ValueReal , ValueText (String) , ValueIdent (any) |
69 | -- or ValueVoid (not recorded) |
70 | |
71 | |
72 | SetIntegerAttribute (me : in out; name : CString; val : Integer); |
73 | ---Purpose : Adds an integer value for an attribute |
74 | |
75 | GetIntegerAttribute (me; name : CString; val : out Integer) returns Boolean; |
76 | ---Purpose : Returns an attribute from its name, as integer |
77 | -- If no attribute has this name, or not an integer, |
78 | -- <val> is 0 and returned value is False |
79 | -- Else, it is True |
80 | |
81 | IntegerAttribute (me; name : CString) returns Integer; |
82 | ---Purpose : Returns an integer attribute from its name. 0 if not recorded |
83 | |
84 | SetRealAttribute (me : in out; name : CString; val : Real); |
85 | ---Purpose : Adds a real value for an attribute |
86 | |
87 | GetRealAttribute (me; name : CString; val : out Real) returns Boolean; |
88 | ---Purpose : Returns an attribute from its name, as real |
89 | -- If no attribute has this name, or not a real |
90 | -- <val> is 0.0 and returned value is False |
91 | -- Else, it is True |
92 | |
93 | RealAttribute (me; name : CString) returns Real; |
94 | ---Purpose : Returns a real attribute from its name. 0.0 if not recorded |
95 | |
96 | SetStringAttribute (me : in out; name : CString; val : CString); |
97 | ---Purpose : Adds a String value for an attribute |
98 | |
99 | GetStringAttribute (me; name : CString; val : out CString) returns Boolean; |
100 | ---Purpose : Returns an attribute from its name, as String |
101 | -- If no attribute has this name, or not a String |
102 | -- <val> is 0.0 and returned value is False |
103 | -- Else, it is True |
104 | |
105 | StringAttribute (me; name : CString) returns CString; |
106 | ---Purpose : Returns a String attribute from its name. "" if not recorded |
107 | |
108 | AttrList (me) returns DictionaryOfTransient; |
109 | ---Purpose : Returns the exhaustive list of attributes |
110 | |
111 | SameAttributes (me : in out; other : AttrList); |
112 | ---Purpose : Gets the list of attributes from <other>, as such, i.e. |
113 | -- not copied : attributes are shared, any attribute edited, |
114 | -- added, or removed in <other> is also in <me> and vice versa |
115 | -- The former list of attributes of <me> is dropped |
116 | |
117 | GetAttributes (me : in out; other : AttrList; |
118 | fromname : CString = ""; copied : Boolean = Standard_True); |
119 | ---Purpose : Gets the list of attributes from <other>, by copying it |
120 | -- By default, considers all the attributes from <other> |
121 | -- If <fromname> is given, considers only the attributes with |
122 | -- name beginning by <fromname> |
123 | -- |
124 | -- For each attribute, if <copied> is True (D), its value is also |
125 | -- copied if it is a basic type (Integer,Real,String), else it |
126 | -- remains shared between <other> and <me> |
127 | -- |
128 | -- These new attributes are added to the existing ones in <me>, |
129 | -- in case of same name, they replace the existing ones |
130 | |
131 | fields |
132 | |
133 | theattrib : DictionaryOfTransient; |
134 | |
135 | end AttrList; |