CppunitTest_sc_tiledrendering2: move to tiledrendering folder
[LibreOffice.git] / l10ntools / inc / export.hxx
blob251d059ac2c6246ef3c0a9fb5f12288e0e7d55d3
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_EXPORT_HXX
21 #define INCLUDED_L10NTOOLS_INC_EXPORT_HXX
23 #include <sal/config.h>
25 #include <rtl/string.hxx>
27 #include <set>
28 #include <unordered_map>
29 #include <memory>
30 #include <vector>
31 #include <string_view>
33 #ifdef _WIN32
34 #include <direct.h>
35 #endif
37 #define NO_TRANSLATE_ISO "x-no-translate"
39 class MergeEntrys;
41 typedef std::unordered_map<OString, OString>
42 OStringHashMap;
44 typedef std::unordered_map<OString, bool>
45 OStringBoolHashMap;
47 #define SOURCE_LANGUAGE "en-US"
48 #define X_COMMENT "x-comment"
53 /// Purpose: holds mandatory data to export a single res
54 class ResData
56 public:
57 ResData( OString rGId );
58 ResData( OString sGId , OString sFilename );
60 OString sResTyp;
61 OString sId;
62 OString sGId;
63 OString sFilename;
65 OStringHashMap sText;
71 class ParserQueue;
75 /// Purpose: holds information of data to merge
76 class MergeEntrys
78 friend class MergeDataFile;
79 private:
80 OStringHashMap sText;
81 OStringBoolHashMap bTextFirst;
82 OStringHashMap sQuickHelpText;
83 OStringBoolHashMap bQuickHelpTextFirst;
84 OStringHashMap sTitle;
85 OStringBoolHashMap bTitleFirst;
87 public:
88 MergeEntrys(){};
89 void InsertEntry(const OString &rId, const OString &rText,
90 const OString &rQuickHelpText, const OString &rTitle)
93 sText[ rId ] = rText;
94 bTextFirst[ rId ] = true;
95 sQuickHelpText[ rId ] = rQuickHelpText;
96 bQuickHelpTextFirst[ rId ] = true;
97 sTitle[ rId ] = rTitle;
98 bTitleFirst[ rId ] = true;
100 bool GetText( OString &rReturn, const OString &nLangIndex, bool bDel = false );
103 Generate QTZ string with ResData
104 For executable which works one language and without PO files.
106 static OString GetQTZText(const ResData& rResData, std::string_view rOrigText);
112 /// Purpose: holds information of data to merge, read from PO file
113 class MergeDataFile
115 private:
116 std::unordered_map<OString, std::unique_ptr<MergeEntrys>> aMap;
117 std::set<OString> aLanguageSet;
119 MergeEntrys *GetMergeData( ResData *pResData , bool bCaseSensitive = false );
120 void InsertEntry(std::string_view rTYP, std::string_view rGID,
121 std::string_view rLID, const OString &nLang,
122 const OString &rTEXT, const OString &rQHTEXT,
123 const OString &rTITLE, std::string_view sFilename,
124 bool bFirstLang, bool bCaseSensitive);
125 public:
126 explicit MergeDataFile(
127 const OString &rFileName, std::string_view rFile,
128 bool bCaseSensitive, bool bWithQtz = true );
129 ~MergeDataFile();
132 std::vector<OString> GetLanguages() const;
134 MergeEntrys *GetMergeEntrys( ResData *pResData );
135 MergeEntrys *GetMergeEntrysCaseSensitive( ResData *pResData );
137 static OString CreateKey(std::string_view rTYP, std::string_view rGID,
138 std::string_view rLID, std::string_view rFilename, bool bCaseSensitive);
142 #endif // INCLUDED_L10NTOOLS_INC_EXPORT_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */