LibreOffice
LibreOffice 7.3 SDK C/C++ API Reference
Any.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
20/*
21 * This file is part of LibreOffice published API.
22 */
23#ifndef INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
24#define INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
25
26#include "sal/config.h"
27
28#include <algorithm>
29#include <cassert>
30#include <cstddef>
31#include <iomanip>
32#include <ostream>
33#include <utility>
34
36#include "uno/data.h"
37#include "uno/sequence2.h"
41#include "com/sun/star/uno/RuntimeException.hpp"
42#include "cppu/cppudllapi.h"
43#include "cppu/unotype.hxx"
44
45extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
46 uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
48
49namespace com
50{
51namespace sun
52{
53namespace star
54{
55namespace uno
56{
57
58
59inline Any::Any()
60{
61 ::uno_any_construct( this, NULL, NULL, cpp_acquire );
62}
63
64
65template <typename T>
66inline Any::Any( T const & value )
67{
69 this, const_cast<T *>(&value),
70 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
72}
73
74inline Any::Any( bool value )
75{
76 sal_Bool b = value;
78 this, &b, cppu::UnoType<bool>::get().getTypeLibType(),
80}
81
82#if defined LIBO_INTERNAL_ONLY
83template<typename T1, typename T2>
84Any::Any(rtl::OUStringConcat<T1, T2> && value):
85 Any(rtl::OUString(std::move(value)))
86{}
87#endif
88
89inline Any::Any( const Any & rAny )
90{
91 ::uno_type_any_construct( this, rAny.pData, rAny.pType, cpp_acquire );
92}
93
94inline Any::Any( const void * pData_, const Type & rType )
95{
97 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
99}
100
101inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr )
102{
104 this, const_cast< void * >( pData_ ), pTypeDescr, cpp_acquire );
105}
106
107inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ )
108{
110 this, const_cast< void * >( pData_ ), pType_, cpp_acquire );
111}
112
113inline Any::~Any()
114{
116 this, cpp_release );
117}
118
119inline Any & Any::operator = ( const Any & rAny )
120{
121 if (this != &rAny)
122 {
124 this, rAny.pData, rAny.pType,
126 }
127 return *this;
128}
129
130#if defined LIBO_INTERNAL_ONLY
131
132namespace detail {
133
134inline void moveAnyInternals(Any & from, Any & to) noexcept {
135 uno_any_construct(&to, nullptr, nullptr, &cpp_acquire);
136 std::swap(from.pType, to.pType);
137 std::swap(from.pData, to.pData);
138 std::swap(from.pReserved, to.pReserved);
139 if (to.pData == &from.pReserved) {
140 to.pData = &to.pReserved;
141 }
142 // This leaves from.pData (where "from" is now VOID) dangling to somewhere (cf.
143 // CONSTRUCT_EMPTY_ANY, cppu/source/uno/prim.hxx), but what's relevant is
144 // only that it isn't a nullptr (as e.g. >>= -> uno_type_assignData ->
145 // _assignData takes a null pSource to mean "construct a default value").
146}
147
148}
149
150Any::Any(Any && other) noexcept {
151 detail::moveAnyInternals(other, *this);
152}
153
154Any & Any::operator =(Any && other) noexcept {
156 detail::moveAnyInternals(other, *this);
157 return *this;
158}
159
160#endif
161
162inline ::rtl::OUString Any::getValueTypeName() const
163{
164 return ::rtl::OUString( pType->pTypeName );
165}
166
167inline void Any::setValue( const void * pData_, const Type & rType )
168{
170 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
172}
173
174inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ )
175{
177 this, const_cast< void * >( pData_ ), pType_,
179}
180
181inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr )
182{
184 this, const_cast< void * >( pData_ ), pTypeDescr,
186}
187
188inline void Any::clear()
189{
191 this, cpp_release );
192}
193
194inline bool Any::isExtractableTo( const Type & rType ) const
195{
197 rType.getTypeLibType(), pData, pType,
199}
200
201
202template <typename T>
203inline bool Any::has() const
204{
205 Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(0));
207 rType.getTypeLibType(), pData, pType,
209 cpp_release );
210}
211
212#if defined LIBO_INTERNAL_ONLY
213template<> bool Any::has<Any>() const = delete;
214#endif
215
216inline bool Any::operator == ( const Any & rAny ) const
217{
219 pData, pType, rAny.pData, rAny.pType,
221}
222
223inline bool Any::operator != ( const Any & rAny ) const
224{
225 return (! ::uno_type_equalData(
226 pData, pType, rAny.pData, rAny.pType,
228}
229
230
231template< class C >
232inline Any SAL_CALL makeAny( const C & value )
233{
234 return Any(value);
235}
236
237#if !defined LIBO_INTERNAL_ONLY
238template<> Any makeAny(sal_uInt16 const & value)
240#endif
241
242template<typename T> Any toAny(T const & value) { return makeAny(value); }
243
244template<> Any toAny(Any const & value) { return value; }
245
246#if defined LIBO_INTERNAL_ONLY
247
248template<typename T1, typename T2>
249Any makeAny(rtl::OUStringConcat<T1, T2> && value)
250{ return Any(std::move(value)); }
251
252template<typename T1, typename T2>
253Any toAny(rtl::OUStringConcat<T1, T2> && value)
254{ return makeAny(std::move(value)); }
255
256template<typename T>
257Any makeAny(rtl::OUStringNumber<T> && value)
258{ return Any(OUString(std::move(value))); }
259
260template<typename T>
261Any toAny(rtl::OUStringNumber<T> && value)
262{ return makeAny(std::move(value)); }
263
264template<typename T> bool fromAny(Any const & any, T * value) {
265 assert(value != nullptr);
266 return any >>= *value;
267}
268
269template<> bool fromAny(Any const & any, Any * value) {
270 assert(value != nullptr);
271 *value = any;
272 return true;
273}
274
275#endif
276
277template< class C >
278inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
279{
280 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
282 &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
284}
285
286// additionally for C++ bool:
287
288template<>
289inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
290{
291 sal_Bool b = value;
293 &rAny, &b, cppu::UnoType<bool>::get().getTypeLibType(),
295}
296
297
298#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
299template< class C1, class C2 >
300inline void SAL_CALL operator <<= ( Any & rAny, rtl::OUStringConcat< C1, C2 >&& value )
301{
302 const rtl::OUString str( std::move(value) );
303 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
305 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
307}
308template<typename T1, typename T2>
309void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
310template< class C >
311inline void SAL_CALL operator <<= ( Any & rAny, rtl::OUStringNumber< C >&& value )
312{
313 const rtl::OUString str( std::move(value) );
314 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
316 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
318}
319template<typename T>
320void operator <<=(Any &, rtl::OUStringNumber<T> const &) = delete;
321#endif
322
323#if defined LIBO_INTERNAL_ONLY
324template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
325#endif
326
327template< class C >
328inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
329{
330 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
332 &value, rType.getTypeLibType(),
333 rAny.pData, rAny.pType,
336}
337
338// bool
339
340template<>
341inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value )
342{
343 if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
344 {
345 value = bool(* static_cast< const sal_Bool * >( rAny.pData ));
346 return true;
347 }
348 return false;
349}
350
351template<>
352inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value )
353{
354 return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
355 bool(value) == bool(* static_cast< const sal_Bool * >( rAny.pData )));
356}
357
358
359template<>
360inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
361{
362 if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
363 {
364 value = *static_cast< sal_Bool const * >( rAny.pData );
365 return true;
366 }
367 return false;
368}
369
370
371template<>
372inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
373{
374 return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
375 (value ==
376 bool(*static_cast< sal_Bool const * >( rAny.pData ))));
377}
378
379// byte
380
381template<>
382inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value )
383{
384 if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
385 {
386 value = * static_cast< const sal_Int8 * >( rAny.pData );
387 return true;
388 }
389 return false;
390}
391// short
392
393template<>
394inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value )
395{
396 switch (rAny.pType->eTypeClass)
397 {
399 value = * static_cast< const sal_Int8 * >( rAny.pData );
400 return true;
403 value = * static_cast< const sal_Int16 * >( rAny.pData );
404 return true;
405 default:
406 return false;
407 }
408}
409
410template<>
411inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
412{
413 switch (rAny.pType->eTypeClass)
414 {
416 value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
417 return true;
420 value = * static_cast< const sal_uInt16 * >( rAny.pData );
421 return true;
422 default:
423 return false;
424 }
425}
426// long
427
428template<>
429inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value )
430{
431 switch (rAny.pType->eTypeClass)
432 {
434 value = * static_cast< const sal_Int8 * >( rAny.pData );
435 return true;
437 value = * static_cast< const sal_Int16 * >( rAny.pData );
438 return true;
440 value = * static_cast< const sal_uInt16 * >( rAny.pData );
441 return true;
444 value = * static_cast< const sal_Int32 * >( rAny.pData );
445 return true;
446 default:
447 return false;
448 }
449}
450
451template<>
452inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
453{
454 switch (rAny.pType->eTypeClass)
455 {
457 value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
458 return true;
460 value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
461 return true;
463 value = * static_cast< const sal_uInt16 * >( rAny.pData );
464 return true;
467 value = * static_cast< const sal_uInt32 * >( rAny.pData );
468 return true;
469 default:
470 return false;
471 }
472}
473// hyper
474
475template<>
476inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value )
477{
478 switch (rAny.pType->eTypeClass)
479 {
481 value = * static_cast< const sal_Int8 * >( rAny.pData );
482 return true;
484 value = * static_cast< const sal_Int16 * >( rAny.pData );
485 return true;
487 value = * static_cast< const sal_uInt16 * >( rAny.pData );
488 return true;
490 value = * static_cast< const sal_Int32 * >( rAny.pData );
491 return true;
493 value = * static_cast< const sal_uInt32 * >( rAny.pData );
494 return true;
497 value = * static_cast< const sal_Int64 * >( rAny.pData );
498 return true;
499 default:
500 return false;
501 }
502}
503
504template<>
505inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
506{
507 switch (rAny.pType->eTypeClass)
508 {
510 value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
511 return true;
513 value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
514 return true;
516 value = * static_cast< const sal_uInt16 * >( rAny.pData );
517 return true;
519 value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
520 return true;
522 value = * static_cast< const sal_uInt32 * >( rAny.pData );
523 return true;
526 value = * static_cast< const sal_uInt64 * >( rAny.pData );
527 return true;
528 default:
529 return false;
530 }
531}
532// float
533
534template<>
535inline bool SAL_CALL operator >>= ( const Any & rAny, float & value )
536{
537 switch (rAny.pType->eTypeClass)
538 {
540 value = * static_cast< const sal_Int8 * >( rAny.pData );
541 return true;
543 value = * static_cast< const sal_Int16 * >( rAny.pData );
544 return true;
546 value = * static_cast< const sal_uInt16 * >( rAny.pData );
547 return true;
549 value = * static_cast< const float * >( rAny.pData );
550 return true;
551 default:
552 return false;
553 }
554}
555// double
556
557template<>
558inline bool SAL_CALL operator >>= ( const Any & rAny, double & value )
559{
560 switch (rAny.pType->eTypeClass)
561 {
563 value = * static_cast< const sal_Int8 * >( rAny.pData );
564 return true;
566 value = * static_cast< const sal_Int16 * >( rAny.pData );
567 return true;
569 value = * static_cast< const sal_uInt16 * >( rAny.pData );
570 return true;
572 value = * static_cast< const sal_Int32 * >( rAny.pData );
573 return true;
575 value = * static_cast< const sal_uInt32 * >( rAny.pData );
576 return true;
578 value = * static_cast< const float * >( rAny.pData );
579 return true;
581 value = * static_cast< const double * >( rAny.pData );
582 return true;
583 default:
584 return false;
585 }
586}
587// string
588
589template<>
590inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value )
591{
592 if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
593 {
594 value = * static_cast< const ::rtl::OUString * >( rAny.pData );
595 return true;
596 }
597 return false;
598}
599
600template<>
601inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value )
602{
603 return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
604 value == * static_cast< const ::rtl::OUString * >( rAny.pData ) );
605}
606// type
607
608template<>
609inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value )
610{
611 if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
612 {
613 value = * static_cast< const Type * >( rAny.pData );
614 return true;
615 }
616 return false;
617}
618
619template<>
620inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
621{
622 return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
623 value.equals( * static_cast< const Type * >( rAny.pData ) ));
624}
625// any
626
627#if defined LIBO_INTERNAL_ONLY
628template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
629#else
630template<>
631inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
632{
633 if (&rAny != &value)
634 {
636 &value, rAny.pData, rAny.pType,
638 }
639 return true;
640}
641#endif
642// interface
643
644template<>
645inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value )
646{
647 if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
648 {
649 return static_cast< const BaseReference * >( rAny.pData )->operator == ( value );
650 }
651 return false;
652}
653
654// operator to compare to an any.
655
656template< class C >
657inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
658{
659 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
661 rAny.pData, rAny.pType,
662 const_cast< C * >( &value ), rType.getTypeLibType(),
664}
665// operator to compare to an any. may use specialized operators ==.
666
667template< class C >
668inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
669{
670 return (! operator == ( rAny, value ));
671}
672
673template <typename T>
674T Any::get() const
675{
676 T value = T();
677 if (! (*this >>= value)) {
678 throw RuntimeException(
681 this,
682 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
683 SAL_NO_ACQUIRE ) );
684 }
685 return value;
686}
687
688#if defined LIBO_INTERNAL_ONLY
689template<> Any Any::get() const = delete;
690#endif
691
698template<typename charT, typename traits>
699inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
700 o << "<Any: (" << any.getValueTypeName() << ')';
701 switch(any.pType->eTypeClass) {
703 break;
705 o << ' ' << any.get<bool>();
706 break;
711 o << ' ' << any.get<sal_Int64>();
712 break;
716 o << ' ' << any.get<sal_uInt64>();
717 break;
720 o << ' ' << any.get<double>();
721 break;
723 std::ios_base::fmtflags flgs = o.setf(
724 std::ios_base::hex, std::ios_base::basefield);
725 charT fill = o.fill('0');
726 o << " U+" << std::setw(4)
727 << unsigned(*static_cast<sal_Unicode const *>(any.getValue()));
728 o.setf(flgs);
729 o.fill(fill);
730 break;
731 }
733 o << ' ' << any.get<rtl::OUString>();
734 break;
736 o << ' ' << any.get<css::uno::Type>().getTypeName();
737 break;
739 o << " len "
740 << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
741 nElements);
742 break;
744 o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
745 break;
748 o << ' ' << any.getValue();
749 break;
751 o << ' ' << *static_cast<void * const *>(any.getValue());
752 break;
753 default:
754 assert(false); // this cannot happen
755 break;
756 }
757 o << '>';
758 return o;
759}
760
761}
762}
763}
764}
765
766#endif
767
768/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition: types.h:356
unsigned char sal_Bool
Definition: types.h:38
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:334
sal_uInt16 sal_Unicode
Definition: types.h:123
signed char sal_Int8
Definition: types.h:43
@ typelib_TypeClass_VOID
type class of void
Definition: typeclass.h:32
@ typelib_TypeClass_UNSIGNED_SHORT
type class of unsigned short
Definition: typeclass.h:42
@ typelib_TypeClass_STRUCT
type class of struct
Definition: typeclass.h:66
@ typelib_TypeClass_CHAR
type class of char
Definition: typeclass.h:34
@ typelib_TypeClass_HYPER
type class of hyper
Definition: typeclass.h:48
@ typelib_TypeClass_BYTE
type class of byte
Definition: typeclass.h:38
@ typelib_TypeClass_BOOLEAN
type class of boolean
Definition: typeclass.h:36
@ typelib_TypeClass_INTERFACE
type class of interface
Definition: typeclass.h:82
@ typelib_TypeClass_STRING
type class of string
Definition: typeclass.h:56
@ typelib_TypeClass_SHORT
type class of short
Definition: typeclass.h:40
@ typelib_TypeClass_FLOAT
type class of float
Definition: typeclass.h:52
@ typelib_TypeClass_DOUBLE
type class of double
Definition: typeclass.h:54
@ typelib_TypeClass_TYPE
type class of type
Definition: typeclass.h:58
@ typelib_TypeClass_UNSIGNED_HYPER
type class of unsigned hyper
Definition: typeclass.h:50
@ typelib_TypeClass_SEQUENCE
type class of sequence
Definition: typeclass.h:75
@ typelib_TypeClass_LONG
type class of long
Definition: typeclass.h:44
@ typelib_TypeClass_ENUM
type class of enum
Definition: typeclass.h:62
@ typelib_TypeClass_UNSIGNED_LONG
type class of unsigned long
Definition: typeclass.h:46
@ typelib_TypeClass_EXCEPTION
type class of exception
Definition: typeclass.h:73
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription typelib_TypeDescription
Full type description of a type.
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
CPPU_DLLPUBLIC void uno_any_construct(uno_Any *pDest, void *pSource, struct _typelib_TypeDescription *pTypeDescr, uno_AcquireFunc acquire) SAL_THROW_EXTERN_C()
Constructs an any with a given value.
CPPU_DLLPUBLIC void uno_type_any_construct(uno_Any *pDest, void *pSource, struct _typelib_TypeDescriptionReference *pType, uno_AcquireFunc acquire) SAL_THROW_EXTERN_C()
Constructs an any with a given value.
struct SAL_DLLPUBLIC_RTTI _uno_Any uno_Any
This is the binary specification of a UNO any.
CPPU_DLLPUBLIC void uno_type_any_assign(uno_Any *pDest, void *pSource, struct _typelib_TypeDescriptionReference *pType, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assign an any with a given value.
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
CPPU_DLLPUBLIC void uno_any_assign(uno_Any *pDest, void *pSource, struct _typelib_TypeDescription *pTypeDescr, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assign an any with a given value.
CPPU_DLLPUBLIC sal_Bool uno_type_isAssignableFromData(struct _typelib_TypeDescriptionReference *pAssignable, void *pFrom, struct _typelib_TypeDescriptionReference *pFromType, uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Tests whether a value of given type is assignable from given value.
CPPU_DLLPUBLIC sal_Bool uno_type_equalData(void *pVal1, struct _typelib_TypeDescriptionReference *pVal1Type, void *pVal2, struct _typelib_TypeDescriptionReference *pVal2Type, uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Tests if two values are equal.
CPPU_DLLPUBLIC sal_Bool uno_type_assignData(void *pDest, struct _typelib_TypeDescriptionReference *pDestType, void *pSource, struct _typelib_TypeDescriptionReference *pSourceType, uno_QueryInterfaceFunc queryInterface, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assigns a destination value with a source value.
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:13
CPPU_DLLPUBLIC rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
Definition: types.h:359
Definition: bootstrap.hxx:34
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:657
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &o, Any const &any)
Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example).
Definition: Any.hxx:699
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:232
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:668
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:328
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:50
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:55
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:45
Any toAny(T const &value)
Wrap a value in an Any, if necessary.
Definition: Any.hxx:242
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:278
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:324
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
Get the OBI type part of an environment descriptor.
Definition: EnvDcp.hxx:41
This is the binary specification of a SAL sequence.
Definition: types.h:304
This String class provides base functionality for C++ like Unicode character array handling.
Definition: ustring.hxx:204
Get the css::uno::Type instance representing a certain UNO type.
Definition: unotype.hxx:290
C++ class representing an IDL any.
Definition: Any.h:57
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:203
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:674
bool operator!=(const Any &rAny) const
Inequality operator: compares two anys.
Definition: Any.hxx:223
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:119
inline ::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:162
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:216
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:167
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:194
const void * getValue() const
Gets a pointer to the set value.
Definition: Any.h:194
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:113
void clear()
Clears this any.
Definition: Any.hxx:188
Any()
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:59
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:67
C++ class representing an IDL meta type.
Definition: Type.h:59
bool equals(const Type &rType) const
Compares two types.
Definition: Type.h:181
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:162