cid#1607171 Data race condition
[LibreOffice.git] / desktop / source / deployment / manager / dp_activepackages.hxx
blob105c34c31e8e496896711f87d0e11651b0561448
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 #pragma once
22 #include <config_extensions.h>
24 #include <sal/config.h>
25 #include <rtl/ustring.hxx>
27 #include <utility>
28 #include <vector>
30 #if HAVE_FEATURE_EXTENSIONS
31 #include <dp_persmap.h>
32 #endif
35 namespace dp_manager {
37 class ActivePackages {
38 public:
39 struct Data {
40 Data(): failedPrerequisites(u"0"_ustr)
42 /* name of the temporary file (shared, user extension) or the name of
43 the folder of the bundled extension.
44 It does not contain the trailing '_' of the folder.
45 UTF-8 encoded
47 OUString temporaryName;
48 /* The file name (shared, user) or the folder name (bundled)
49 If the key is the file name, then file name is not encoded.
50 If the key is the identifier then the file name is UTF-8 encoded.
52 OUString fileName;
53 OUString mediaType;
54 OUString version;
55 /* If this string contains the value according to
56 css::deployment::Prerequisites or "0". That is, if
57 the value is > 0 then
58 the call to XPackage::checkPrerequisites failed.
59 In this case the extension must not be registered.
61 OUString failedPrerequisites;
64 typedef std::vector< std::pair< OUString, Data > > Entries;
66 ActivePackages();
68 explicit ActivePackages(OUString const & url);
70 ~ActivePackages();
72 bool has(OUString const & id, OUString const & fileName)
73 const;
75 bool get(
76 Data * data, OUString const & id,
77 OUString const & fileName) const;
79 Entries getEntries() const;
81 void put(OUString const & id, Data const & value);
83 void erase(OUString const & id, OUString const & fileName);
85 private:
86 ActivePackages(ActivePackages const &) = delete;
87 ActivePackages& operator =(ActivePackages const &) = delete;
88 #if HAVE_FEATURE_EXTENSIONS
89 ::dp_misc::PersistentMap m_map;
90 #endif
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */