1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_MANAGER_DP_ACTIVEPACKAGES_HXX
25 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_MANAGER_DP_ACTIVEPACKAGES_HXX
26 
27 #include "sal/config.h"
28 
29 #include <utility>
30 #include <vector>
31 
32 #include "dp_persmap.h"
33 
34 namespace rtl { class OUString; }
35 
36 namespace dp_manager {
37 
38 class ActivePackages {
39 public:
40     struct Data {
Datadp_manager::ActivePackages::Data41         Data(): failedPrerequisites(::rtl::OUString::valueOf((sal_Int32)0))
42             {}
43         /* name of the temporary file (shared, user extension) or the name of
44            the folder of the bundled extension.
45            It does not contain the trailing '_' of the folder.
46            UTF-8 encoded
47         */
48         ::rtl::OUString temporaryName;
49         /* The file name (shared, user) or the folder name (bundled)
50            If the key is the file name, then file name is not encoded.
51            If the key is the idendifier then the file name is UTF-8 encoded.
52          */
53         ::rtl::OUString fileName;
54         ::rtl::OUString mediaType;
55         ::rtl::OUString version;
56         /* If this string contains the value according to
57            com::sun::star::deployment::Prerequisites or "0". That is, if
58            the value is > 0 then
59            the call to XPackage::checkPrerequisites failed.
60            In this case the extension must not be registered.
61          */
62         ::rtl::OUString failedPrerequisites;
63     };
64 
65     typedef ::std::vector< ::std::pair< ::rtl::OUString, Data > > Entries;
66 
67     ActivePackages();
68 
69     ActivePackages(::rtl::OUString const & url, bool readOnly);
70 
71     ~ActivePackages();
72 
73     bool has(::rtl::OUString const & id, ::rtl::OUString const & fileName)
74         const;
75 
76     bool get(
77         Data * data, ::rtl::OUString const & id,
78         ::rtl::OUString const & fileName) const;
79 
80     Entries getEntries() const;
81 
82     void put(::rtl::OUString const & id, Data const & value);
83 
84     void erase(::rtl::OUString const & id, ::rtl::OUString const & fileName);
85 
86 private:
87     ActivePackages(ActivePackages &); // not defined
88     void operator =(ActivePackages &); // not defined
89 
90     ::dp_misc::PersistentMap m_map;
91 };
92 
93 }
94 
95 #endif
96