/src/libreoffice/desktop/source/deployment/manager/dp_activepackages.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include <config_extensions.h> |
23 | | |
24 | | #include <sal/config.h> |
25 | | #include <rtl/ustring.hxx> |
26 | | |
27 | | #include <utility> |
28 | | #include <vector> |
29 | | |
30 | | #if HAVE_FEATURE_EXTENSIONS |
31 | | #include <dp_persmap.h> |
32 | | #endif |
33 | | |
34 | | |
35 | | namespace dp_manager { |
36 | | |
37 | | class ActivePackages { |
38 | | public: |
39 | | struct Data { |
40 | 0 | Data(): failedPrerequisites(u"0"_ustr) |
41 | 0 | {} |
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 |
46 | | */ |
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. |
51 | | */ |
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. |
60 | | */ |
61 | | OUString failedPrerequisites; |
62 | | }; |
63 | | |
64 | | typedef std::vector< std::pair< OUString, Data > > Entries; |
65 | | |
66 | | ActivePackages(); |
67 | | |
68 | | explicit ActivePackages(OUString const & url); |
69 | | |
70 | | ~ActivePackages(); |
71 | | |
72 | | bool has(OUString const & id, OUString const & fileName) |
73 | | const; |
74 | | |
75 | | bool get( |
76 | | Data * data, OUString const & id, |
77 | | OUString const & fileName) const; |
78 | | |
79 | | Entries getEntries() const; |
80 | | |
81 | | void put(OUString const & id, Data const & value); |
82 | | |
83 | | void erase(OUString const & id, OUString const & fileName); |
84 | | |
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 |
91 | | }; |
92 | | |
93 | | } |
94 | | |
95 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |