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