xref: /aoo4110/main/l10ntools/inc/lngmerge.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 // local includes
24 #include "export.hxx"
25 
26 DECLARE_LIST( LngLineList, ByteString * )
27 
28 #define LNG_OK				0x0000
29 #define LNG_FILE_NOTFOUND	0x0001
30 #define LNG_COULD_NOT_OPEN	0x0002
31 #define SDF_OK				0x0003
32 #define SDF_FILE_NOTFOUND	0x0004
33 #define SDF_COULD_NOT_OPEN	0x0005
34 
35 //
36 // class LngParser
37 //
38 
39 class LngParser
40 {
41 private:
42 	sal_uInt16 nError;
43 	LngLineList *pLines;
44 	ByteString sSource;
45 	sal_Bool bDBIsUTF8;
46 	sal_Bool bULF;
47     bool bQuiet;
48     std::vector<ByteString> aLanguages;
49 
50     void FillInFallbacks( ByteStringHashMap Text );
51     bool isNextGroup(  ByteString &sGroup_out , ByteString &sLine_in);
52     void ReadLine( const ByteString &sLine_in , ByteStringHashMap &rText_inout );
53     void WriteSDF( SvFileStream &aSDFStream , ByteStringHashMap &rText_inout ,
54                     const ByteString &rPrj ,
55                     const ByteString &rRoot , const ByteString &sActFileName , const ByteString &sID );
56 public:
57 	LngParser( const ByteString &rLngFile, sal_Bool bUTF8, sal_Bool bULFFormat );
58 	~LngParser();
59 
60 	sal_Bool CreateSDF( const ByteString &rSDFFile, const ByteString &rPrj, const ByteString &rRoot );
61 	sal_Bool Merge( const ByteString &rSDFFile, const ByteString &rDestinationFile , const ByteString &rPrj );
62 };
63