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