Bump version to 6.4.7.2.M8
[LibreOffice.git] / l10ntools / inc / xrmmerge.hxx
blob7d55bcd89ac7bf9c52dfa2909abbfd0ffd4d06dd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <memory>
24 #include <sal/config.h>
26 #include <fstream>
29 /// Parser for *.xrm and description.xml files
30 class XRMResParser
32 private:
33 OString sGID;
35 bool bError;
36 bool bText;
38 OString sCurrentOpenTag;
39 OString sCurrentCloseTag;
40 OString sCurrentText;
41 protected:
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,
48 OString &rText
49 )=0;
50 virtual void WorkOnText(
51 const OString &rOpenTag,
52 OString &rText
53 )=0;
54 virtual void EndOfText(
55 const OString &rOpenTag,
56 const OString &rCloseTag
57 )=0;
59 const OString& GetGID() const { return sGID; }
61 public:
62 XRMResParser();
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
75 private:
76 std::unique_ptr<ResData> pResData;
77 OString sPath;
78 PoOfstream pOutputStream;
79 protected:
80 void WorkOnDesc(
81 const OString &rOpenTag,
82 OString &rText
83 ) override;
84 void WorkOnText(
85 const OString &rOpenTag,
86 OString &rText
87 ) override;
88 void EndOfText(
89 const OString &rOpenTag,
90 const OString &rCloseTag
91 ) override;
92 void Output( const OString& rOutput ) override;
94 public:
95 XRMResExport(
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
106 private:
107 std::unique_ptr<MergeDataFile> pMergeDataFile;
108 OString sFilename;
109 std::unique_ptr<ResData> pResData;
110 std::ofstream pOutputStream;
111 std::vector<OString> aLanguages;
113 protected:
114 void WorkOnDesc(
115 const OString &rOpenTag,
116 OString &rText
117 ) override;
118 void WorkOnText(
119 const OString &rOpenTag,
120 OString &rText
121 ) override;
122 void EndOfText(
123 const OString &rOpenTag,
124 const OString &rCloseTag
125 ) override;
126 void Output( const OString& rOutput ) override;
127 public:
128 XRMResMerge(
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: */