0023042: Potential mistakes in (s)printf usage
[occt.git] / src / IFSelect / IFSelect_Activator.cdl
CommitLineData
b311480e 1-- Created on: 1993-07-27
2-- Created by: Christian CAILLET
3-- Copyright (c) 1993-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
23deferred class Activator from IFSelect inherits TShared
24
25 ---Purpose : Defines the general frame for working with a SessionPilot.
26 -- Each Activator treats a set of Commands. Commands are given as
27 -- alphanumeric strings. They can be of two main forms :
28 -- - classic, to list, evaluate, enrich the session (by itself) :
29 -- no specific remark, its complete execution must be described
30 -- - creation of a new item : instead of creatinf it plus adding
31 -- it to the session (which is a classic way), it is possible
32 -- to create it and make it recorded by the SessionPilot :
33 -- then, the Pilot will add it to the session; this way allows
34 -- the Pilot to manage itself named items
35 --
36 -- In order to make easier the use of Activator, this class
37 -- provides a simple way to Select an Actor for a Command :
38 -- each sub-class of SectionActor defines the command titles it
39 -- recognizes, plus attaches a Number, unique for this sub-class,
40 -- to each distinct command title.
41 --
42 -- Each time an action is required, the corresponding Number
43 -- can then be given to help the selection of the action to do.
44 --
45 -- The result of an Execution must indicate if it is worth to be
46 -- recorded or not : see method Do
47
48uses CString, OStream,
49 AsciiString from TCollection,
50 HSequenceOfAsciiString from TColStd,
51 SessionPilot, ReturnStatus
52
53raises DomainError
54
55is
56
57 Adding (myclass;
58 actor : Activator;
59 number : Integer;
60 command : CString;
61 mode : Integer)
62 ---Purpose : Records, in a Dictionary available for all the Activators,
63 -- the command title an Activator can process, attached with
64 -- its number, proper for this Activator
65 -- <mode> allows to distinguish various execution modes
66 -- 0: default mode; 1 : for xset
67 raises DomainError;
68 -- Error if a command title (exactly the same) is recorded more
69 -- than once
70
71 Add (me; number : Integer; command : CString)
72 ---Purpose : Allows a self-definition by an Activator of the Commands it
73 -- processes, call the class method Adding (mode 0)
74 raises DomainError;
75 -- Error if a command title (exactly the same) is recorded more
76 -- than once
77
78 AddSet (me; number : Integer; command : CString)
79 ---Purpose : Same as Add but specifies that this command is candidate for
80 -- xset (creation of items, xset : named items; mode 1)
81 raises DomainError;
82
83 Remove (myclass; command : CString);
84 ---Purpose : Removes a Command, if it is recorded (else, does nothing)
85
86
87 SetAlias (myclass; conf, command, aliasname : CString);
88 ---Purpose : Records, for a configuration named <conf>, that the command
89 -- <command> may be aliased by another command <alias>
90 --
91 -- To be used by call to Alias (no automatic redirection)
92 -- The configuration typically refers to a norm
93
94 SetCurrentAlias (myclass; conf : CString);
95 ---Purpose : Sets <conf> as current configuration for aliases
96
97 Alias (myclass; command : CString) returns AsciiString;
98 ---Purpose : Returns, in the current configuration, what alias has been
99 -- recorded for <command>
100 -- The returned string is empty if no alias is recorded
101
102
103 Select (myclass; command : CString;
104 number : out Integer; actor : out mutable Activator)
105 returns Boolean;
106 ---Purpose : Selects, for a Command given by its title, an actor with its
107 -- command number. Returns True if found, False else
108
109 Mode (myclass; command : CString) returns Integer;
110 ---Purpose : Returns mode recorded for a command. -1 if not found
111
112 Commands (myclass; mode : Integer = -1; command : CString = "")
113 returns HSequenceOfAsciiString from TColStd;
114 ---Purpose : Returns, for a root of command title, the list of possible
115 -- commands.
116 -- <mode> : -1 (D) for all commands if <commands> is empty
117 -- -1 + command : about a Group , >= 0 see Adding
118 -- By default, it returns the whole list of known commands.
119
120
121 Initialize;
122 ---Purpose : Sets the default values
123
124 Do (me : mutable; number : Integer; pilot : mutable SessionPilot)
125 returns ReturnStatus is deferred;
126 ---Purpose : Tries to execute a Command Line. <number> is the number of the
127 -- command for this Activator. It Must forecast to record the
128 -- result of the execution, for need of Undo-Redo
129 -- Must Returns : 0 for a void command (not to be recorded),
130 -- 1 if execution OK, -1 if command incorrect, -2 if error
131 -- on execution
132
133 Help (me; number : Integer) returns CString is deferred;
134 ---Purpose : Sends a short help message for a given command identified by
135 -- it number for this Activator (must take one line max)
136
137 Group (me) returns CString;
138 File (me) returns CString;
139 SetForGroup (me : mutable; group : CString; file : CString = "");
140 ---Purpose : Group and SetGroup define a "Group of commands" which
141 -- correspond to an Activator. Default is "XSTEP"
142 -- Also a file may be attached
143
144fields
145
146 thegroup : AsciiString;
147 thefile : AsciiString;
148
149end Activator;