LibreOffice LibreOffice 4.1 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bootstrap.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19 #ifndef _RTL_BOOTSTRAP_HXX_
20 #define _RTL_BOOTSTRAP_HXX_
21 #include <rtl/ustring.hxx>
22 #include <rtl/bootstrap.h>
23
24 namespace rtl
25 {
26 class Bootstrap
27 {
28 void * _handle;
29
30 inline Bootstrap( Bootstrap const & ); // not impl
31 inline Bootstrap & operator = ( Bootstrap const & ); // not impl
32
33 public:
37 static inline void SAL_CALL setIniFilename( const ::rtl::OUString &sFileUri );
38
46 static inline sal_Bool get(
47 const ::rtl::OUString &sName,
48 ::rtl::OUString &outValue );
49
59 static inline void get(
60 const ::rtl::OUString &sName,
61 ::rtl::OUString &outValue,
62 const ::rtl::OUString &aDefault );
63
73 static inline void set( ::rtl::OUString const & name, ::rtl::OUString const & value )
74 SAL_THROW(());
75
78 inline Bootstrap();
79
83 inline Bootstrap(const OUString & iniName);
84
88 inline ~Bootstrap();
89
97 inline sal_Bool getFrom(const ::rtl::OUString &sName,
98 ::rtl::OUString &outValue) const;
99
106 inline void getFrom(const ::rtl::OUString &sName,
107 ::rtl::OUString &outValue,
108 const ::rtl::OUString &aDefault) const;
109
113 inline void getIniName(::rtl::OUString & iniName) const;
114
119 inline void expandMacrosFrom( ::rtl::OUString & macro ) const SAL_THROW(())
120 { rtl_bootstrap_expandMacros_from_handle( _handle, &macro.pData ); }
121
126 static inline void expandMacros( ::rtl::OUString & macro ) SAL_THROW(())
127 { rtl_bootstrap_expandMacros( &macro.pData ); }
128
133 inline rtlBootstrapHandle getHandle() const SAL_THROW(())
134 { return _handle; }
135
147 static inline ::rtl::OUString encode( ::rtl::OUString const & value )
148 SAL_THROW(());
149 };
150
151 //----------------------------------------------------------------------------
152 // IMPLEMENTATION
153 //----------------------------------------------------------------------------
154 inline void Bootstrap::setIniFilename( const ::rtl::OUString &sFile )
155 {
156 rtl_bootstrap_setIniFileName( sFile.pData );
157 }
158
159 inline sal_Bool Bootstrap::get( const ::rtl::OUString &sName,
160 ::rtl::OUString & outValue )
161 {
162 return rtl_bootstrap_get( sName.pData , &(outValue.pData) , 0 );
163 }
164
165 inline void Bootstrap::get( const ::rtl::OUString &sName,
166 ::rtl::OUString & outValue,
167 const ::rtl::OUString & sDefault )
168 {
169 rtl_bootstrap_get( sName.pData , &(outValue.pData) , sDefault.pData );
170 }
171
172 inline void Bootstrap::set( ::rtl::OUString const & name, ::rtl::OUString const & value )
173 SAL_THROW(())
174 {
175 rtl_bootstrap_set( name.pData, value.pData );
176 }
177
178 inline Bootstrap::Bootstrap()
179 {
180 _handle = 0;
181 }
182
183 inline Bootstrap::Bootstrap(const OUString & iniName)
184 {
185 if(!iniName.isEmpty())
186 _handle = rtl_bootstrap_args_open(iniName.pData);
187
188 else
189 _handle = 0;
190 }
191
192 inline Bootstrap::~Bootstrap()
193 {
194 rtl_bootstrap_args_close(_handle);
195 }
196
197
198 inline sal_Bool Bootstrap::getFrom(const ::rtl::OUString &sName,
199 ::rtl::OUString &outValue) const
200 {
201 return rtl_bootstrap_get_from_handle(_handle, sName.pData, &outValue.pData, 0);
202 }
203
204 inline void Bootstrap::getFrom(const ::rtl::OUString &sName,
205 ::rtl::OUString &outValue,
206 const ::rtl::OUString &aDefault) const
207 {
208 rtl_bootstrap_get_from_handle(_handle, sName.pData, &outValue.pData, aDefault.pData);
209 }
210
211 inline void Bootstrap::getIniName(::rtl::OUString & iniName) const
212 {
213 rtl_bootstrap_get_iniName_from_handle(_handle, &iniName.pData);
214 }
215
216 inline ::rtl::OUString Bootstrap::encode( ::rtl::OUString const & value )
217 SAL_THROW(())
218 {
219 ::rtl::OUString encoded;
220 rtl_bootstrap_encode(value.pData, &encoded.pData);
221 return encoded;
222 }
223 }
224 #endif
225
226 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl_bootstrap_get_from_handle
SAL_DLLPUBLIC sal_Bool rtl_bootstrap_get_from_handle(rtlBootstrapHandle handle, rtl_uString *pName, rtl_uString **ppValue, rtl_uString *pDefault) SAL_THROW_EXTERN_C()
rtlBootstrapHandle
void * rtlBootstrapHandle
Definition: bootstrap.h:157
rtl::Bootstrap::expandMacros
static void expandMacros(::rtl::OUString &macro)
Expands a macro using default bootstrap variables.
Definition: bootstrap.hxx:126
rtl::Bootstrap::getFrom
sal_Bool getFrom(const ::rtl::OUString &sName,::rtl::OUString &outValue) const
Retrieves a bootstrap argument.
Definition: bootstrap.hxx:198
rtl_bootstrap_setIniFileName
SAL_DLLPUBLIC void rtl_bootstrap_setIniFileName(rtl_uString *pFileUri) SAL_THROW_EXTERN_C()
may be called by an application to set an ini-filename.
rtl::Bootstrap::getHandle
rtlBootstrapHandle getHandle() const
Provides the bootstrap internal handle.
Definition: bootstrap.hxx:133
rtl_bootstrap_expandMacros
SAL_DLLPUBLIC void rtl_bootstrap_expandMacros(rtl_uString **macro) SAL_THROW_EXTERN_C()
Expands a macro using default bootstrap variables.
rtl::OUString::pData
pData
Definition: ustring.hxx:200
ustring.hxx
rtl::Bootstrap::encode
static inline::rtl::OUString encode(::rtl::OUString const &value)
Escapes special characters (&quot;$&quot; and &quot;\&quot;).
Definition: bootstrap.hxx:216
sal_Bool
unsigned char sal_Bool
Definition: types.h:37
rtl_bootstrap_expandMacros_from_handle
SAL_DLLPUBLIC void rtl_bootstrap_expandMacros_from_handle(rtlBootstrapHandle handle, rtl_uString **macro) SAL_THROW_EXTERN_C()
Expands a macro using bootstrap variables.
rtl_bootstrap_get
SAL_DLLPUBLIC sal_Bool rtl_bootstrap_get(rtl_uString *pName, rtl_uString **ppValue, rtl_uString *pDefault) SAL_THROW_EXTERN_C()
rtl_bootstrap_encode
SAL_DLLPUBLIC void rtl_bootstrap_encode(rtl_uString const *value, rtl_uString **encoded) SAL_THROW_EXTERN_C()
Escapes special characters (&quot;$&quot; and &quot;\&quot;).
rtl::Bootstrap
Definition: bootstrap.hxx:26
rtl::OUString
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:87
bootstrap.h
The described concept provides a platform independent way to access minimum bootstrap settings for ev...
rtl::Bootstrap::setIniFilename
static void setIniFilename(const ::rtl::OUString &sFileUri)
Definition: bootstrap.hxx:154
rtl_bootstrap_set
SAL_DLLPUBLIC void rtl_bootstrap_set(rtl_uString *pName, rtl_uString *pValue) SAL_THROW_EXTERN_C()
Sets a bootstrap parameter.
rtl::Bootstrap::get
static sal_Bool get(const ::rtl::OUString &sName,::rtl::OUString &outValue)
Retrieves a bootstrap parameter.
Definition: bootstrap.hxx:159
rtl::Bootstrap::set
static void set(::rtl::OUString const &name,::rtl::OUString const &value)
Sets a bootstrap parameter.
Definition: bootstrap.hxx:172
rtl::Bootstrap::~Bootstrap
~Bootstrap()
Closes a bootstrap argument container.
Definition: bootstrap.hxx:192
rtl_bootstrap_args_close
SAL_DLLPUBLIC void rtl_bootstrap_args_close(rtlBootstrapHandle handle) SAL_THROW_EXTERN_C()
Closes a boostrap agument container.
rtl::OUString::isEmpty
bool isEmpty() const
Checks if a string is empty.
Definition: ustring.hxx:418
SAL_THROW
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:356
rtl_bootstrap_get_iniName_from_handle
SAL_DLLPUBLIC void rtl_bootstrap_get_iniName_from_handle(rtlBootstrapHandle handle, rtl_uString **ppIniName) SAL_THROW_EXTERN_C()
Returns the name of the inifile associated with this handle.
rtl::Bootstrap::expandMacrosFrom
void expandMacrosFrom(::rtl::OUString &macro) const
Expands a macro using bootstrap variables.
Definition: bootstrap.hxx:119
rtl::Bootstrap::getIniName
void getIniName(::rtl::OUString &iniName) const
Retrieves the name of the underlying ini-file.
Definition: bootstrap.hxx:211
rtl::Bootstrap::Bootstrap
Bootstrap()
default ctor.
Definition: bootstrap.hxx:178
rtl_bootstrap_args_open
SAL_DLLPUBLIC rtlBootstrapHandle rtl_bootstrap_args_open(rtl_uString *pIniName) SAL_THROW_EXTERN_C()
Opens a bootstrap argument container.