1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_L10NTOOLS_INC_XRMMERGE_HXX
21 #define INCLUDED_L10NTOOLS_INC_XRMMERGE_HXX
24 #include <sal/config.h>
29 /// Parser for *.xrm and description.xml files
38 OString sCurrentOpenTag
;
39 OString sCurrentCloseTag
;
42 static OString
GetAttribute( const OString
&rToken
, const OString
&rAttribute
);
43 static void Error( const OString
&rError
);
45 virtual void Output( const OString
& rOutput
)=0;
46 virtual void WorkOnDesc(
47 const OString
&rOpenTag
,
50 virtual void WorkOnText(
51 const OString
&rOpenTag
,
54 virtual void EndOfText(
55 const OString
&rOpenTag
,
56 const OString
&rCloseTag
59 const OString
& GetGID() const { return sGID
; }
63 virtual ~XRMResParser();
65 void Execute( int nToken
, char * pToken
);
67 void SetError() { bError
= true; }
68 bool GetError() const { return bError
; }
72 /// Export strings from *.xrm and description.xml files
73 class XRMResExport
: public XRMResParser
76 std::unique_ptr
<ResData
> pResData
;
78 PoOfstream pOutputStream
;
81 const OString
&rOpenTag
,
85 const OString
&rOpenTag
,
89 const OString
&rOpenTag
,
90 const OString
&rCloseTag
92 void Output( const OString
& rOutput
) override
;
96 const OString
&rOutputFile
,
97 const OString
&rFilePath
99 virtual ~XRMResExport() override
;
103 /// Merge strings to *.xrm and description.xml files
104 class XRMResMerge
: public XRMResParser
107 std::unique_ptr
<MergeDataFile
> pMergeDataFile
;
109 std::unique_ptr
<ResData
> pResData
;
110 std::ofstream pOutputStream
;
111 std::vector
<OString
> aLanguages
;
115 const OString
&rOpenTag
,
119 const OString
&rOpenTag
,
123 const OString
&rOpenTag
,
124 const OString
&rCloseTag
126 void Output( const OString
& rOutput
) override
;
129 const OString
&rMergeSource
,
130 const OString
&rOutputFile
,
131 const OString
&rFilename
133 virtual ~XRMResMerge() override
;
136 #endif // INCLUDED_L10NTOOLS_INC_XRMMERGE_HXX
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */