AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 #ifndef INCLUDED_COM_SUN_STAR_UNO_TYPE_HXX
4 #define INCLUDED_COM_SUN_STAR_UNO_TYPE_HXX
5 
6 #include "sal/config.h"
7 
8 #include <cstddef>
9 #include <ostream>
10 
11 #include "com/sun/star/uno/Type.h"
12 #include "cppu/unotype.hxx"
13 
14 namespace com
15 {
16 namespace sun
17 {
18 namespace star
19 {
20 namespace uno
21 {
22 
23 
24 inline Type::Type()
25 {
26  _pType = reinterpret_cast< const ::com::sun::star::uno::Type * >(
29 }
30 
31 inline Type::Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName )
32  : _pType( NULL )
33 {
34  ::typelib_typedescriptionreference_new( &_pType, static_cast<typelib_TypeClass>(eTypeClass), rTypeName.pData );
35 }
36 
37 inline Type::Type( TypeClass eTypeClass, const char * pTypeName )
38  : _pType( NULL )
39 {
40  ::typelib_typedescriptionreference_newByAsciiName( &_pType, static_cast<typelib_TypeClass>(eTypeClass), pTypeName );
41 }
42 
44  : _pType( pType )
45 {
47 }
48 
50  : _pType( pType )
51 {
52 }
53 
55  : _pType( pType )
56 {
57 }
58 
59 inline Type::Type( const Type & rType )
60  : _pType( rType._pType )
61 {
63 }
64 
65 inline ::rtl::OUString Type::getTypeName() const
66 {
67  return ::rtl::OUString( _pType->pTypeName );
68 }
69 
70 inline Type & Type::operator = ( const Type & rType )
71 {
72  ::typelib_typedescriptionreference_assign( &_pType, rType._pType );
73  return *this;
74 }
75 
76 #if defined LIBO_INTERNAL_ONLY
77 inline Type & Type::operator = ( Type && rType )
78 {
79  std::swap(_pType, rType._pType);
80  return *this;
81 }
82 #endif
83 
84 
85 template< class T >
86 typelib_TypeDescriptionReference * Array< T >::s_pType = NULL;
87 
88 #if defined LIBO_INTERNAL_ONLY
89 
95 template<typename charT, typename traits> std::basic_ostream<charT, traits> &
96 operator <<(std::basic_ostream<charT, traits> & stream, Type const & type)
97 { return stream << type.getTypeName(); }
98 #endif
99 
100 }
101 }
102 }
103 }
104 
105 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Type * )
106 {
107  return ::cppu::UnoType< ::com::sun::star::uno::Type >::get();
108 }
109 
110 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType()
111 {
112  return ::cppu::UnoType<void>::get();
113 }
114 inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType()
115 {
116  return ::cppu::UnoType<void>::get();
117 }
118 
119 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType()
120 {
121  return ::cppu::UnoType< bool >::get();
122 }
123 inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType()
124 {
125  return ::cppu::UnoType< bool >::get();
126 }
127 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Bool * )
128 {
129  return ::cppu::UnoType< bool >::get();
130 }
131 
132 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
133  SAL_UNUSED_PARAMETER bool const * )
134 {
135  return ::cppu::UnoType< bool >::get();
136 }
137 
138 inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType()
139 {
140  return ::cppu::UnoType< ::cppu::UnoCharType >::get();
141 }
142 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType()
143 {
144  return ::cppu::UnoType< ::cppu::UnoCharType >::get();
145 }
146 
147 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int8 * )
148 {
149  return ::cppu::UnoType< ::sal_Int8 >::get();
150 }
151 
152 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const ::rtl::OUString * )
153 {
154  return ::cppu::UnoType< ::rtl::OUString >::get();
155 }
156 
157 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int16 * )
158 {
159  return ::cppu::UnoType< ::sal_Int16 >::get();
160 }
161 
162 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt16 * )
163 {
164  return ::cppu::UnoType< ::cppu::UnoUnsignedShortType >::get();
165 }
166 
167 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int32 * )
168 {
169  return ::cppu::UnoType< ::sal_Int32 >::get();
170 }
171 
172 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt32 * )
173 {
174  return ::cppu::UnoType< ::sal_uInt32 >::get();
175 }
176 
177 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_Int64 * )
178 {
179  return ::cppu::UnoType< ::sal_Int64 >::get();
180 }
181 
182 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const sal_uInt64 * )
183 {
184  return ::cppu::UnoType< ::sal_uInt64 >::get();
185 }
186 
187 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const float * )
188 {
189  return ::cppu::UnoType< float >::get();
190 }
191 
192 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( SAL_UNUSED_PARAMETER const double * )
193 {
194  return ::cppu::UnoType< double >::get();
195 }
196 
197 template< typename T >
198 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType()
199 {
200  return ::cppu::UnoType< T >::get();
201 }
202 
203 template<>
204 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType< sal_Unicode >()
205 {
206  return ::cppu::UnoType< ::cppu::UnoCharType >::get();
207 }
208 
209 #endif
210 
211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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.
const ::com::sun::star::uno::Type & getCppuType< sal_Unicode >()
Gets the meta type of IDL type char.
Definition: Type.hxx:204
const ::com::sun::star::uno::Type & getBooleanCppuType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:123
unsigned char sal_Bool
Definition: types.h:18
type class of void
Definition: typeclass.h:12
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
__sal_NoAcquire
Definition: types.h:332
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:470
CPPU_DLLPUBLIC void typelib_typedescriptionreference_assign(typelib_TypeDescriptionReference **ppDest, typelib_TypeDescriptionReference *pSource) SAL_THROW_EXTERN_C()
Assigns a type.
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:142
const ::com::sun::star::uno::Type & getCharCppuType()
Gets the meta type of IDL type char.
Definition: Type.hxx:138
#define SAL_UNUSED_PARAMETER
Annotate unused but required C++ function parameters.
Definition: types.h:548
inline::rtl::OUString getTypeName() const
Gets the name of the set type.
Definition: Type.hxx:65
const ::com::sun::star::uno::Type & getCppuVoidType()
Gets the meta type of IDL type void.
Definition: Type.hxx:110
Type & operator=(const Type &rType)
Assignment operator: Acquires right side type and releases previously set type.
Definition: Type.hxx:70
Type()
Default Constructor: Type is set to void.
Definition: Type.hxx:24
const ::com::sun::star::uno::Type & getVoidCppuType()
Gets the meta type of IDL type void.
Definition: Type.hxx:114
C++ class representing an IDL meta type.
Definition: Type.h:38
CPPU_DLLPUBLIC void typelib_typedescriptionreference_newByAsciiName(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, const char *pTypeName) SAL_THROW_EXTERN_C()
Creates a type description reference.
const ::com::sun::star::uno::Type & getCppuCharType()
Gets the meta type of IDL type char.
Definition: Type.hxx:142
UnoType_NoAcquire
Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer.
Definition: Type.h:23
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:119
signed char sal_Int8
Definition: types.h:23
CPPU_DLLPUBLIC void typelib_typedescriptionreference_acquire(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Increments reference count of type description reference.