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>
27 #include <string_view>
29 #include <rtl/string.hxx>
34 /// Parser for *.xrm and description.xml files
43 OString sCurrentOpenTag
;
44 OString sCurrentCloseTag
;
47 static OString
GetAttribute( const OString
&rToken
, std::string_view rAttribute
);
48 static void Error( const OString
&rError
);
50 virtual void Output( const OString
& rOutput
)=0;
51 virtual void WorkOnDesc(
52 const OString
&rOpenTag
,
55 virtual void WorkOnText(
56 const OString
&rOpenTag
,
59 virtual void EndOfText(
60 const OString
&rOpenTag
,
61 const OString
&rCloseTag
64 const OString
& GetGID() const { return sGID
; }
68 virtual ~XRMResParser();
70 void Execute( int nToken
, char * pToken
);
72 void SetError() { bError
= true; }
73 bool GetError() const { return bError
; }
77 /// Export strings from *.xrm and description.xml files
78 class XRMResExport final
: public XRMResParser
81 std::unique_ptr
<ResData
> pResData
;
83 PoOfstream pOutputStream
;
86 const OString
&rOpenTag
,
90 const OString
&rOpenTag
,
94 const OString
&rOpenTag
,
95 const OString
&rCloseTag
97 void Output( const OString
& rOutput
) override
;
101 const OString
&rOutputFile
,
104 virtual ~XRMResExport() override
;
108 /// Merge strings to *.xrm and description.xml files
109 class XRMResMerge final
: public XRMResParser
112 std::unique_ptr
<MergeDataFile
> pMergeDataFile
;
114 std::unique_ptr
<ResData
> pResData
;
115 std::ofstream pOutputStream
;
116 std::vector
<OString
> aLanguages
;
119 const OString
&rOpenTag
,
123 const OString
&rOpenTag
,
127 const OString
&rOpenTag
,
128 const OString
&rCloseTag
130 void Output( const OString
& rOutput
) override
;
133 const OString
&rMergeSource
,
134 const OString
&rOutputFile
,
137 virtual ~XRMResMerge() override
;
140 #endif // INCLUDED_L10NTOOLS_INC_XRMMERGE_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */