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