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