LibreOffice
LibreOffice 7.1 SDK C/C++ API Reference
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 INCLUDED_COM_SUN_STAR_UNO_TYPE_H
20#define INCLUDED_COM_SUN_STAR_UNO_TYPE_H
21
23#include "com/sun/star/uno/TypeClass.hdl"
24#include "rtl/ustring.hxx"
25#include "rtl/alloc.h"
26
27
28namespace com
29{
30namespace sun
31{
32namespace star
33{
34namespace uno
35{
36
40{
45};
46
54class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI Type
55{
59
60public:
62 // these are here to force memory de/allocation to sal lib.
63 static void * SAL_CALL operator new ( size_t nSize )
64 { return ::rtl_allocateMemory( nSize ); }
65 static void SAL_CALL operator delete ( void * pMem )
66 { ::rtl_freeMemory( pMem ); }
67 static void * SAL_CALL operator new ( size_t, void * pMem )
68 { return pMem; }
69 static void SAL_CALL operator delete ( void *, void * )
70 {}
72
75 inline Type();
76
82 inline Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName );
83
89 inline Type( TypeClass eTypeClass, const char * pTypeName );
90
95 inline Type( typelib_TypeDescriptionReference * pType );
96
111
116 inline Type( const Type & rType );
117
122
128 inline Type & SAL_CALL operator = ( const Type & rType );
129
134 TypeClass SAL_CALL getTypeClass() const
135 { return static_cast<TypeClass>(_pType->eTypeClass); }
136
141 inline ::rtl::OUString SAL_CALL getTypeName() const;
142
147 void SAL_CALL getDescription( typelib_TypeDescription ** ppDescr ) const
149
155 { return _pType; }
156
165 bool SAL_CALL isAssignableFrom( const Type & rType ) const
167
173 bool SAL_CALL equals( const Type & rType ) const
174 { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
180 bool SAL_CALL operator == ( const Type & rType ) const
181 { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
187 bool SAL_CALL operator != ( const Type & rType ) const
188 { return (! ::typelib_typedescriptionreference_equals( _pType, rType._pType )); }
189};
190
193template< class T >
194class Array
195{
196public:
198};
199
200}
201}
202}
203}
204
217SAL_DEPRECATED("use cppu::UnoType")
218inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Type * );
219
226SAL_DEPRECATED("use cppu::UnoType")
227inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType();
235SAL_DEPRECATED("use cppu::UnoType")
236inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType();
237
245SAL_DEPRECATED("use cppu::UnoType")
246inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType();
254SAL_DEPRECATED("use cppu::UnoType")
255inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType();
268SAL_DEPRECATED("use cppu::UnoType")
269inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Bool * );
282SAL_DEPRECATED("use cppu::UnoType")
283inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
284 bool const * );
285
293SAL_DEPRECATED("use cppu::UnoType")
294inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType();
302SAL_DEPRECATED("use cppu::UnoType")
303inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType();
304
317SAL_DEPRECATED("use cppu::UnoType")
318inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int8 * );
319
332SAL_DEPRECATED("use cppu::UnoType")
333inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::rtl::OUString * );
334
347SAL_DEPRECATED("use cppu::UnoType")
348inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int16 * );
349
362SAL_DEPRECATED("use cppu::UnoType")
363inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt16 * );
364
377SAL_DEPRECATED("use cppu::UnoType")
378inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int32 * );
379
392SAL_DEPRECATED("use cppu::UnoType")
393inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt32 * );
394
407SAL_DEPRECATED("use cppu::UnoType")
408inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int64 * );
409
422SAL_DEPRECATED("use cppu::UnoType")
423inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt64 * );
424
437SAL_DEPRECATED("use cppu::UnoType")
438inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * );
439
452SAL_DEPRECATED("use cppu::UnoType")
453inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * );
454
473template< typename T > SAL_DEPRECATED("use cppu::UnoType")
474inline const ::com::sun::star::uno::Type & SAL_CALL
476
488template<> SAL_DEPRECATED("use cppu::UnoType")
489inline const ::com::sun::star::uno::Type & SAL_CALL
491
492#endif
493
494/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition: types.h:445
__sal_NoAcquire
Definition: types.h:349
unsigned char sal_Bool
Definition: types.h:34
sal_uInt16 sal_Unicode
Definition: types.h:119
signed char sal_Int8
Definition: types.h:39
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:558
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription typelib_TypeDescription
Full type description of a type.
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.
CPPU_DLLPUBLIC void typelib_typedescriptionreference_release(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Increments reference count of type description reference.
CPPU_DLLPUBLIC void typelib_typedescriptionreference_getDescription(typelib_TypeDescription **ppRet, typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Retrieves the type description for a given reference.
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
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.
const ::com::sun::star::uno::Type & getCppuBooleanType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:127
const ::com::sun::star::uno::Type & getBooleanCppuType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:131
const ::com::sun::star::uno::Type & getVoidCppuType()
Gets the meta type of IDL type void.
Definition: Type.hxx:122
const ::com::sun::star::uno::Type & getCppuCharType()
Gets the meta type of IDL type char.
Definition: Type.hxx:150
const ::com::sun::star::uno::Type & getCppuType(const ::com::sun::star::uno::Type *)
Gets the meta type of IDL type "type".
const ::com::sun::star::uno::Type & getCppuVoidType()
Gets the meta type of IDL type void.
Definition: Type.hxx:118
const ::com::sun::star::uno::Type & getCharCppuType()
Gets the meta type of IDL type char.
Definition: Type.hxx:146
Definition: Enterable.hxx:27
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
Get the OBI type part of an environment descriptor.
Definition: EnvDcp.hxx:37
Definition: unotype.hxx:35
bool operator==(const Any &rAny, const C &value)
Template equality operator: compares set value of left side any to right side value.
Definition: Any.hxx:653
bool operator!=(const Any &rAny, const C &value)
Template inequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:664
UnoType_NoAcquire
Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer.
Definition: Type.h:40
@ UNO_TYPE_NO_ACQUIRE
This enum value can be used for creating a Type object granting a given type description reference,...
Definition: Type.h:44
Definition: unotype.hxx:43
C++ class representing an IDL meta type.
Definition: Type.h:55
bool equals(const Type &rType) const
Compares two types.
Definition: Type.h:173
void getDescription(typelib_TypeDescription **ppDescr) const
Obtains a full type description of set type.
Definition: Type.h:147
~Type()
Destructor: Releases acquired C type description reference.
Definition: Type.h:120
bool isAssignableFrom(const Type &rType) const
Tests if values of this reflected type can be assigned by values of given type.
Definition: Type.h:165
TypeClass getTypeClass() const
Gets the type class of set type.
Definition: Type.h:134
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
Helper class to specify a type pointer for idl arrays.
Definition: Type.h:195
static typelib_TypeDescriptionReference * s_pType
Definition: Type.h:197