Bump version to 4.1-6
[LibreOffice.git] / l10ntools / inc / xrmmerge.hxx
blobf5de9af9bc2ea4ad4f36aec0083f4fe52f84f0d8
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 XRMMERGE_INCLUDED
21 #define XRMMERGE_INCLUDED
23 #include "sal/config.h"
25 #include <fstream>
28 /// Parser for *.xrm and description.xml files
29 class XRMResParser
31 private:
32 OString sGID;
33 OString sLID;
35 sal_Bool bError;
36 sal_Bool bText;
38 OString sCurrentOpenTag;
39 OString sCurrentCloseTag;
40 OString sCurrentText;
41 protected:
42 OString GetAttribute( const OString &rToken, const OString &rAttribute );
43 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 OString GetGID() { return sGID; }
60 OString GetLID() { return sLID; }
62 public:
63 XRMResParser();
64 virtual ~XRMResParser();
66 int Execute( int nToken, char * pToken );
68 void SetError( sal_Bool bErr = sal_True ) { bError = bErr; }
69 sal_Bool GetError() { return bError; }
73 /// Export strings from *.xrm and description.xml files
74 class XRMResExport : public XRMResParser
76 private:
77 ResData *pResData;
78 OString sPath;
79 PoOfstream pOutputStream;
80 protected:
81 void WorkOnDesc(
82 const OString &rOpenTag,
83 OString &rText
85 void WorkOnText(
86 const OString &rOpenTag,
87 OString &rText
89 void EndOfText(
90 const OString &rOpenTag,
91 const OString &rCloseTag
93 void Output( const OString& rOutput );
95 public:
96 XRMResExport(
97 const OString &rOutputFile,
98 const OString &rFilePath
100 virtual ~XRMResExport();
104 /// Merge strings to *.xrm and description.xml files
105 class XRMResMerge : public XRMResParser
107 private:
108 MergeDataFile *pMergeDataFile;
109 OString sFilename;
110 ResData *pResData;
111 std::ofstream pOutputStream;
112 std::vector<OString> aLanguages;
114 protected:
115 void WorkOnDesc(
116 const OString &rOpenTag,
117 OString &rText
119 void WorkOnText(
120 const OString &rOpenTag,
121 OString &rText
123 void EndOfText(
124 const OString &rOpenTag,
125 const OString &rCloseTag
127 void Output( const OString& rOutput );
128 public:
129 XRMResMerge(
130 const OString &rMergeSource,
131 const OString &rOutputFile,
132 const OString &rFilename
134 virtual ~XRMResMerge();
137 #endif // XRMMERGE_INCLUDED
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */