1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _CFG_MERGE_HXX
30 #define _CFG_MERGE_HXX
32 #include <tools/string.hxx>
33 #include <boost/unordered_map.hpp>
36 typedef boost::unordered_map
<ByteString
, ByteString
, hashByteString
,equalByteString
>
46 friend class CfgParser
;
47 friend class CfgExport
;
48 friend class CfgMerge
;
51 ByteString sIdentifier
;
56 ByteString sEndTextTag
;
58 ByteStringHashMap sText
;
60 CfgStackData( const ByteString
&rTag
, const ByteString
&rId
)
61 : sTagType( rTag
), sIdentifier( rId
) {};
63 ByteString
&GetTagType() { return sTagType
; }
64 ByteString
&GetIdentifier() { return sIdentifier
; }
72 typedef ::std::vector
< CfgStackData
* > CfgStackList
;
83 size_t Push( CfgStackData
*pStackData
);
84 CfgStackData
*Push( const ByteString
&rTag
, const ByteString
&rId
);
87 if ( maList
.empty() ) return NULL
;
88 CfgStackData
* temp
= maList
.back();
93 CfgStackData
*GetStackData( size_t nPos
= LIST_APPEND
);
95 ByteString
GetAccessPath( size_t nPos
= LIST_APPEND
);
97 size_t size() const { return maList
.size(); }
107 ByteString sCurrentResTyp
;
108 ByteString sCurrentIsoLang
;
109 ByteString sCurrentText
;
111 ByteString sLastWhitespace
;
114 CfgStackData
*pStackData
;
118 virtual void WorkOnText(
120 const ByteString
&nLangIndex
)=0;
122 virtual void WorkOnRessourceEnd()=0;
124 virtual void Output( const ByteString
& rOutput
)=0;
126 void Error( const ByteString
&rError
);
129 int ExecuteAnalyzedToken( int nToken
, char *pToken
);
130 std::vector
<ByteString
> aLanguages
;
133 const ByteString
&rIsoLang
,
134 const ByteString
&rResTyp
);
136 sal_Bool
IsTokenClosed( const ByteString
&rToken
);
140 virtual ~CfgParser();
142 int Execute( int nToken
, char * pToken
);
146 // class CfgOutputParser
149 class CfgOutputParser
: public CfgParser
152 SvFileStream
*pOutputStream
;
154 CfgOutputParser ( const ByteString
&rOutputFile
);
155 virtual ~CfgOutputParser();
162 class CfgExport
: public CfgOutputParser
167 std::vector
<ByteString
> aLanguages
;
171 const ByteString
&rIsoLang
174 void WorkOnRessourceEnd();
175 void Output( const ByteString
& rOutput
);
178 const ByteString
&rOutputFile
,
179 const ByteString
&rProject
,
180 const ByteString
&rFilePath
189 class CfgMerge
: public CfgOutputParser
192 MergeDataFile
*pMergeDataFile
;
193 std::vector
<ByteString
> aLanguages
;
196 ByteString sFilename
;
202 const ByteString
&nLangIndex
);
204 void WorkOnRessourceEnd();
206 void Output( const ByteString
& rOutput
);
209 const ByteString
&rMergeSource
,
210 const ByteString
&rOutputFile
,
211 ByteString
&rFilename
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */