1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * $Id$
20  */
21 
22 
23 class Win32RCFormatter : public XlatFormatter
24 {
25 public :
26     // -----------------------------------------------------------------------
27     //  Public Constructors and Destructor
28     // -----------------------------------------------------------------------
29     Win32RCFormatter();
30     virtual ~Win32RCFormatter();
31 
32 
33     // -----------------------------------------------------------------------
34     //  Implementation of the formatter interface
35     // -----------------------------------------------------------------------
36     virtual void endDomain
37     (
38         const   XMLCh* const    domainName
39         , const unsigned int    msgCount
40     );
41 
42     virtual void endMsgType
43     (
44         const   MsgTypes        type
45     );
46 
47     virtual void endOutput();
48 
49     virtual void nextMessage
50     (
51         const   XMLCh* const    msgText
52         , const XMLCh* const    msgId
53         , const unsigned int    messageId
54         , const unsigned int    curId
55     );
56 
57     virtual void startDomain
58     (
59         const   XMLCh* const    domainName
60         , const XMLCh* const    nameSpace
61     );
62 
63     virtual void startMsgType
64     (
65         const   MsgTypes        type
66     );
67 
68     virtual void startOutput
69     (
70         const   XMLCh* const locale
71         , const XMLCh* const outPath
72     );
73 
74 
75 private :
76     // -----------------------------------------------------------------------
77     //  Unimplemented constructors and operators
78     // -----------------------------------------------------------------------
79     Win32RCFormatter(const Win32RCFormatter&);
80     void operator=(const Win32RCFormatter&);
81 
82 
83     // -----------------------------------------------------------------------
84     //  Private data members
85     //
86     //  fCurDomainName
87     //      This is the short name for the current domain being processed.
88     //      This is used to create the names of information we write to the
89     //      file.
90     //
91     //  fMsgOffset
92     //      Since we are going to put all the messages into a single message
93     //      table, we have to provide an offset for each domain (since they
94     //      each think that they have a unique numbering range.) So we just
95     //      offset each new domain by 0x2000 to keep them separate. When the
96     //      numbers are passed into the Win32RCMsgLoader, it will offset the
97     //      incoming message ids by the appropriate amount.
98     //
99     //  fOutFl
100     //      This is the current output file. Its created when a new domain
101     //      is begun via startDomain() and closed when endDomain is called.
102     // -----------------------------------------------------------------------
103     XMLCh*          fCurDomainName;
104     unsigned int    fMsgOffset;
105     FILE*           fOutFl;
106 };
107