Line data Source code
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 INCLUDED_CPPUHELPER_TYPEPROVIDER_HXX
20 : #define INCLUDED_CPPUHELPER_TYPEPROVIDER_HXX
21 :
22 : #include <rtl/alloc.h>
23 : #include <rtl/uuid.h>
24 : #include <com/sun/star/uno/Sequence.hxx>
25 : #include <cppuhelper/cppuhelperdllapi.h>
26 :
27 :
28 : namespace cppu
29 : {
30 :
31 : /** Helper class to implement com::sun::star::lang::XTypeProvider. Construct a static object
32 : of this class with your UNO object's supported types.
33 : */
34 376 : class CPPUHELPER_DLLPUBLIC OTypeCollection
35 : {
36 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > _aTypes;
37 :
38 : public:
39 : /// @cond INTERNAL
40 : // these are here to force memory de/allocation to sal lib.
41 0 : inline static void * SAL_CALL operator new( size_t nSize )
42 0 : { return ::rtl_allocateMemory( nSize ); }
43 0 : inline static void SAL_CALL operator delete( void * pMem )
44 0 : { ::rtl_freeMemory( pMem ); }
45 : inline static void * SAL_CALL operator new( size_t, void * pMem )
46 : { return pMem; }
47 : inline static void SAL_CALL operator delete( void *, void * )
48 : {}
49 : /// @endcond
50 :
51 0 : inline OTypeCollection( const OTypeCollection & rCollection )
52 0 : : _aTypes( rCollection._aTypes )
53 0 : {}
54 : OTypeCollection(
55 : const ::com::sun::star::uno::Type & rType1,
56 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
57 : OTypeCollection(
58 : const ::com::sun::star::uno::Type & rType1,
59 : const ::com::sun::star::uno::Type & rType2,
60 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
61 : OTypeCollection(
62 : const ::com::sun::star::uno::Type & rType1,
63 : const ::com::sun::star::uno::Type & rType2,
64 : const ::com::sun::star::uno::Type & rType3,
65 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
66 : OTypeCollection(
67 : const ::com::sun::star::uno::Type & rType1,
68 : const ::com::sun::star::uno::Type & rType2,
69 : const ::com::sun::star::uno::Type & rType3,
70 : const ::com::sun::star::uno::Type & rType4,
71 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
72 : OTypeCollection(
73 : const ::com::sun::star::uno::Type & rType1,
74 : const ::com::sun::star::uno::Type & rType2,
75 : const ::com::sun::star::uno::Type & rType3,
76 : const ::com::sun::star::uno::Type & rType4,
77 : const ::com::sun::star::uno::Type & rType5,
78 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
79 : OTypeCollection(
80 : const ::com::sun::star::uno::Type & rType1,
81 : const ::com::sun::star::uno::Type & rType2,
82 : const ::com::sun::star::uno::Type & rType3,
83 : const ::com::sun::star::uno::Type & rType4,
84 : const ::com::sun::star::uno::Type & rType5,
85 : const ::com::sun::star::uno::Type & rType6,
86 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
87 : OTypeCollection(
88 : const ::com::sun::star::uno::Type & rType1,
89 : const ::com::sun::star::uno::Type & rType2,
90 : const ::com::sun::star::uno::Type & rType3,
91 : const ::com::sun::star::uno::Type & rType4,
92 : const ::com::sun::star::uno::Type & rType5,
93 : const ::com::sun::star::uno::Type & rType6,
94 : const ::com::sun::star::uno::Type & rType7,
95 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
96 : OTypeCollection(
97 : const ::com::sun::star::uno::Type & rType1,
98 : const ::com::sun::star::uno::Type & rType2,
99 : const ::com::sun::star::uno::Type & rType3,
100 : const ::com::sun::star::uno::Type & rType4,
101 : const ::com::sun::star::uno::Type & rType5,
102 : const ::com::sun::star::uno::Type & rType6,
103 : const ::com::sun::star::uno::Type & rType7,
104 : const ::com::sun::star::uno::Type & rType8,
105 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
106 : OTypeCollection(
107 : const ::com::sun::star::uno::Type & rType1,
108 : const ::com::sun::star::uno::Type & rType2,
109 : const ::com::sun::star::uno::Type & rType3,
110 : const ::com::sun::star::uno::Type & rType4,
111 : const ::com::sun::star::uno::Type & rType5,
112 : const ::com::sun::star::uno::Type & rType6,
113 : const ::com::sun::star::uno::Type & rType7,
114 : const ::com::sun::star::uno::Type & rType8,
115 : const ::com::sun::star::uno::Type & rType9,
116 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
117 : OTypeCollection(
118 : const ::com::sun::star::uno::Type & rType1,
119 : const ::com::sun::star::uno::Type & rType2,
120 : const ::com::sun::star::uno::Type & rType3,
121 : const ::com::sun::star::uno::Type & rType4,
122 : const ::com::sun::star::uno::Type & rType5,
123 : const ::com::sun::star::uno::Type & rType6,
124 : const ::com::sun::star::uno::Type & rType7,
125 : const ::com::sun::star::uno::Type & rType8,
126 : const ::com::sun::star::uno::Type & rType9,
127 : const ::com::sun::star::uno::Type & rType10,
128 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
129 : OTypeCollection(
130 : const ::com::sun::star::uno::Type & rType1,
131 : const ::com::sun::star::uno::Type & rType2,
132 : const ::com::sun::star::uno::Type & rType3,
133 : const ::com::sun::star::uno::Type & rType4,
134 : const ::com::sun::star::uno::Type & rType5,
135 : const ::com::sun::star::uno::Type & rType6,
136 : const ::com::sun::star::uno::Type & rType7,
137 : const ::com::sun::star::uno::Type & rType8,
138 : const ::com::sun::star::uno::Type & rType9,
139 : const ::com::sun::star::uno::Type & rType10,
140 : const ::com::sun::star::uno::Type & rType11,
141 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
142 : OTypeCollection(
143 : const ::com::sun::star::uno::Type & rType1,
144 : const ::com::sun::star::uno::Type & rType2,
145 : const ::com::sun::star::uno::Type & rType3,
146 : const ::com::sun::star::uno::Type & rType4,
147 : const ::com::sun::star::uno::Type & rType5,
148 : const ::com::sun::star::uno::Type & rType6,
149 : const ::com::sun::star::uno::Type & rType7,
150 : const ::com::sun::star::uno::Type & rType8,
151 : const ::com::sun::star::uno::Type & rType9,
152 : const ::com::sun::star::uno::Type & rType10,
153 : const ::com::sun::star::uno::Type & rType11,
154 : const ::com::sun::star::uno::Type & rType12,
155 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > & rAddTypes = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >() );
156 :
157 : /** Called upon XTypeProvider::getTypes().
158 :
159 : @return type collection
160 : */
161 730 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
162 730 : { return _aTypes; }
163 : };
164 :
165 : /** Helper class to implement IDs for XUnoTunnel. Construct a static object
166 : of this class for your UNO object's implementation id.
167 : */
168 : class CPPUHELPER_DLLPUBLIC OImplementationId
169 : {
170 : mutable ::com::sun::star::uno::Sequence< sal_Int8 > * _pSeq;
171 : sal_Bool _bUseEthernetAddress;
172 :
173 : public:
174 : /// @cond INTERNAL
175 :
176 : // these are here to force memory de/allocation to sal lib.
177 : inline static void * SAL_CALL operator new( size_t nSize )
178 : { return ::rtl_allocateMemory( nSize ); }
179 : inline static void SAL_CALL operator delete( void * pMem )
180 : { ::rtl_freeMemory( pMem ); }
181 : inline static void * SAL_CALL operator new( size_t, void * pMem )
182 : { return pMem; }
183 : inline static void SAL_CALL operator delete( void *, void * )
184 : {}
185 :
186 : ~OImplementationId();
187 :
188 : /// @endcond
189 :
190 : /** Constructor.
191 :
192 : @param bUseEthernetAddress whether an ethernet mac address should be taken into account
193 : */
194 464 : inline OImplementationId( bool bUseEthernetAddress = true )
195 : : _pSeq( 0 )
196 464 : , _bUseEthernetAddress( bUseEthernetAddress )
197 464 : {}
198 : /** Constructor giving implementation id.
199 :
200 : @param rSeq implementation id
201 : */
202 : inline OImplementationId( const ::com::sun::star::uno::Sequence< sal_Int8 > & rSeq )
203 : : _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rSeq ) )
204 : , _bUseEthernetAddress( false )
205 : {}
206 : inline OImplementationId( const OImplementationId & rId )
207 : : _pSeq( new ::com::sun::star::uno::Sequence< sal_Int8 >( rId.getImplementationId() ) )
208 : , _bUseEthernetAddress( false )
209 : {}
210 :
211 : /** Get implementation id.
212 :
213 : @return implementation id
214 : */
215 : ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() const;
216 : };
217 :
218 : }
219 :
220 : #endif
221 :
222 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|