LibreOffice
LibreOffice 7.5 SDK C/C++ API Reference
Loading...
Searching...
No Matches
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{}
87template<typename T>
88Any::Any(rtl::OUStringNumber<T> && value): Any(rtl::OUString(std::move(value))) {}
89template <std::size_t N>
90Any::Any(const rtl::OUStringLiteral<N>& value): Any(rtl::OUString(value)) {}
91#endif
92
93inline Any::Any( const Any & rAny )
94{
95 ::uno_type_any_construct( this, rAny.pData, rAny.pType, cpp_acquire );
96}
97
98inline Any::Any( const void * pData_, const Type & rType )
99{
101 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
102 cpp_acquire );
103}
104
105inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr )
106{
108 this, const_cast< void * >( pData_ ), pTypeDescr, cpp_acquire );
109}
110
111inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ )
112{
114 this, const_cast< void * >( pData_ ), pType_, cpp_acquire );
115}
116
117inline Any::~Any()
118{
120 this, cpp_release );
121}
122
123inline Any & Any::operator = ( const Any & rAny )
124{
125 if (this != &rAny)
126 {
128 this, rAny.pData, rAny.pType,
130 }
131 return *this;
132}
133
134#if defined LIBO_INTERNAL_ONLY
135
136Any::Any(Any && other) noexcept {
137 uno_any_construct(this, nullptr, nullptr, &cpp_acquire);
138 std::swap(other.pType, pType);
139 std::swap(other.pData, pData);
140 std::swap(other.pReserved, pReserved);
141 if (pData == &other.pReserved) {
142 pData = &pReserved;
143 }
144 // This leaves other.pData (where "other" is now VOID) dangling to somewhere (cf.
145 // CONSTRUCT_EMPTY_ANY, cppu/source/uno/prim.hxx), but what's relevant is
146 // only that it isn't a nullptr (as e.g. >>= -> uno_type_assignData ->
147 // _assignData takes a null pSource to mean "construct a default value").
148}
149
150Any & Any::operator =(Any && other) noexcept {
151 std::swap(other.pType, pType);
152 std::swap(other.pData, pData);
153 std::swap(other.pReserved, pReserved);
154 if (pData == &other.pReserved) {
155 pData = &pReserved;
156 }
157 if (other.pData == &pReserved) {
158 other.pData = &other.pReserved;
159 }
160 return *this;
161}
162
163#endif
164
165inline ::rtl::OUString Any::getValueTypeName() const
166{
167 return ::rtl::OUString( pType->pTypeName );
168}
169
170inline void Any::setValue( const void * pData_, const Type & rType )
171{
173 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
175}
176
177inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ )
178{
180 this, const_cast< void * >( pData_ ), pType_,
182}
183
184inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr )
185{
187 this, const_cast< void * >( pData_ ), pTypeDescr,
189}
190
191inline void Any::clear()
192{
194 this, cpp_release );
195}
196
197inline bool Any::isExtractableTo( const Type & rType ) const
198{
199 return ::uno_type_isAssignableFromData(
200 rType.getTypeLibType(), pData, pType,
202}
203
204
205template <typename T>
206inline bool Any::has() const
207{
208 Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(NULL));
209 return ::uno_type_isAssignableFromData(
210 rType.getTypeLibType(), pData, pType,
212 cpp_release );
213}
214
215#if defined LIBO_INTERNAL_ONLY
216template<> bool Any::has<Any>() const = delete;
217#endif
218
219inline bool Any::operator == ( const Any & rAny ) const
220{
221 return ::uno_type_equalData(
222 pData, pType, rAny.pData, rAny.pType,
224}
225
226inline bool Any::operator != ( const Any & rAny ) const
227{
228 return (! ::uno_type_equalData(
229 pData, pType, rAny.pData, rAny.pType,
231}
232
233
234#if !defined LIBO_INTERNAL_ONLY
235template< class C >
236inline Any SAL_CALL makeAny( const C & value )
237{
238 return Any(value);
239}
240
241template<> Any makeAny(sal_uInt16 const & value)
243#endif
244
245template<typename T> Any toAny(T const & value) {
246 return Any(value);
247}
248
249template<> Any toAny(Any const & value) { return value; }
250
251#if defined LIBO_INTERNAL_ONLY
252
253template<typename T1, typename T2>
254Any toAny(rtl::OUStringConcat<T1, T2> && value)
255{ return Any(std::move(value)); }
256
257template<typename T>
258Any toAny(rtl::OUStringNumber<T> && value)
259{ return Any(std::move(value)); }
260
261template<typename T> bool fromAny(Any const & any, T * value) {
262 assert(value != nullptr);
263 return any >>= *value;
264}
265
266template<> bool fromAny(Any const & any, Any * value) {
267 assert(value != nullptr);
268 *value = any;
269 return true;
270}
271
272#endif
273
274template< class C >
275inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
276{
277 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
279 &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
281}
282
283// additionally for C++ bool:
284
285template<>
286inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
287{
288 sal_Bool b = value;
290 &rAny, &b, cppu::UnoType<bool>::get().getTypeLibType(),
292}
293
294
295#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
296template< class C1, class C2 >
297inline void operator <<= ( Any & rAny, rtl::OUStringConcat< C1, C2 >&& value )
298{
299 const rtl::OUString str( std::move(value) );
300 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
302 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
304}
305template<typename T1, typename T2>
306void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
307template< class C >
308inline void operator <<= ( Any & rAny, rtl::OUStringNumber< C >&& value )
309{
310 const rtl::OUString str( std::move(value) );
311 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
313 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
315}
316template<typename T>
317void operator <<=(Any &, rtl::OUStringNumber<T> const &) = delete;
318#endif
319
320#if defined LIBO_INTERNAL_ONLY
321template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
322#endif
323
324template< class C >
325inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
326{
327 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
328 return ::uno_type_assignData(
329 &value, rType.getTypeLibType(),
330 rAny.pData, rAny.pType,
333}
334
335// bool
336
337template<>
338inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value )
339{
340 if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
341 {
342 value = bool(* static_cast< const sal_Bool * >( rAny.pData ));
343 return true;
344 }
345 return false;
346}
347
348template<>
349inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value )
350{
351 return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
352 bool(value) == bool(* static_cast< const sal_Bool * >( rAny.pData )));
353}
354
355
356template<>
357inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
358{
359 if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
360 {
361 value = *static_cast< sal_Bool const * >( rAny.pData );
362 return true;
363 }
364 return false;
365}
366
367
368template<>
369inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
370{
371 return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
372 (value ==
373 bool(*static_cast< sal_Bool const * >( rAny.pData ))));
374}
375
376// byte
377
378template<>
379inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value )
380{
381 if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
382 {
383 value = * static_cast< const sal_Int8 * >( rAny.pData );
384 return true;
385 }
386 return false;
387}
388// short
389
390template<>
391inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value )
392{
393 switch (rAny.pType->eTypeClass)
394 {
396 value = * static_cast< const sal_Int8 * >( rAny.pData );
397 return true;
400 value = * static_cast< const sal_Int16 * >( rAny.pData );
401 return true;
402 default:
403 return false;
404 }
405}
406
407template<>
408inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
409{
410 switch (rAny.pType->eTypeClass)
411 {
413 value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
414 return true;
417 value = * static_cast< const sal_uInt16 * >( rAny.pData );
418 return true;
419 default:
420 return false;
421 }
422}
423// long
424
425template<>
426inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value )
427{
428 switch (rAny.pType->eTypeClass)
429 {
431 value = * static_cast< const sal_Int8 * >( rAny.pData );
432 return true;
434 value = * static_cast< const sal_Int16 * >( rAny.pData );
435 return true;
437 value = * static_cast< const sal_uInt16 * >( rAny.pData );
438 return true;
441 value = * static_cast< const sal_Int32 * >( rAny.pData );
442 return true;
443 default:
444 return false;
445 }
446}
447
448template<>
449inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
450{
451 switch (rAny.pType->eTypeClass)
452 {
454 value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
455 return true;
457 value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
458 return true;
460 value = * static_cast< const sal_uInt16 * >( rAny.pData );
461 return true;
464 value = * static_cast< const sal_uInt32 * >( rAny.pData );
465 return true;
466 default:
467 return false;
468 }
469}
470// hyper
471
472template<>
473inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value )
474{
475 switch (rAny.pType->eTypeClass)
476 {
478 value = * static_cast< const sal_Int8 * >( rAny.pData );
479 return true;
481 value = * static_cast< const sal_Int16 * >( rAny.pData );
482 return true;
484 value = * static_cast< const sal_uInt16 * >( rAny.pData );
485 return true;
487 value = * static_cast< const sal_Int32 * >( rAny.pData );
488 return true;
490 value = * static_cast< const sal_uInt32 * >( rAny.pData );
491 return true;
494 value = * static_cast< const sal_Int64 * >( rAny.pData );
495 return true;
496 default:
497 return false;
498 }
499}
500
501template<>
502inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
503{
504 switch (rAny.pType->eTypeClass)
505 {
507 value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
508 return true;
510 value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
511 return true;
513 value = * static_cast< const sal_uInt16 * >( rAny.pData );
514 return true;
516 value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
517 return true;
519 value = * static_cast< const sal_uInt32 * >( rAny.pData );
520 return true;
523 value = * static_cast< const sal_uInt64 * >( rAny.pData );
524 return true;
525 default:
526 return false;
527 }
528}
529// float
530
531template<>
532inline bool SAL_CALL operator >>= ( const Any & rAny, float & value )
533{
534 switch (rAny.pType->eTypeClass)
535 {
537 value = * static_cast< const sal_Int8 * >( rAny.pData );
538 return true;
540 value = * static_cast< const sal_Int16 * >( rAny.pData );
541 return true;
543 value = * static_cast< const sal_uInt16 * >( rAny.pData );
544 return true;
546 value = * static_cast< const float * >( rAny.pData );
547 return true;
548 default:
549 return false;
550 }
551}
552// double
553
554template<>
555inline bool SAL_CALL operator >>= ( const Any & rAny, double & value )
556{
557 switch (rAny.pType->eTypeClass)
558 {
560 value = * static_cast< const sal_Int8 * >( rAny.pData );
561 return true;
563 value = * static_cast< const sal_Int16 * >( rAny.pData );
564 return true;
566 value = * static_cast< const sal_uInt16 * >( rAny.pData );
567 return true;
569 value = * static_cast< const sal_Int32 * >( rAny.pData );
570 return true;
572 value = * static_cast< const sal_uInt32 * >( rAny.pData );
573 return true;
575 value = * static_cast< const float * >( rAny.pData );
576 return true;
578 value = * static_cast< const double * >( rAny.pData );
579 return true;
580 default:
581 return false;
582 }
583}
584// string
585
586template<>
587inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value )
588{
589 if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
590 {
591 value = * static_cast< const ::rtl::OUString * >( rAny.pData );
592 return true;
593 }
594 return false;
595}
596
597template<>
598inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value )
599{
600 return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
601 value == * static_cast< const ::rtl::OUString * >( rAny.pData ) );
602}
603// type
604
605template<>
606inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value )
607{
608 if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
609 {
610 value = * static_cast< const Type * >( rAny.pData );
611 return true;
612 }
613 return false;
614}
615
616template<>
617inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
618{
619 return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
620 value.equals( * static_cast< const Type * >( rAny.pData ) ));
621}
622// any
623
624#if defined LIBO_INTERNAL_ONLY
625template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
626#else
627template<>
628inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
629{
630 if (&rAny != &value)
631 {
633 &value, rAny.pData, rAny.pType,
635 }
636 return true;
637}
638#endif
639// interface
640
641template<>
642inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value )
643{
644 if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
645 {
646 return static_cast< const BaseReference * >( rAny.pData )->operator == ( value );
647 }
648 return false;
649}
650
651// operator to compare to an any.
652
653template< class C >
654inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
655{
656 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
657 return ::uno_type_equalData(
658 rAny.pData, rAny.pType,
659 const_cast< C * >( &value ), rType.getTypeLibType(),
661}
662// operator to compare to an any. may use specialized operators ==.
663
664template< class C >
665inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
666{
667 return (! operator == ( rAny, value ));
668}
669
670template <typename T>
671T Any::get() const
672{
673 T value = T();
674 if (! (*this >>= value)) {
675 throw RuntimeException(
678 this,
679 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
680 SAL_NO_ACQUIRE ) );
681 }
682 return value;
683}
684
685#if defined LIBO_INTERNAL_ONLY
686template<> Any Any::get() const = delete;
687#endif
688
695template<typename charT, typename traits>
696inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
697 o << "<Any: (" << any.getValueTypeName() << ')';
698 switch(any.pType->eTypeClass) {
700 break;
702 o << ' ' << any.get<bool>();
703 break;
708 o << ' ' << any.get<sal_Int64>();
709 break;
713 o << ' ' << any.get<sal_uInt64>();
714 break;
717 o << ' ' << any.get<double>();
718 break;
720 std::ios_base::fmtflags flgs = o.setf(
721 std::ios_base::hex, std::ios_base::basefield);
722 charT fill = o.fill('0');
723 o << " U+" << std::setw(4)
724 << unsigned(*static_cast<sal_Unicode const *>(any.getValue()));
725 o.setf(flgs);
726 o.fill(fill);
727 break;
728 }
730 o << ' ' << any.get<rtl::OUString>();
731 break;
733 o << ' ' << any.get<css::uno::Type>().getTypeName();
734 break;
736 o << " len "
737 << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
738 nElements);
739 break;
741 o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
742 break;
745 o << ' ' << any.getValue();
746 break;
748 o << ' ' << *static_cast<void * const *>(any.getValue());
749 break;
750 default:
751 assert(false); // this cannot happen
752 break;
753 }
754 o << '>';
755 return o;
756}
757
758}
759}
760}
761}
762
763#endif
764
765/* 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
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.
@ 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
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 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.
#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:654
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:696
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:236
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:665
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:325
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:245
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:275
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:324
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:203
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:206
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:671
bool operator!=(const Any &rAny) const
Inequality operator: compares two anys.
Definition: Any.hxx:226
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:123
inline ::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:165
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:219
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:170
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:197
const void * getValue() const
Gets a pointer to the set value.
Definition: Any.h:197
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:117
void clear()
Clears this any.
Definition: Any.hxx:191
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