096f9ee279949bd2727498260e6b984e4b2bb4eb
[occt.git] / src / Message / Message_Msg.cdl
1 -- File:        Message_Msg.cdl
2 -- Created:     18.01.01 16:55:51
3 -- Author:      OCC Team
4 ---Copyright:   Open CASCADE S.A. 2005
5
6
7 class Msg  from Message
8
9     ---Purpose: This class provides a tool for constructing the parametrized message
10     --          basing on resources loaded by Message_MsgFile tool.
11     --           
12     --          A Message is created from a keyword: this keyword identifies the 
13     --          message in a message file that should be previously loaded by call
14     --          to Message_MsgFile::LoadFile(). 
15     --          
16     --          The text of the message can contain placeholders for the parameters
17     --          which are to be filled by the proper values when the message 
18     --          is prepared. Most of the format specifiers used in C can be used,
19     --          for instance, %s for string, %d for integer etc. In addition,
20     --          specifier %f is supported for double numbers (for compatibility
21     --          with previous versions).
22     --          
23     --          User fills the parameter fields in the text of the message by 
24     --          calling corresponding methods Arg() or operators "<<".
25     --          
26     --          The resulting message, filled with all parameters, can be obtained
27     --          by method Get(). If some parameters were not filled, the text
28     --          UNKNOWN is placed instead.
29
30 uses
31
32     AsciiString  from TCollection,
33     HAsciiString  from TCollection,
34     ExtendedString from TCollection,
35     HExtendedString from TCollection,
36     SequenceOfInteger from TColStd
37
38 is
39
40     Create returns Msg from Message;
41         ---Purpose : Empty constructor
42
43     Create (theMsg: Msg from Message) returns Msg from Message;
44         ---Purpose : Copy constructor
45
46     Create (theKey: CString) returns Msg from Message;
47         ---Purpose : Create a message using a corresponding entry in Message_MsgFile
48
49     Create (theKey: ExtendedString from TCollection) returns Msg from Message;
50         ---Purpose : Create a message using a corresponding entry in Message_MsgFile
51
52     Set (me: in out; theMsg: CString);
53         ---Purpose : Set a message body text -- can be used as alternative to 
54         --           using messages from resource file
55
56     Set (me: in out; theMsg: ExtendedString from TCollection);
57         ---Purpose : Set a message body text -- can be used as alternative to 
58         --           using messages from resource file
59
60     -- Adding arguments
61
62     Arg (me: in out; theString : CString)
63     returns Msg from Message;
64         ---C++: return &
65         ---C++: alias operator <<
66         ---Purpose : Set a value for %..s conversion
67     
68     Arg (me: in out; theString : AsciiString from TCollection)
69     returns Msg from Message;
70         ---C++: return &
71         ---C++: inline
72         ---C++: alias operator <<
73         ---Purpose : Set a value for %..s conversion
74
75     Arg (me: in out; theString : HAsciiString from TCollection)
76     returns Msg from Message;
77         ---C++: return &
78         ---C++: inline
79         ---C++: alias operator <<
80         ---Purpose : Set a value for %..s conversion
81
82     Arg (me: in out; theString : ExtendedString from TCollection)
83     returns Msg from Message;
84         ---C++: return &
85         ---C++: alias operator <<
86         ---Purpose : Set a value for %..s conversion
87
88     Arg (me: in out; theString : HExtendedString from TCollection)
89     returns Msg from Message;
90         ---C++: return &
91         ---C++: inline
92         ---C++: alias operator <<
93         ---Purpose : Set a value for %..s conversion
94
95     Arg (me: in out; theInt : Integer)
96     returns Msg from Message;
97         ---C++: return &
98         ---C++: alias operator <<
99         ---Purpose : Set a value for %..d, %..i, %..o, %..u, %..x or %..X conversion
100
101     Arg (me: in out; theReal : Real)
102     returns Msg from Message;
103         ---C++: return &
104         ---C++: alias operator <<
105         ---Purpose : Set a value for %..f, %..e, %..E, %..g or %..G conversion
106
107     Original (me) returns ExtendedString from TCollection;
108         ---C++: inline
109         ---C++: return const &
110         ---Purpose : Returns the original message text
111     
112     Value (me) returns ExtendedString from TCollection;
113         ---C++: inline
114         ---C++: return const &
115         ---Purpose : Returns current state of the message text with 
116         --           parameters to the moment
117     
118     IsEdited (me) returns Boolean;
119         ---C++: inline
120         ---Purpose : Tells if Value differs from Original
121     
122     Get (me: in out)
123     returns ExtendedString from TCollection;
124         ---C++: return const &
125         ---C++: alias "operator const TCollection_ExtendedString& () { return Get(); }"
126         ---Purpose : Return the resulting message string with all parameters
127         --           filled. If some parameters were not yet filled by calls
128         --           to methods Arg (or <<), these parameters are filled by
129         --           the word UNKNOWN
130
131     -- Private methods
132         
133     getFormat (me: in out; theType : Integer;
134                    theFormat : in out AsciiString from TCollection)
135     returns Integer is private;
136
137     replaceText (me: in out; theFirst : Integer;
138                              theNb    : Integer;
139                              theStr   : ExtendedString from TCollection) is private;
140
141 fields
142
143     myOriginal     : ExtendedString    from TCollection;
144     myMessageBody  : ExtendedString    from TCollection;
145     mySeqOfFormats : SequenceOfInteger from TColStd;
146
147 end Msg;