LibreOffice: com/sun/star/uno/Type.h Source File

LibreOffice LibreOffice 26.8 SDK C/C++ API Reference

Loading...
Searching...
No Matches
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
20/*
21 * This file is part of LibreOffice published API.
22 */
23#ifndef INCLUDED_COM_SUN_STAR_UNO_TYPE_H
24#define INCLUDED_COM_SUN_STAR_UNO_TYPE_H
25
26#include "typelib/typedescription.h"
27#include "com/sun/star/uno/TypeClass.hdl"
28#include "rtl/ustring.hxx"
29#include "rtl/alloc.h"
30
31
32namespace com
33{
34namespace sun
35{
36namespace star
37{
38namespace uno
39{
40
43 enum UnoType_NoAcquire
44{
48 UNO_TYPE_NO_ACQUIRE
49};
50
58 class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI Type
59{
62 typelib_TypeDescriptionReference * _pType;
63
64public:
66 // these are here to force memory de/allocation to sal lib.
67 static void * SAL_CALL operator new ( size_t nSize )
68 { return ::rtl_allocateMemory( nSize ); }
69 static void SAL_CALL operator delete ( void * pMem )
70 { ::rtl_freeMemory( pMem ); }
71 static void * SAL_CALL operator new ( size_t, void * pMem )
72 { return pMem; }
73 static void SAL_CALL operator delete ( void *, void * )
74 {}
76
79 inline Type();
80
86 inline Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName );
87
93 inline Type( TypeClass eTypeClass, const char * pTypeName );
94
99 inline Type( typelib_TypeDescriptionReference * pType );
100
107 inline Type( typelib_TypeDescriptionReference * pType, UnoType_NoAcquire dummy );
114 inline Type( typelib_TypeDescriptionReference * pType, __sal_NoAcquire dummy );
115
120 inline Type( const Type & rType );
121
124 ~Type()
125 { ::typelib_typedescriptionreference_release( _pType ); }
126
132 inline Type & SAL_CALL operator = ( const Type & rType );
133
134#if defined LIBO_INTERNAL_ONLY
135 inline Type & SAL_CALL operator = ( Type && );
136#endif
137
142 TypeClass SAL_CALL getTypeClass() const
143 { return static_cast<TypeClass>(_pType->eTypeClass); }
144
149 inline ::rtl::OUString SAL_CALL getTypeName() const;
150
155 void SAL_CALL getDescription( typelib_TypeDescription ** ppDescr ) const
156 { ::typelib_typedescriptionreference_getDescription( ppDescr, _pType ); }
157
162 typelib_TypeDescriptionReference * SAL_CALL getTypeLibType() const
163 { return _pType; }
164
173 bool SAL_CALL isAssignableFrom( const Type & rType ) const
174 { return ::typelib_typedescriptionreference_isAssignableFrom( _pType, rType._pType ); }
175
181 bool SAL_CALL equals( const Type & rType ) const
182 { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
183
188 bool SAL_CALL operator == ( const Type & rType ) const
189 { return ::typelib_typedescriptionreference_equals( _pType, rType._pType ); }
190
195 bool SAL_CALL operator != ( const Type & rType ) const
196 { return (! ::typelib_typedescriptionreference_equals( _pType, rType._pType )); }
197};
198
201template< class T >
202 class Array
203{
204public:
205 static typelib_TypeDescriptionReference * s_pType;
206};
207
208}
209}
210}
211}
212
225 SAL_DEPRECATED("use cppu::UnoType")
226inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Type * );
227
234 SAL_DEPRECATED("use cppu::UnoType")
235inline const ::com::sun::star::uno::Type & SAL_CALL getCppuVoidType();
243 SAL_DEPRECATED("use cppu::UnoType")
244inline const ::com::sun::star::uno::Type & SAL_CALL getVoidCppuType();
245
253 SAL_DEPRECATED("use cppu::UnoType")
254inline const ::com::sun::star::uno::Type & SAL_CALL getCppuBooleanType();
262 SAL_DEPRECATED("use cppu::UnoType")
263inline const ::com::sun::star::uno::Type & SAL_CALL getBooleanCppuType();
276 SAL_DEPRECATED("use cppu::UnoType")
277inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Bool * );
290 SAL_DEPRECATED("use cppu::UnoType")
291inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType(
292 bool const * );
293
301 SAL_DEPRECATED("use cppu::UnoType")
302inline const ::com::sun::star::uno::Type & SAL_CALL getCharCppuType();
310 SAL_DEPRECATED("use cppu::UnoType")
311inline const ::com::sun::star::uno::Type & SAL_CALL getCppuCharType();
312
325 SAL_DEPRECATED("use cppu::UnoType")
326inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int8 * );
327
340 SAL_DEPRECATED("use cppu::UnoType")
341inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::rtl::OUString * );
342
355 SAL_DEPRECATED("use cppu::UnoType")
356inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int16 * );
357
370 SAL_DEPRECATED("use cppu::UnoType")
371inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt16 * );
372
385 SAL_DEPRECATED("use cppu::UnoType")
386inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int32 * );
387
400 SAL_DEPRECATED("use cppu::UnoType")
401inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt32 * );
402
415 SAL_DEPRECATED("use cppu::UnoType")
416inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_Int64 * );
417
430 SAL_DEPRECATED("use cppu::UnoType")
431inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const sal_uInt64 * );
432
445 SAL_DEPRECATED("use cppu::UnoType")
446inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const float * );
447
460 SAL_DEPRECATED("use cppu::UnoType")
461inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const double * );
462
481template< typename T > SAL_DEPRECATED("use cppu::UnoType")
482inline const ::com::sun::star::uno::Type & SAL_CALL
483 getCppuType();
484
496template<> SAL_DEPRECATED("use cppu::UnoType")
497inline const ::com::sun::star::uno::Type & SAL_CALL
498 getCppuType< sal_Unicode >();
499
500#endif
501
502/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DEPRECATED
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don't use, it's evil.") void doit(int nPara);.
Definition types.h:492
__sal_NoAcquire
__sal_NoAcquire
Definition types.h:371
sal_Bool
unsigned char sal_Bool
Definition types.h:38
sal_Unicode
sal_uInt16 sal_Unicode
Definition types.h:123
sal_Int8
signed char sal_Int8
Definition types.h:43
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition types.h:611
alloc.h
rtl_freeMemory
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
ustring.hxx
typedescription.h
typelib_TypeDescription
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription typelib_TypeDescription
Full type description of a type.
typelib_typedescriptionreference_release
CPPU_DLLPUBLIC void typelib_typedescriptionreference_release(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
Increments reference count of type description reference.
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.
typelib_TypeDescriptionReference
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
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.
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:511
getCppuBooleanType
const ::com::sun::star::uno::Type & getCppuBooleanType()
Gets the meta type of IDL type boolean.
Definition Type.hxx:139
getBooleanCppuType
const ::com::sun::star::uno::Type & getBooleanCppuType()
Gets the meta type of IDL type boolean.
Definition Type.hxx:143
getVoidCppuType
const ::com::sun::star::uno::Type & getVoidCppuType()
Gets the meta type of IDL type void.
Definition Type.hxx:134
getCppuCharType
const ::com::sun::star::uno::Type & getCppuCharType()
Gets the meta type of IDL type char.
Definition Type.hxx:162
getCppuVoidType
const ::com::sun::star::uno::Type & getCppuVoidType()
Gets the meta type of IDL type void.
Definition Type.hxx:130
getCharCppuType
const ::com::sun::star::uno::Type & getCharCppuType()
Gets the meta type of IDL type char.
Definition Type.hxx:158
com
Definition types.h:377
com::sun
Definition types.h:377
com::sun::star
Definition types.h:377
rtl
Definition bootstrap.hxx:34
com::sun::star::uno
Definition typedescription.hxx:43
com::sun::star::uno::UnoType_NoAcquire
UnoType_NoAcquire
Enum defining UNO_TYPE_NO_ACQUIRE for type description reference transfer.
Definition Type.h:44
com::sun::star::uno::UNO_TYPE_NO_ACQUIRE
@ UNO_TYPE_NO_ACQUIRE
This enum value can be used for creating a Type object granting a given type description reference,...
Definition Type.h:48
com::sun::star::uno::Type
C++ class representing an IDL meta type.
Definition Type.h:59
com::sun::star::uno::Type::equals
bool equals(const Type &rType) const
Compares two types.
Definition Type.h:181
com::sun::star::uno::Type::getDescription
void getDescription(typelib_TypeDescription **ppDescr) const
Obtains a full type description of set type.
Definition Type.h:155
com::sun::star::uno::Type::~Type
~Type()
Destructor: Releases acquired C type description reference.
Definition Type.h:124
com::sun::star::uno::Type::Type
Type()
Default Constructor: Type is set to void.
Definition Type.hxx:44
com::sun::star::uno::Type::isAssignableFrom
bool isAssignableFrom(const Type &rType) const
Tests if values of this reflected type can be assigned by values of given type.
Definition Type.h:173
com::sun::star::uno::Type::getTypeClass
TypeClass getTypeClass() const
Gets the type class of set type.
Definition Type.h:142
com::sun::star::uno::Type::getTypeLibType
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition Type.h:162
com::sun::star::uno::Array
Helper class to specify a type pointer for idl arrays.
Definition Type.h:203
com::sun::star::uno::Array::s_pType
static typelib_TypeDescriptionReference * s_pType
Definition Type.h:205