LibreOffice
LibreOffice 24.2 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<std::size_t nBufSize>
88Any::Any(rtl::StringNumber<sal_Unicode, nBufSize> && 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
253inline Any toAny(Any&& value) { return std::move(value); }
254
255template<typename T1, typename T2>
256Any toAny(rtl::OUStringConcat<T1, T2> && value)
257{ return Any(std::move(value)); }
258
259template<std::size_t nBufSize>
260Any toAny(rtl::StringNumber<sal_Unicode, nBufSize> && value)
261{ return Any(std::move(value)); }
262
263template<typename T> bool fromAny(Any const & any, T * value) {
264 assert(value != nullptr);
265 return any >>= *value;
266}
267
268template<> bool fromAny(Any const & any, Any * value) {
269 assert(value != nullptr);
270 *value = any;
271 return true;
272}
273
274#endif
275
276template< class C >
277inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
278{
279 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
281 &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
283}
284
285// additionally for C++ bool:
286
287template<>
288inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
289{
290 sal_Bool b = value;
292 &rAny, &b, cppu::UnoType<bool>::get().getTypeLibType(),
294}
295
296
297#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
298template< class C1, class C2 >
299inline void operator <<= ( Any & rAny, rtl::OUStringConcat< C1, C2 >&& value )
300{
301 const rtl::OUString str( std::move(value) );
302 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
304 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
306}
307template<typename T1, typename T2>
308void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
309template< std::size_t nBufSize >
310inline void operator <<= ( Any & rAny, rtl::StringNumber< sal_Unicode, nBufSize >&& value )
311{
312 const rtl::OUString str( std::move(value) );
313 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
315 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
317}
318template<std::size_t nBufSize>
319void operator <<=(Any &, rtl::StringNumber<sal_Unicode, nBufSize> const &) = delete;
320#endif
321
322#if defined LIBO_INTERNAL_ONLY
323template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
324#endif
325
326template< class C >
327inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
328{
329 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
330 return ::uno_type_assignData(
331 &value, rType.getTypeLibType(),
332 rAny.pData, rAny.pType,
335}
336
337// bool
338
339template<>
340inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value )
341{
342 if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
343 {
344 value = bool(* static_cast< const sal_Bool * >( rAny.pData ));
345 return true;
346 }
347 return false;
348}
349
350template<>
351inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value )
352{
353 return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
354 bool(value) == bool(* static_cast< const sal_Bool * >( rAny.pData )));
355}
356
357
358template<>
359inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
360{
361 if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
362 {
363 value = *static_cast< sal_Bool const * >( rAny.pData );
364 return true;
365 }
366 return false;
367}
368
369
370template<>
371inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
372{
373 return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
374 (value ==
375 bool(*static_cast< sal_Bool const * >( rAny.pData ))));
376}
377
378// byte
379
380template<>
381inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value )
382{
383 if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
384 {
385 value = * static_cast< const sal_Int8 * >( rAny.pData );
386 return true;
387 }
388 return false;
389}
390// short
391
392template<>
393inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value )
394{
395 switch (rAny.pType->eTypeClass)
396 {
398 value = * static_cast< const sal_Int8 * >( rAny.pData );
399 return true;
402 value = * static_cast< const sal_Int16 * >( rAny.pData );
403 return true;
404 default:
405 return false;
406 }
407}
408
409template<>
410inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
411{
412 switch (rAny.pType->eTypeClass)
413 {
415 value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
416 return true;
419 value = * static_cast< const sal_uInt16 * >( rAny.pData );
420 return true;
421 default:
422 return false;
423 }
424}
425// long
426
427template<>
428inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value )
429{
430 switch (rAny.pType->eTypeClass)
431 {
433 value = * static_cast< const sal_Int8 * >( rAny.pData );
434 return true;
436 value = * static_cast< const sal_Int16 * >( rAny.pData );
437 return true;
439 value = * static_cast< const sal_uInt16 * >( rAny.pData );
440 return true;
443 value = * static_cast< const sal_Int32 * >( rAny.pData );
444 return true;
445 default:
446 return false;
447 }
448}
449
450template<>
451inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
452{
453 switch (rAny.pType->eTypeClass)
454 {
456 value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
457 return true;
459 value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
460 return true;
462 value = * static_cast< const sal_uInt16 * >( rAny.pData );
463 return true;
466 value = * static_cast< const sal_uInt32 * >( rAny.pData );
467 return true;
468 default:
469 return false;
470 }
471}
472// hyper
473
474template<>
475inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value )
476{
477 switch (rAny.pType->eTypeClass)
478 {
480 value = * static_cast< const sal_Int8 * >( rAny.pData );
481 return true;
483 value = * static_cast< const sal_Int16 * >( rAny.pData );
484 return true;
486 value = * static_cast< const sal_uInt16 * >( rAny.pData );
487 return true;
489 value = * static_cast< const sal_Int32 * >( rAny.pData );
490 return true;
492 value = * static_cast< const sal_uInt32 * >( rAny.pData );
493 return true;
496 value = * static_cast< const sal_Int64 * >( rAny.pData );
497 return true;
498 default:
499 return false;
500 }
501}
502
503template<>
504inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
505{
506 switch (rAny.pType->eTypeClass)
507 {
509 value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
510 return true;
512 value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
513 return true;
515 value = * static_cast< const sal_uInt16 * >( rAny.pData );
516 return true;
518 value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
519 return true;
521 value = * static_cast< const sal_uInt32 * >( rAny.pData );
522 return true;
525 value = * static_cast< const sal_uInt64 * >( rAny.pData );
526 return true;
527 default:
528 return false;
529 }
530}
531// float
532
533template<>
534inline bool SAL_CALL operator >>= ( const Any & rAny, float & value )
535{
536 switch (rAny.pType->eTypeClass)
537 {
539 value = * static_cast< const sal_Int8 * >( rAny.pData );
540 return true;
542 value = * static_cast< const sal_Int16 * >( rAny.pData );
543 return true;
545 value = * static_cast< const sal_uInt16 * >( rAny.pData );
546 return true;
548 value = * static_cast< const float * >( rAny.pData );
549 return true;
550 default:
551 return false;
552 }
553}
554// double
555
556template<>
557inline bool SAL_CALL operator >>= ( const Any & rAny, double & value )
558{
559 switch (rAny.pType->eTypeClass)
560 {
562 value = * static_cast< const sal_Int8 * >( rAny.pData );
563 return true;
565 value = * static_cast< const sal_Int16 * >( rAny.pData );
566 return true;
568 value = * static_cast< const sal_uInt16 * >( rAny.pData );
569 return true;
571 value = * static_cast< const sal_Int32 * >( rAny.pData );
572 return true;
574 value = * static_cast< const sal_uInt32 * >( rAny.pData );
575 return true;
577 value = * static_cast< const float * >( rAny.pData );
578 return true;
580 value = * static_cast< const double * >( rAny.pData );
581 return true;
582 default:
583 return false;
584 }
585}
586// string
587
588template<>
589inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value )
590{
591 if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
592 {
593 value = * static_cast< const ::rtl::OUString * >( rAny.pData );
594 return true;
595 }
596 return false;
597}
598
599template<>
600inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value )
601{
602 return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
603 value == * static_cast< const ::rtl::OUString * >( rAny.pData ) );
604}
605
606#if defined LIBO_INTERNAL_ONLY
607template<std::size_t N>
608inline bool SAL_CALL operator == (const Any& rAny, const rtl::OUStringLiteral<N>& value)
609{
610 return operator ==(rAny, rtl::OUString(value));
611}
612#endif
613// type
614
615template<>
616inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value )
617{
618 if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
619 {
620 value = * static_cast< const Type * >( rAny.pData );
621 return true;
622 }
623 return false;
624}
625
626template<>
627inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
628{
629 return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
630 value.equals( * static_cast< const Type * >( rAny.pData ) ));
631}
632// any
633
634#if defined LIBO_INTERNAL_ONLY
635template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
636#else
637template<>
638inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
639{
640 if (&rAny != &value)
641 {
643 &value, rAny.pData, rAny.pType,
645 }
646 return true;
647}
648#endif
649// interface
650
651template<>
652inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value )
653{
654 if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
655 {
656 return static_cast< const BaseReference * >( rAny.pData )->operator == ( value );
657 }
658 return false;
659}
660
661// operator to compare to an any.
662
663template< class C >
664inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
665{
666 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
667 return ::uno_type_equalData(
668 rAny.pData, rAny.pType,
669 const_cast< C * >( &value ), rType.getTypeLibType(),
671}
672// operator to compare to an any. may use specialized operators ==.
673
674template< class C >
675inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
676{
677 return (! operator == ( rAny, value ));
678}
679
680template <typename T>
681T Any::get() const
682{
683 T value = T();
684 if (! (*this >>= value)) {
685 throw RuntimeException(
688 this,
689 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
690 SAL_NO_ACQUIRE ) );
691 }
692 return value;
693}
694
695#if defined LIBO_INTERNAL_ONLY
696template<> Any Any::get() const = delete;
697#endif
698
705template<typename charT, typename traits>
706inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
707 o << "<Any: (" << any.getValueTypeName() << ')';
708 switch(any.pType->eTypeClass) {
710 break;
712 o << ' ' << any.get<bool>();
713 break;
718 o << ' ' << any.get<sal_Int64>();
719 break;
723 o << ' ' << any.get<sal_uInt64>();
724 break;
727 o << ' ' << any.get<double>();
728 break;
730 std::ios_base::fmtflags flgs = o.setf(
731 std::ios_base::hex, std::ios_base::basefield);
732 charT fill = o.fill('0');
733 o << " U+" << std::setw(4)
734 << unsigned(*static_cast<sal_Unicode const *>(any.getValue()));
735 o.setf(flgs);
736 o.fill(fill);
737 break;
738 }
740 o << ' ' << any.get<rtl::OUString>();
741 break;
743 o << ' ' << any.get<css::uno::Type>().getTypeName();
744 break;
746 o << " len "
747 << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
748 nElements);
749 break;
751 o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
752 break;
755 o << ' ' << any.getValue();
756 break;
758 o << ' ' << *static_cast<void * const *>(any.getValue());
759 break;
760 default:
761 assert(false); // this cannot happen
762 break;
763 }
764 o << '>';
765 return o;
766}
767
768}
769}
770}
771}
772
773#endif
774
775/* 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:664
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:706
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:675
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition Any.hxx:327
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:277
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:171
Get the css::uno::Type instance representing a certain UNO type.
Definition unotype.hxx:290
C++ class representing an IDL any.
Definition Any.h:58
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:681
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:198
~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