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_INC_DP_IDENTIFIER_HXX
25 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_INC_DP_IDENTIFIER_HXX
26 
27 #include "sal/config.h"
28 
29 #include "boost/optional.hpp"
30 #include "com/sun/star/uno/Reference.hxx"
31 
32 #include "dp_misc_api.hxx"
33 
34 namespace com { namespace sun { namespace star { namespace deployment {
35     class XPackage;
36 } } } }
37 namespace rtl { class OUString; }
38 
39 namespace dp_misc {
40 
41 /**
42    Generates an identifier from an optional identifier.
43 
44    @param optional
45    an optional identifier
46 
47    @param fileName
48    a file name
49 
50    @return
51    the given optional identifier if present, otherwise a legacy identifier based
52    on the given file name
53 */
54 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString generateIdentifier(
55     ::boost::optional< ::rtl::OUString > const & optional,
56     ::rtl::OUString const & fileName);
57 
58 /**
59    Gets the identifier of a package.
60 
61    @param package
62    a non-null package
63 
64    @return
65    the explicit identifier of the given package if present, otherwise the
66    implicit legacy identifier of the given package
67 
68    @throws com::sun::star::uno::RuntimeException
69 */
70 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString getIdentifier(
71     ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage >
72         const & package);
73 
74 /**
75    Generates a legacy identifier based on a file name.
76 
77    @param fileName
78    a file name
79 
80    @return
81    a legacy identifier based on the given file name
82 */
83 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString generateLegacyIdentifier(
84     ::rtl::OUString const & fileName);
85 
86 }
87 
88 #endif
89