Avoid potential negative array index access to cached text.
[LibreOffice.git] / include / cppuhelper / bootstrap.hxx
blobb8cc113f57c61ce0d19bdb2844436e0670a54a66
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 .
21 * This file is part of LibreOffice published API.
23 #ifndef INCLUDED_CPPUHELPER_BOOTSTRAP_HXX
24 #define INCLUDED_CPPUHELPER_BOOTSTRAP_HXX
26 #include "sal/config.h"
27 #include "com/sun/star/uno/Reference.h"
28 #include "rtl/ustring.hxx"
29 #include "sal/types.h"
30 #include "cppuhelper/cppuhelperdllapi.h"
32 namespace com { namespace sun { namespace star {
33 namespace container { class XHierarchicalNameAccess; }
34 namespace uno { class XComponentContext; }
35 } } }
37 namespace cppu
40 /** Installs type description manager instance, i.e. registers a callback at cppu core.
42 @param xTDMgr manager instance
43 @return true, if successfully registered
45 CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager(
46 css::uno::Reference< css::container::XHierarchicalNameAccess > const & xTDMgr );
48 /** Bootstraps an initial component context with service manager upon
49 information from bootstrap variables.
51 This function tries to find its parameters via these bootstrap variables:
53 - UNO_TYPES -- a space separated list of file urls of type rdbs
54 - UNO_SERVICES -- a space separated list of file urls of service rdbs
56 Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
57 for further info.
59 @return component context
61 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL
62 defaultBootstrap_InitialComponentContext();
65 /** Bootstraps an initial component context with service manager upon
66 information from an ini file.
68 This function tries to find its parameters via these bootstrap variables:
70 - UNO_TYPES -- a space separated list of file urls of type rdbs
71 - UNO_SERVICES -- a space separated list of file urls of service rdbs
73 Please look at http://udk.openoffice.org/common/man/concept/uno_default_bootstrapping.html
74 for further info.
76 @param iniFile ini filename to get bootstrap variables
77 @return component context
79 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL
80 defaultBootstrap_InitialComponentContext(const ::rtl::OUString & iniFile);
82 /**
83 * An exception indicating a bootstrap error.
85 * @since UDK 3.2.0
87 class CPPUHELPER_DLLPUBLIC BootstrapException
89 public:
90 /**
91 * Constructs a BootstrapException.
93 BootstrapException();
95 /**
96 * Constructs a BootstrapException with the specified detail message.
98 * @param rMessage
99 * A message containing any details about the exception.
101 BootstrapException( const ::rtl::OUString & rMessage );
104 * Copy constructs a BootstrapException.
106 BootstrapException( const BootstrapException & e );
109 * Destructs a BootstrapException.
111 virtual ~BootstrapException();
114 * Assigns a BootstrapException.
116 BootstrapException & operator=( const BootstrapException & e );
118 /** Gets the message.
120 @return
121 A reference to the message. The reference is valid for the lifetime of
122 this BootstrapException.
124 const ::rtl::OUString & getMessage() const;
126 private:
127 ::rtl::OUString m_aMessage;
131 * Bootstraps the component context from a UNO installation.
133 * @return a bootstrapped component context
134 * @exception BootstrapException
135 * Thrown in case bootstrap() signals an exception due to a
136 * bootstrap error.
138 * @since UDK 3.2.0
140 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext >
141 SAL_CALL bootstrap();
143 /// @cond INTERNAL
145 * Helper function to expand vnd.sun.star.expand URLs in contexts where no
146 * properly bootstrapped UNO is (yet) available.
148 * @param uri
149 * Some URI (but not a URI reference).
151 * @return
152 * If uri is a vnd.sun.star.expand URL, then the expansion of that URL is
153 * returned; expansion may lead to a string that is not a legal URI. Otherwise,
154 * the uri is returned unchanged.
156 * @exception css::lang::IllegalArgumentException
157 * If uri is a vnd.sun.star.expand URL that contains unknown macros.
159 * @since UDK 3.2.8
161 CPPUHELPER_DLLPUBLIC ::rtl::OUString
162 SAL_CALL bootstrap_expandUri(::rtl::OUString const & uri);
163 /// @endcond
165 } // end namespace cppu
167 #endif
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */