Branch libreoffice-5-0-4
[LibreOffice.git] / include / cppuhelper / bootstrap.hxx
blobdebddcf18df2cb77667ed96d95fee60bfd006c70
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CPPUHELPER_BOOTSTRAP_HXX
20 #define INCLUDED_CPPUHELPER_BOOTSTRAP_HXX
22 #include <sal/config.h>
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <rtl/ustring.hxx>
25 #include <sal/types.h>
26 #include <cppuhelper/cppuhelperdllapi.h>
28 namespace com { namespace sun { namespace star {
29 namespace container { class XHierarchicalNameAccess; }
30 namespace uno { class XComponentContext; }
31 } } }
33 namespace cppu
36 /** Installs type description manager instance, i.e. registers a callback at cppu core.
38 @param xTDMgr manager instance
39 @return true, if successfully registered
41 CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager(
42 ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess > const & xTDMgr );
44 /** Bootstraps an initial component context with service manager upon
45 information from bootstrap variables.
47 This function tries to find its parameters via these bootstrap variables:
49 - UNO_TYPES -- a space separated list of file urls of type rdbs
50 - UNO_SERVICES -- a space separated list of file urls of service rdbs
52 Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
53 for further info.
55 @return component context
57 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SAL_CALL
58 defaultBootstrap_InitialComponentContext();
61 /** Bootstraps an initial component context with service manager upon
62 information from an ini file.
64 This function tries to find its parameters via these bootstrap variables:
66 - UNO_TYPES -- a space separated list of file urls of type rdbs
67 - UNO_SERVICES -- a space separated list of file urls of service rdbs
69 Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
70 for further info.
72 @param iniFile ini filename to get bootstrap variables
73 @return component context
75 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SAL_CALL
76 defaultBootstrap_InitialComponentContext(const ::rtl::OUString & iniFile);
78 /**
79 * An exception indicating a bootstrap error.
81 * @since UDK 3.2.0
83 class CPPUHELPER_DLLPUBLIC BootstrapException
85 public:
86 /**
87 * Constructs a BootstrapException.
89 BootstrapException();
91 /**
92 * Constructs a BootstrapException with the specified detail message.
94 * @param rMessage
95 * A message containing any details about the exception.
97 BootstrapException( const ::rtl::OUString & rMessage );
99 /**
100 * Copy constructs a BootstrapException.
102 BootstrapException( const BootstrapException & e );
105 * Destructs a BootstrapException.
107 virtual ~BootstrapException();
110 * Assigns a BootstrapException.
112 BootstrapException & operator=( const BootstrapException & e );
114 /** Gets the message.
116 @return
117 A reference to the message. The reference is valid for the lifetime of
118 this BootstrapException.
120 const ::rtl::OUString & getMessage() const;
122 private:
123 ::rtl::OUString m_aMessage;
127 * Bootstraps the component context from a UNO installation.
129 * @return a bootstrapped component context
130 * @exception BootstrapException
131 * Thrown in case bootstrap() signals an exception due to a
132 * bootstrap error.
134 * @since UDK 3.2.0
136 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
137 SAL_CALL bootstrap();
139 /// @cond INTERNAL
141 * Helper function to expand vnd.sun.star.expand URLs in contexts where no
142 * properly bootstrapped UNO is (yet) available.
144 * @param uri
145 * Some URI (but not a URI reference).
147 * @return
148 * If uri is a vnd.sun.star.expand URL, then the expansion of that URL is
149 * returned; expansion may lead to a string that is not a legal URI. Otherwise,
150 * the uri is returned unchanged.
152 * @exception com::sun::star::lang::IllegalArgumentException
153 * If uri is a vnd.sun.star.expand URL that contains unknown macros.
155 * @since UDK 3.2.8
157 CPPUHELPER_DLLPUBLIC ::rtl::OUString
158 SAL_CALL bootstrap_expandUri(::rtl::OUString const & uri);
159 /// @endcond
161 } // end namespace cppu
163 #endif
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */