20#include <config_extensions.h>
27#include <osl/diagnose.h>
28#include <rtl/string.hxx>
29#include <rtl/textenc.h>
30#include <rtl/ustring.hxx>
42#if HAVE_FEATURE_EXTENSIONS
48OString oldKey(std::u16string_view fileName) {
52OString newKey(std::u16string_view
id) {
57 OUString
const & fileName, OString
const & value)
60 sal_Int32
i =
value.indexOf(
';');
62 d.temporaryName = OUString(
value.getStr(), i, RTL_TEXTENCODING_UTF8);
63 d.fileName = fileName;
64 d.mediaType = OUString(
65 value.getStr() + i + 1,
value.getLength() - i - 1,
66 RTL_TEXTENCODING_UTF8);
72 sal_Int32 i1 =
value.indexOf(separator);
74 d.temporaryName = OUString(
75 value.getStr(), i1, RTL_TEXTENCODING_UTF8);
76 sal_Int32 i2 =
value.indexOf(separator, i1 + 1);
78 d.fileName = OUString(
79 value.getStr() + i1 + 1, i2 - i1 - 1, RTL_TEXTENCODING_UTF8);
80 sal_Int32 i3 =
value.indexOf(separator, i2 + 1);
85 d.mediaType = OUString(
86 value.getStr() + i2 + 1,
value.getLength() - i2 - 1,
87 RTL_TEXTENCODING_UTF8);
91 sal_Int32 i4 =
value.indexOf(separator, i3 + 1);
92 d.mediaType = OUString(
93 value.getStr() + i2 + 1, i3 - i2 -1, RTL_TEXTENCODING_UTF8);
95 value.getStr() + i3 + 1, i4 - i3 - 1,
96 RTL_TEXTENCODING_UTF8);
97 d.failedPrerequisites = OUString(
98 value.getStr() + i4 + 1,
value.getLength() - i4 - 1,
99 RTL_TEXTENCODING_UTF8);
112#if HAVE_FEATURE_EXTENSIONS
116#if !HAVE_FEATURE_EXTENSIONS
124 OUString
const &
id, OUString
const & fileName)
const
126 return get(
nullptr,
id, fileName);
130 Data * data, OUString
const &
id, OUString
const & fileName)
133#if HAVE_FEATURE_EXTENSIONS
135 if (
m_map.get(&
v, newKey(
id))) {
136 if (data !=
nullptr) {
137 *data = decodeNewData(
v);
140 }
else if (
m_map.get(&
v, oldKey(fileName))) {
141 if (data !=
nullptr) {
142 *data = decodeOldData(fileName,
v);
159#if HAVE_FEATURE_EXTENSIONS
161 for (
auto const& elem :
m)
163 if (!elem.first.isEmpty() && elem.first[0] ==
separator[0]) {
166 elem.first.getStr() + 1, elem.first.getLength() - 1,
167 RTL_TEXTENCODING_UTF8),
168 decodeNewData(elem.second));
171 OStringToOUString(elem.first, RTL_TEXTENCODING_UTF8));
174 decodeOldData(fn, elem.second));
184#if HAVE_FEATURE_EXTENSIONS
195 m_map.put(newKey(
id), b);
204 OUString
const &
id, OUString
const & fileName)
206#if HAVE_FEATURE_EXTENSIONS
207 m_map.erase(newKey(
id)) ||
m_map.erase(oldKey(fileName));
bool has(OUString const &id, OUString const &fileName) const
bool get(Data *data, OUString const &id, OUString const &fileName) const
std::vector< std::pair< OUString, Data > > Entries
Entries getEntries() const
void erase(OUString const &id, OUString const &fileName)
void put(OUString const &id, Data const &value)
std::unordered_map< OString, OString > t_string2string_map
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString generateLegacyIdentifier(std::u16string_view fileName)
Generates a legacy identifier based on a file name.
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
OUString failedPrerequisites