LibreOffice LibreOffice 5.3 SDK C/C++ API Reference

Type.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 INCLUDED_COM_SUN_STAR_UNO_TYPE_HXX
20 #define INCLUDED_COM_SUN_STAR_UNO_TYPE_HXX
21
22 #include <sal/config.h>
23
24 #include <cstddef>
25
26 #include <com/sun/star/uno/Type.h>
27 #include <cppu/unotype.hxx>
28
29 namespace com
30 {
31 namespace sun
32 {
33 namespace star
34 {
35 namespace uno
36 {
37
38
39 inline Type::Type()
40 {
41 _pType = reinterpret_cast< const ::com::sun::star::uno::Type * >(
42 ::typelib_static_type_getByTypeClass( typelib_TypeClass_VOID ) )->getTypeLibType();
43 ::typelib_typedescriptionreference_acquire( _pType );
44 }
45
46 inline Type::Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName )
47 : _pType( NULL )
48 {
49 ::typelib_typedescriptionreference_new( &_pType, (typelib_TypeClass)eTypeClass, rTypeName.pData );
50 }
51
52 inline Type::Type( TypeClass eTypeClass, const sal_Char * pTypeName )
53 : _pType( NULL )
54 {
55 ::typelib_typedescriptionreference_newByAsciiName( &_pType, (typelib_TypeClass)eTypeClass, pTypeName );
56 }
57
58 inline Type::Type( typelib_TypeDescriptionReference * pType )
59 : _pType( pType )
60 {
61 ::typelib_typedescriptionreference_acquire( _pType );
62 }
63
64 inline Type::Type( typelib_TypeDescriptionReference * pType, UnoType_NoAcquire )
65 : _pType( pType )
66 {
67 }
68
69 inline Type::Type( typelib_TypeDescriptionReference * pType, __sal_NoAcquire )
70 : _pType( pType )
71 {
72 }
73
74 inline Type::Type( const Type & rType )
75 : _pType( rType._pType )
76 {
77 ::typelib_typedescriptionreference_acquire( _pType );
78 }
79
80 inline ::rtl::OUString Type::getTypeName() const
81 {
82 return ::rtl::OUString( _pType->pTypeName );
83 }
84
85 inline Type & Type::operator = ( const Type & rType )
86 {
87 ::typelib_typedescriptionreference_assign( &_pType, rType._pType );
88 return *this;
89 }
90
91
92 template< class T >
93 typelib_TypeDescriptionReference * Array< T >::s_pType = NULL;
94
95 }
96 }
97 }
98 }
99
100 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Type * )
101 {
102 return ::cppu::UnoType< ::com::sun::star::uno::Type >::get();
103 }
104
105 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType()
106 {
107 return ::cppu::UnoType<void>::get();
108 }
109 inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType()
110 {
111 return ::cppu::UnoType<void>::get();
112 }
113
114 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType()
115 {
116 return ::cppu::UnoType< bool >::get();
117 }
118 inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType()
119 {
120 return ::cppu::UnoType< bool >::get();
121 }
122 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Bool * )
123 {
124 return ::cppu::UnoType< bool >::get();
125 }
126
127 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
128 SAL_UNUSED_PARAMETER bool const * )
129 {
130 return ::cppu::UnoType< bool >::get();
131 }
132
133 inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType()
134 {
135 return ::cppu::UnoType< ::cppu::UnoCharType >::get();
136 }
137 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType()
138 {
139 return ::cppu::UnoType< ::cppu::UnoCharType >::get();
140 }
141
142 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int8 * )
143 {
144 return ::cppu::UnoType< ::sal_Int8 >::get();
145 }
146
147 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::rtl::OUString * )
148 {
149 return ::cppu::UnoType< ::rtl::OUString >::get();
150 }
151
152 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int16 * )
153 {
154 return ::cppu::UnoType< ::sal_Int16 >::get();
155 }
156
157 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt16 * )
158 {
159 return ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get();
160 }
161
162 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int32 * )
163 {
164 return ::cppu::UnoType< ::sal_Int32 >::get();
165 }
166
167 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt32 * )
168 {
169 return ::cppu::UnoType< ::sal_uInt32 >::get();
170 }
171
172 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int64 * )
173 {
174 return ::cppu::UnoType< ::sal_Int64 >::get();
175 }
176
177 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt64 * )
178 {
179 return ::cppu::UnoType< ::sal_uInt64 >::get();
180 }
181
182 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const float * )
183 {
184 return ::cppu::UnoType< float >::get();
185 }
186
187 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const double * )
188 {
189 return ::cppu::UnoType< double >::get();
190 }
191
192 template< typename T >
193 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType()
194 {
195 return ::cppu::UnoType< T >::get();
196 }
197
198 template<>
199 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType< sal_Unicode >()
200 {
201 return ::cppu::UnoType< ::cppu::UnoCharType >::get();
202 }
203
204 #endif
205
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
com::sun::star::uno::Type::getTypeName
inline ::rtl::OUString getTypeName() const
Gets the name of the set type.
Definition: Type.hxx:80
Type.h
getCppuType
const ::com::sun::star::uno::Type & getCppuType(SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Type *)
Definition: Type.hxx:100
com::sun::star::uno::Array
Helper class to specify a type pointer for idl arrays.
Definition: Type.h:194
sal_Int8
signed char sal_Int8
Definition: types.h:53
typelib_typedescriptionreference_newByAsciiName
CPPU_DLLPUBLIC void typelib_typedescriptionreference_newByAsciiName(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, const sal_Char *pTypeName) SAL_THROW_EXTERN_C()
Creates a type description reference.
com
Definition: types.h:391
getBooleanCppuType
const ::com::sun::star::uno::Type & getBooleanCppuType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:118
typelib_TypeDescriptionReference
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
getVoidCppuType
const ::com::sun::star::uno::Type & getVoidCppuType()
Gets the meta type of IDL type void.
Definition: Type.hxx:109
SAL_UNUSED_PARAMETER
#define SAL_UNUSED_PARAMETER
Annotate unused but required C++ function parameters.
Definition: types.h:603
getCharCppuType
const ::com::sun::star::uno::Type & getCharCppuType()
Gets the meta type of IDL type char.
Definition: Type.hxx:133
com::sun::star::uno::Type::operator=
Type & operator=(const Type &rType)
Assignment operator: Acquires right side type and releases previously set type.
Definition: Type.hxx:85
typelib_typedescriptionreference_acquire
CPPU_DLLPUBLIC void typelib_typedescriptionreference_acquire(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Increments reference count of type description reference.
typelib_TypeClass
enum _typelib_TypeClass typelib_TypeClass
This type class enum is binary compatible with the IDL enum com.sun.star.uno.TypeClass.
sal_Bool
unsigned char sal_Bool
Definition: types.h:48
__sal_NoAcquire
__sal_NoAcquire
Definition: types.h:384
typelib_TypeClass_VOID
type class of void
Definition: typeclass.h:29
getCppuType< sal_Unicode >
const ::com::sun::star::uno::Type & getCppuType< sal_Unicode >()
Gets the meta type of IDL type char.
Definition: Type.hxx:199
typelib_static_type_getByTypeClass
CPPU_DLLPUBLIC typelib_TypeDescriptionReference ** typelib_static_type_getByTypeClass(typelib_TypeClass eTypeClass) SAL_THROW_EXTERN_C()
Gets static type reference of standard types by type class.
unotype.hxx
typelib_typedescriptionreference_new
CPPU_DLLPUBLIC void typelib_typedescriptionreference_new(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, rtl_uString *pTypeName) SAL_THROW_EXTERN_C()
Creates a type description reference.
typelib_typedescriptionreference_assign
CPPU_DLLPUBLIC void typelib_typedescriptionreference_assign(typelib_TypeDescriptionReference **ppDest, typelib_TypeDescriptionReference *pSource) SAL_THROW_EXTERN_C()
Assigns a type.
getCppuVoidType
const ::com::sun::star::uno::Type & getCppuVoidType()
Gets the meta type of IDL type void.
Definition: Type.hxx:105
getCppuCharType
const ::com::sun::star::uno::Type & getCppuCharType()
Gets the meta type of IDL type char.
Definition: Type.hxx:137
getCppuBooleanType
const ::com::sun::star::uno::Type & getCppuBooleanType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:114
config.h
sal_Char
char sal_Char
A legacy synonym for char.
Definition: types.h:130
com::sun::star::uno::UnoType_NoAcquire
UnoType_NoAcquire
Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer.
Definition: Type.h:39
com::sun::star::uno::Type::Type
Type()
Default Constructor: Type is set to void.
Definition: Type.hxx:39
com::sun::star::uno::Type::getTypeLibType
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
com::sun::star::uno::Type
C++ class representing an IDL meta type.
Definition: Type.h:54