1 -- Created on: 2001-01-18
2 -- Created by: OCC Team
3 -- Copyright (c) 2001-2012 OPEN CASCADE SAS
5 -- The content of this file is subject to the Open CASCADE Technology Public
6 -- License Version 6.5 (the "License"). You may not use the content of this file
7 -- except in compliance with the License. Please obtain a copy of the License
8 -- at http://www.opencascade.org and read it completely before using this file.
10 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 -- The Original Code and all software distributed under the License is
14 -- distributed on an "AS IS" basis, without warranty of any kind, and the
15 -- Initial Developer hereby disclaims all such warranties, including without
16 -- limitation, any warranties of merchantability, fitness for a particular
17 -- purpose or non-infringement. Please see the License for the specific terms
18 -- and conditions governing the rights and limitations under the License.
22 class Msg from Message
24 ---Purpose: This class provides a tool for constructing the parametrized message
25 -- basing on resources loaded by Message_MsgFile tool.
27 -- A Message is created from a keyword: this keyword identifies the
28 -- message in a message file that should be previously loaded by call
29 -- to Message_MsgFile::LoadFile().
31 -- The text of the message can contain placeholders for the parameters
32 -- which are to be filled by the proper values when the message
33 -- is prepared. Most of the format specifiers used in C can be used,
34 -- for instance, %s for string, %d for integer etc. In addition,
35 -- specifier %f is supported for double numbers (for compatibility
36 -- with previous versions).
38 -- User fills the parameter fields in the text of the message by
39 -- calling corresponding methods Arg() or operators "<<".
41 -- The resulting message, filled with all parameters, can be obtained
42 -- by method Get(). If some parameters were not filled, the text
43 -- UNKNOWN is placed instead.
47 AsciiString from TCollection,
48 HAsciiString from TCollection,
49 ExtendedString from TCollection,
50 HExtendedString from TCollection,
51 SequenceOfInteger from TColStd
55 Create returns Msg from Message;
56 ---Purpose : Empty constructor
58 Create (theMsg: Msg from Message) returns Msg from Message;
59 ---Purpose : Copy constructor
61 Create (theKey: CString) returns Msg from Message;
62 ---Purpose : Create a message using a corresponding entry in Message_MsgFile
64 Create (theKey: ExtendedString from TCollection) returns Msg from Message;
65 ---Purpose : Create a message using a corresponding entry in Message_MsgFile
67 Set (me: in out; theMsg: CString);
68 ---Purpose : Set a message body text -- can be used as alternative to
69 -- using messages from resource file
71 Set (me: in out; theMsg: ExtendedString from TCollection);
72 ---Purpose : Set a message body text -- can be used as alternative to
73 -- using messages from resource file
77 Arg (me: in out; theString : CString)
78 returns Msg from Message;
80 ---C++: alias operator <<
81 ---Purpose : Set a value for %..s conversion
83 Arg (me: in out; theString : AsciiString from TCollection)
84 returns Msg from Message;
87 ---C++: alias operator <<
88 ---Purpose : Set a value for %..s conversion
90 Arg (me: in out; theString : HAsciiString from TCollection)
91 returns Msg from Message;
94 ---C++: alias operator <<
95 ---Purpose : Set a value for %..s conversion
97 Arg (me: in out; theString : ExtendedString from TCollection)
98 returns Msg from Message;
100 ---C++: alias operator <<
101 ---Purpose : Set a value for %..s conversion
103 Arg (me: in out; theString : HExtendedString from TCollection)
104 returns Msg from Message;
107 ---C++: alias operator <<
108 ---Purpose : Set a value for %..s conversion
110 Arg (me: in out; theInt : Integer)
111 returns Msg from Message;
113 ---C++: alias operator <<
114 ---Purpose : Set a value for %..d, %..i, %..o, %..u, %..x or %..X conversion
116 Arg (me: in out; theReal : Real)
117 returns Msg from Message;
119 ---C++: alias operator <<
120 ---Purpose : Set a value for %..f, %..e, %..E, %..g or %..G conversion
122 Original (me) returns ExtendedString from TCollection;
124 ---C++: return const &
125 ---Purpose : Returns the original message text
127 Value (me) returns ExtendedString from TCollection;
129 ---C++: return const &
130 ---Purpose : Returns current state of the message text with
131 -- parameters to the moment
133 IsEdited (me) returns Boolean;
135 ---Purpose : Tells if Value differs from Original
138 returns ExtendedString from TCollection;
139 ---C++: return const &
140 ---C++: alias "operator const TCollection_ExtendedString& () { return Get(); }"
141 ---Purpose : Return the resulting message string with all parameters
142 -- filled. If some parameters were not yet filled by calls
143 -- to methods Arg (or <<), these parameters are filled by
148 getFormat (me: in out; theType : Integer;
149 theFormat : in out AsciiString from TCollection)
150 returns Integer is private;
152 replaceText (me: in out; theFirst : Integer;
154 theStr : ExtendedString from TCollection) is private;
158 myOriginal : ExtendedString from TCollection;
159 myMessageBody : ExtendedString from TCollection;
160 mySeqOfFormats : SequenceOfInteger from TColStd;