LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 * >(
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 {
56 }
57 
59  : _pType( pType )
60 {
62 }
63 
65  : _pType( pType )
66 {
67 }
68 
70  : _pType( pType )
71 {
72 }
73 
74 inline Type::Type( const Type & rType )
75  : _pType( rType._pType )
76 {
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 >
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: */
UnoType_NoAcquire
Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer.
Definition: Type.h:39
CPPU_DLLPUBLIC void typelib_typedescriptionreference_new(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, rtl_uString *pTypeName) SAL_THROW_EXTERN_C()
Creates a type description reference.
const ::com::sun::star::uno::Type & getCppuBooleanType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:114
const ::com::sun::star::uno::Type & getCppuType< sal_Unicode >()
Gets the meta type of IDL type char.
Definition: Type.hxx:199
char sal_Char
A legacy synonym for char.
Definition: types.h:130
Type & operator=(const Type &rType)
Assignment operator: Acquires right side type and releases previously set type.
Definition: Type.hxx:85
const ::com::sun::star::uno::Type & getCppuType(SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Any *)
Gets the meta type of IDL type any.
Definition: Any.h:450
unsigned char sal_Bool
Definition: types.h:48
const ::com::sun::star::uno::Type & getCppuCharType()
Gets the meta type of IDL type char.
Definition: Type.hxx:137
const ::com::sun::star::uno::Type & getCharCppuType()
Gets the meta type of IDL type char.
Definition: Type.hxx:133
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
const ::com::sun::star::uno::Type & getCppuVoidType()
Gets the meta type of IDL type void.
Definition: Type.hxx:105
__sal_NoAcquire
Definition: types.h:384
#define SAL_UNUSED_PARAMETER
Annotate unused but required C++ function parameters.
Definition: types.h:603
inline::rtl::OUString getTypeName() const
Gets the name of the set type.
Definition: Type.hxx:80
C++ class representing an IDL meta type.
Definition: Type.h:54
Type()
Default Constructor: Type is set to void.
Definition: Type.hxx:39
signed char sal_Int8
Definition: types.h:53
enum _typelib_TypeClass typelib_TypeClass
This type class enum is binary compatible with the IDL enum com.sun.star.uno.TypeClass.
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_newByAsciiName(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, const sal_Char *pTypeName) SAL_THROW_EXTERN_C()
Creates a type description reference.
const ::com::sun::star::uno::Type & getBooleanCppuType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:118
CPPU_DLLPUBLIC void typelib_typedescriptionreference_acquire(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Increments reference count of type description reference.
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
CPPU_DLLPUBLIC void typelib_typedescriptionreference_assign(typelib_TypeDescriptionReference **ppDest, typelib_TypeDescriptionReference *pSource) SAL_THROW_EXTERN_C()
Assigns a type.
Helper class to specify a type pointer for idl arrays.
Definition: Type.h:194
type class of void
Definition: typeclass.h:29
const ::com::sun::star::uno::Type & getVoidCppuType()
Gets the meta type of IDL type void.
Definition: Type.hxx:109