Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 2000-08-21 |
2 | -- Created by: Andrey BETENEV | |
973c2be1 | 3 | -- Copyright (c) 2000-2014 OPEN CASCADE SAS |
b311480e | 4 | -- |
973c2be1 | 5 | -- This file is part of Open CASCADE Technology software library. |
b311480e | 6 | -- |
d5f74e42 | 7 | -- This library is free software; you can redistribute it and/or modify it under |
8 | -- the terms of the GNU Lesser General Public License version 2.1 as published | |
973c2be1 | 9 | -- by the Free Software Foundation, with special exception defined in the file |
10 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
11 | -- distribution for complete text of the license and disclaimer of any warranty. | |
b311480e | 12 | -- |
973c2be1 | 13 | -- Alternatively, this file may be used under the terms of Open CASCADE |
14 | -- commercial license or contractual agreement. | |
7fd59977 | 15 | |
16 | class Context from ShapeProcess inherits TShared from MMgt | |
17 | ||
18 | ---Purpose: Provides convenient interface to resource file | |
19 | -- Allows to load resource file and get values of | |
20 | -- attributes starting from some scope, for example | |
21 | -- if scope is defined as "ToV4" and requested parameter | |
22 | -- is "exec.op", value of "ToV4.exec.op" parameter from | |
23 | -- the resource file will be returned | |
24 | ||
25 | uses | |
26 | ||
b485ee79 KD |
27 | Manager from Resource, |
28 | AsciiString from TCollection, | |
7fd59977 | 29 | HSequenceOfHAsciiString from TColStd, |
b485ee79 KD |
30 | Messenger from Message, |
31 | ProgressIndicator from Message | |
7fd59977 | 32 | |
33 | is | |
34 | ||
35 | Create; | |
36 | ---Purpose: Creates an empty tool | |
37 | ||
38 | Create (file: CString; scope: CString = ""); | |
39 | ---Purpose: Creates a new tool and initialises by name of | |
40 | -- resource file and (if specified) starting scope | |
41 | -- Calls method Init() | |
42 | ||
43 | Init (me: mutable; file: CString; scope: CString = "") | |
44 | returns Boolean; | |
45 | ---Purpose: Initialises a tool by loading resource file and | |
46 | -- (if specified) sets starting scope | |
47 | -- Returns False if resource file not found | |
48 | ||
49 | LoadResourceManager(me: mutable; file: CString) returns Manager from Resource; | |
50 | ---Purpose: Loading Resource_Manager object if this object not | |
51 | -- equal internal static Resource_Manager object or | |
52 | -- internal static Resource_Manager object is null | |
53 | ||
54 | ResourceManager (me) returns Manager from Resource; | |
55 | ---Purpose: Returns internal Resource_Manager object | |
56 | ---C++: return const & | |
57 | ||
58 | SetScope (me: mutable; scope: CString); | |
59 | ---Purpose: Set a new (sub)scope | |
60 | ||
61 | UnSetScope (me: mutable); | |
62 | ---Purpose: Go out of current scope | |
63 | ||
64 | IsParamSet (me; param: CString) returns Boolean; | |
65 | ---Purpose: Returns True if parameter is defined in the resource file | |
66 | ||
67 | GetReal (me; param: CString; val: out Real ) returns Boolean; | |
68 | GetInteger (me; param: CString; val: out Integer) returns Boolean; | |
69 | GetBoolean (me; param: CString; val: out Boolean) returns Boolean; | |
70 | GetString (me; param: CString; val: out AsciiString from TCollection) returns Boolean; | |
71 | ---Purpose: Get value of parameter as being of specific type | |
72 | -- Returns False if parameter is not defined or has a wrong type | |
73 | ||
74 | RealVal (me; param: CString; def: Real ) returns Real; | |
75 | IntegerVal (me; param: CString; def: Integer) returns Integer; | |
76 | BooleanVal (me; param: CString; def: Boolean) returns Boolean; | |
77 | StringVal (me; param: CString; def: CString) returns CString; | |
78 | ---Purpose: Get value of parameter as being of specific type | |
79 | -- If parameter is not defined or does not have expected | |
80 | -- type, returns default value as specified | |
81 | ||
82 | SetMessenger (me: mutable; messenger: Messenger from Message); | |
83 | ---Purpose : Sets Messenger used for outputting messages. | |
84 | ||
85 | Messenger (me) returns Messenger from Message; | |
86 | ---Purpose : Returns Messenger used for outputting messages. | |
b485ee79 KD |
87 | |
88 | SetProgress (me: mutable; theProgress: ProgressIndicator from Message); | |
89 | ---Purpose : Sets Progress Indicator. | |
90 | ||
91 | Progress (me) returns ProgressIndicator from Message; | |
92 | ---Purpose : Returns Progress Indicator. | |
7fd59977 | 93 | |
94 | SetTraceLevel (me: mutable; tracelev: Integer); | |
95 | ---Purpose : Sets trace level used for outputting messages | |
96 | -- - 0: no trace at all | |
97 | -- - 1: errors | |
98 | -- - 2: errors and warnings | |
99 | -- - 3: all messages | |
100 | -- Default is 1 : Errors traced | |
101 | ||
102 | TraceLevel (me) returns Integer; | |
103 | ---Purpose : Returns trace level used for outputting messages. | |
104 | ||
105 | fields | |
106 | ||
b485ee79 KD |
107 | myRC: Manager from Resource; |
108 | myScope: HSequenceOfHAsciiString from TColStd; | |
7fd59977 | 109 | myMessenger: Messenger from Message; |
b485ee79 KD |
110 | myProgress: ProgressIndicator from Message; |
111 | myTraceLev: Integer; | |
7fd59977 | 112 | |
113 | end Context; |