LibreOffice LibreOffice 4.1 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Type.h
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 _COM_SUN_STAR_UNO_TYPE_H_
20 #define _COM_SUN_STAR_UNO_TYPE_H_
21
22 #include <typelib/typedescription.h>
23 #include <com/sun/star/uno/TypeClass.hdl>
24 #include <cppu/macros.hxx>
25 #include <rtl/ustring.hxx>
26 #include <rtl/alloc.h>
27
28
29 namespace com
30 {
31 namespace sun
32 {
33 namespace star
34 {
35 namespace uno
36 {
37
40 enum UnoType_NoAcquire
41 {
45 UNO_TYPE_NO_ACQUIRE
46 };
47
55 class Type
56 {
59 typelib_TypeDescriptionReference * _pType;
60
61 public:
63 // these are here to force memory de/allocation to sal lib.
64 inline static void * SAL_CALL operator new ( size_t nSize ) SAL_THROW(())
65 { return ::rtl_allocateMemory( nSize ); }
66 inline static void SAL_CALL operator delete ( void * pMem ) SAL_THROW(())
67 { ::rtl_freeMemory( pMem ); }
68 inline static void * SAL_CALL operator new ( size_t, void * pMem ) SAL_THROW(())
69 { return pMem; }
70 inline static void SAL_CALL operator delete ( void *, void * ) SAL_THROW(())
71 {}
73
76 inline Type() SAL_THROW(());
77
83 inline Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName ) SAL_THROW(());
84
90 inline Type( TypeClass eTypeClass, const sal_Char * pTypeName ) SAL_THROW(());
91
96 inline Type( typelib_TypeDescriptionReference * pType ) SAL_THROW(());
97
104 inline Type( typelib_TypeDescriptionReference * pType, UnoType_NoAcquire dummy ) SAL_THROW(());
111 inline Type( typelib_TypeDescriptionReference * pType, __sal_NoAcquire dummy ) SAL_THROW(());
112
117 inline Type( const Type & rType ) SAL_THROW(());
118
121 inline ~Type() SAL_THROW(())
122 { ::typelib_typedescriptionreference_release( _pType ); }
123
129 inline Type & SAL_CALL operator = ( const Type & rType ) SAL_THROW(());
130
135 inline TypeClass SAL_CALL getTypeClass() const SAL_THROW(())
136 { return (TypeClass)_pType->eTypeClass; }
137
142 inline ::rtl::OUString SAL_CALL getTypeName() const SAL_THROW(());
143
148 inline void SAL_CALL getDescription( typelib_TypeDescription ** ppDescr ) const SAL_THROW(())
149 { ::typelib_typedescriptionreference_getDescription( ppDescr, _pType ); }
150
155 inline typelib_TypeDescriptionReference * SAL_CALL getTypeLibType() const SAL_THROW(())
156 { return _pType; }
157
166 inline sal_Bool SAL_CALL isAssignableFrom( const Type & rType ) const SAL_THROW(())
167 { return ::typelib_typedescriptionreference_isAssignableFrom( _pType, rType._pType ); }
168
174 inline sal_Bool SAL_CALL equals( const Type & rType ) const SAL_THROW(())
175 { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
181 inline sal_Bool SAL_CALL operator == ( const Type & rType ) const SAL_THROW(())
182 { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
188 inline sal_Bool SAL_CALL operator != ( const Type & rType ) const SAL_THROW(())
189 { return (! ::typelib_typedescriptionreference_equals( _pType, rType._pType )); }
190 };
191
194 template< class T >
195 class Array
196 {
197 public:
198 static typelib_TypeDescriptionReference * s_pType;
199 };
200
201 }
202 }
203 }
204 }
205
215 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Type * ) SAL_THROW(());
216
220 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType() SAL_THROW(());
225 inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType() SAL_THROW(());
226
231 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType() SAL_THROW(());
236 inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType() SAL_THROW(());
246 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Bool * ) SAL_THROW(());
256 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
257 bool const * ) SAL_THROW(());
258
263 inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType() SAL_THROW(());
268 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType() SAL_THROW(());
269
279 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int8 * ) SAL_THROW(());
280
290 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::rtl::OUString * ) SAL_THROW(());
291
301 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int16 * ) SAL_THROW(());
302
312 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt16 * ) SAL_THROW(());
313
323 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int32 * ) SAL_THROW(());
324
334 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt32 * ) SAL_THROW(());
335
345 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int64 * ) SAL_THROW(());
346
356 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt64 * ) SAL_THROW(());
357
367 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * ) SAL_THROW(());
368
378 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * ) SAL_THROW(());
379
385 template< class T >
386 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType1( T * pT ) SAL_THROW(());
392 template< class T >
393 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType2( T * pT ) SAL_THROW(());
399 template< class T >
400 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType3( T * pT ) SAL_THROW(());
406 template< class T >
407 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType4( T * pT ) SAL_THROW(());
413 template< class T >
414 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType5( T * pT ) SAL_THROW(());
420 template< class T >
421 inline const ::com::sun::star::uno::Type & SAL_CALL getCppuArrayType6( T * pT ) SAL_THROW(());
422
441 template< typename T > inline const ::com::sun::star::uno::Type & SAL_CALL
442 getCppuType() SAL_THROW(());
443
455 template<> inline const ::com::sun::star::uno::Type & SAL_CALL
456 getCppuType< sal_Unicode >() SAL_THROW(());
457
458 #endif
459
460 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
com::sun::star::uno::Type::operator!=
sal_Bool operator!=(const Type &rType) const
Unequality operator: Compares two types.
Definition: Type.h:188
com::sun::star::uno::Type::isAssignableFrom
sal_Bool isAssignableFrom(const Type &rType) const
Tests if values of this reflected type can be assigned by values of given type.
Definition: Type.h:166
getCppuCharType
const ::com::sun::star::uno::Type & getCppuCharType()
Gets the meta type of IDL type char.
Definition: Type.hxx:134
_typelib_TypeDescription
Full type description of a type.
Definition: typedescription.h:71
rtl_freeMemory
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
sal_Unicode
sal_uInt16 sal_Unicode
Definition: types.h:134
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:82
com::sun::star::uno::Type::~Type
~Type()
Destructor: Releases acquired C type description reference.
Definition: Type.h:121
sal_Int8
signed char sal_Int8
Definition: types.h:42
getCppuBooleanType
const ::com::sun::star::uno::Type & getCppuBooleanType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:111
com::sun::star::uno::Type::getTypeName
inline::rtl::OUString getTypeName() const
Gets the name of the set type.
Definition: Type.hxx:77
getCppuArrayType5
const ::com::sun::star::uno::Type & getCppuArrayType5(T *pT)
Array template function to get meta type for five-dimensional arrays.
Definition: Type.hxx:264
typelib_typedescriptionreference_equals
CPPU_DLLPUBLIC sal_Bool typelib_typedescriptionreference_equals(const typelib_TypeDescriptionReference *p1, const typelib_TypeDescriptionReference *p2) SAL_THROW_EXTERN_C()
Tests whether two types description references are equal, i.e.
macros.hxx
getCppuArrayType1
const ::com::sun::star::uno::Type & getCppuArrayType1(T *pT)
Array template function to get meta type for one-dimensional arrays.
Definition: Type.hxx:190
typelib_typedescriptionreference_release
CPPU_DLLPUBLIC void typelib_typedescriptionreference_release(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Increments reference count of type description reference.
getCppuArrayType3
const ::com::sun::star::uno::Type & getCppuArrayType3(T *pT)
Array template function to get meta type for three-dimensional arrays.
Definition: Type.hxx:225
typelib_typedescriptionreference_getDescription
CPPU_DLLPUBLIC void typelib_typedescriptionreference_getDescription(typelib_TypeDescription **ppRet, typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Retrieves the type description for a given reference.
getCppuArrayType6
const ::com::sun::star::uno::Type & getCppuArrayType6(T *pT)
Array template function to get meta type for six-dimensional arrays.
Definition: Type.hxx:285
typelib_typedescriptionreference_isAssignableFrom
CPPU_DLLPUBLIC sal_Bool typelib_typedescriptionreference_isAssignableFrom(typelib_TypeDescriptionReference *pAssignable, typelib_TypeDescriptionReference *pFrom) SAL_THROW_EXTERN_C()
Tests if values of type pAssignable can be assigned by values of type pFrom.
ustring.hxx
com::sun::star::uno::Array::s_pType
static typelib_TypeDescriptionReference * s_pType
Definition: Type.h:198
com::sun::star::uno::Type::getTypeClass
TypeClass getTypeClass() const
Gets the type class of set type.
Definition: Type.h:135
com::sun::star::uno::Type::getDescription
void getDescription(typelib_TypeDescription **ppDescr) const
Obtains a full type description of set type.
Definition: Type.h:148
sal_Char
char sal_Char
Definition: types.h:122
sal_Bool
unsigned char sal_Bool
Definition: types.h:37
com::sun::star::uno::UnoType_NoAcquire
UnoType_NoAcquire
Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer.
Definition: Type.h:40
getVoidCppuType
const ::com::sun::star::uno::Type & getVoidCppuType()
Gets the meta type of IDL type void.
Definition: Type.hxx:106
rtl_allocateMemory
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
com::sun::star::uno::Array
Helper class to specify a type pointer for idl arrays.
Definition: Type.h:195
com::sun::star::uno::Type::Type
Type()
Default Constructor: Type is set to void.
Definition: Type.hxx:36
getBooleanCppuType
const ::com::sun::star::uno::Type & getBooleanCppuType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:115
com::sun::star::uno::UNO_TYPE_NO_ACQUIRE
This enum value can be used for creating a Type object granting a given type description reference...
Definition: Type.h:45
__sal_NoAcquire
__sal_NoAcquire
Definition: types.h:370
getCppuArrayType2
const ::com::sun::star::uno::Type & getCppuArrayType2(T *pT)
Array template function to get meta type for two-dimensional arrays.
Definition: Type.hxx:207
getCppuType
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:369
_typelib_TypeDescriptionReference::eTypeClass
typelib_TypeClass eTypeClass
type class of type
Definition: typedescription.h:52
alloc.h
typedescription.h
getCharCppuType
const ::com::sun::star::uno::Type & getCharCppuType()
Gets the meta type of IDL type char.
Definition: Type.hxx:130
getCppuArrayType4
const ::com::sun::star::uno::Type & getCppuArrayType4(T *pT)
Array template function to get meta type for four-dimensional arrays.
Definition: Type.hxx:244
getCppuVoidType
const ::com::sun::star::uno::Type & getCppuVoidType()
Gets the meta type of IDL type void.
Definition: Type.hxx:102
com::sun::star::uno::Type::getTypeLibType
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:155
com::sun::star::uno::Type::equals
sal_Bool equals(const Type &rType) const
Compares two types.
Definition: Type.h:174
_typelib_TypeDescriptionReference
Holds a weak reference to a type description.
Definition: typedescription.h:40
SAL_THROW
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:356
com::sun::star::uno::Type
C++ class representing an IDL meta type.
Definition: Type.h:55
com::sun::star::uno::Type::operator==
sal_Bool operator==(const Type &rType) const
Equality operator: Compares two types.
Definition: Type.h:181