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