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_EXPORT_HXX
21 #define INCLUDED_L10NTOOLS_INC_EXPORT_HXX
23 #include <sal/config.h>
29 #include <osl/file.hxx>
34 #include <unordered_map>
46 #define NO_TRANSLATE_ISO "x-no-translate"
50 typedef std::unordered_map
<OString
, OString
>
53 typedef std::unordered_map
<OString
, bool>
56 #define SOURCE_LANGUAGE "en-US"
57 #define X_COMMENT "x-comment"
63 /// Purpose: holds mandatory data to export a single res
67 ResData( const OString
&rGId
);
68 ResData( const OString
&rGId
, const OString
&rFilename
);
87 /// Purpose: holds information of data to merge
90 friend class MergeDataFile
;
93 OStringBoolHashMap bTextFirst
;
94 OStringHashMap sQuickHelpText
;
95 OStringBoolHashMap bQuickHelpTextFirst
;
96 OStringHashMap sTitle
;
97 OStringBoolHashMap bTitleFirst
;
101 void InsertEntry(const OString
&rId
, const OString
&rText
,
102 const OString
&rQuickHelpText
, const OString
&rTitle
)
105 sText
[ rId
] = rText
;
106 bTextFirst
[ rId
] = true;
107 sQuickHelpText
[ rId
] = rQuickHelpText
;
108 bQuickHelpTextFirst
[ rId
] = true;
109 sTitle
[ rId
] = rTitle
;
110 bTitleFirst
[ rId
] = true;
112 bool GetText( OString
&rReturn
, const OString
&nLangIndex
, bool bDel
= false );
115 Generate QTZ string with ResData
116 For executable which works one language and without PO files.
118 static OString
GetQTZText(const ResData
& rResData
, const OString
& rOrigText
);
122 // class MergeDataFile
125 /// Purpose: holds information of data to merge, read from PO file
129 std::unordered_map
<OString
, std::unique_ptr
<MergeEntrys
>> aMap
;
130 std::set
<OString
> aLanguageSet
;
132 MergeEntrys
*GetMergeData( ResData
*pResData
, bool bCaseSensitive
= false );
133 void InsertEntry(const OString
&rTYP
, const OString
&rGID
,
134 const OString
&rLID
, const OString
&nLang
,
135 const OString
&rTEXT
, const OString
&rQHTEXT
,
136 const OString
&rTITLE
, const OString
&sFilename
,
137 bool bFirstLang
, bool bCaseSensitive
);
139 explicit MergeDataFile(
140 const OString
&rFileName
, const OString
& rFile
,
141 bool bCaseSensitive
, bool bWithQtz
= true );
145 std::vector
<OString
> GetLanguages() const;
147 MergeEntrys
*GetMergeEntrys( ResData
*pResData
);
148 MergeEntrys
*GetMergeEntrysCaseSensitive( ResData
*pResData
);
150 static OString
CreateKey(const OString
& rTYP
, const OString
& rGID
,
151 const OString
& rLID
, const OString
& rFilename
, bool bCaseSensitive
);
155 #endif // INCLUDED_L10NTOOLS_INC_EXPORT_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */