1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_MANAGER_DP_ACTIVEPACKAGES_HXX
29 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_MANAGER_DP_ACTIVEPACKAGES_HXX
30 
31 #include "sal/config.h"
32 
33 #include <utility>
34 #include <vector>
35 
36 #include "dp_persmap.h"
37 
38 namespace rtl { class OUString; }
39 
40 namespace dp_manager {
41 
42 class ActivePackages {
43 public:
44     struct Data {
45         Data(): failedPrerequisites(::rtl::OUString::valueOf((sal_Int32)0))
46             {}
47         /* name of the temporary file (shared, user extension) or the name of
48            the folder of the bundled extension.
49            It does not contain the trailing '_' of the folder.
50            UTF-8 encoded
51         */
52         ::rtl::OUString temporaryName;
53         /* The file name (shared, user) or the folder name (bundled)
54            If the key is the file name, then file name is not encoded.
55            If the key is the idendifier then the file name is UTF-8 encoded.
56          */
57         ::rtl::OUString fileName;
58         ::rtl::OUString mediaType;
59         ::rtl::OUString version;
60         /* If this string contains the value according to
61            com::sun::star::deployment::Prerequisites or "0". That is, if
62            the value is > 0 then
63            the call to XPackage::checkPrerequisites failed.
64            In this case the extension must not be registered.
65          */
66         ::rtl::OUString failedPrerequisites;
67     };
68 
69     typedef ::std::vector< ::std::pair< ::rtl::OUString, Data > > Entries;
70 
71     ActivePackages();
72 
73     ActivePackages(::rtl::OUString const & url, bool readOnly);
74 
75     ~ActivePackages();
76 
77     bool has(::rtl::OUString const & id, ::rtl::OUString const & fileName)
78         const;
79 
80     bool get(
81         Data * data, ::rtl::OUString const & id,
82         ::rtl::OUString const & fileName) const;
83 
84     Entries getEntries() const;
85 
86     void put(::rtl::OUString const & id, Data const & value);
87 
88     void erase(::rtl::OUString const & id, ::rtl::OUString const & fileName);
89 
90 private:
91     ActivePackages(ActivePackages &); // not defined
92     void operator =(ActivePackages &); // not defined
93 
94     ::dp_misc::PersistentMap m_map;
95 };
96 
97 }
98 
99 #endif
100