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