LibreOffice
LibreOffice 7.1 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#ifndef INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
20#define INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
21
22#include "sal/config.h"
23
24#include <algorithm>
25#include <cassert>
26#include <cstddef>
27#include <iomanip>
28#include <ostream>
29#include <utility>
30
32#include "uno/data.h"
33#include "uno/sequence2.h"
37#include "com/sun/star/uno/RuntimeException.hpp"
38#include "cppu/cppudllapi.h"
39#include "cppu/unotype.hxx"
40
41extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
42 uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
44
45namespace com
46{
47namespace sun
48{
49namespace star
50{
51namespace uno
52{
53
54
55inline Any::Any()
56{
57 ::uno_any_construct( this, NULL, NULL, cpp_acquire );
58}
59
60
61template <typename T>
62inline Any::Any( T const & value )
63{
65 this, const_cast<T *>(&value),
66 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
68}
69
70inline Any::Any( bool value )
71{
72 sal_Bool b = value;
74 this, &b, cppu::UnoType<bool>::get().getTypeLibType(),
76}
77
78#if defined LIBO_INTERNAL_ONLY
79template<typename T1, typename T2>
80Any::Any(rtl::OUStringConcat<T1, T2> && value):
81 Any(rtl::OUString(std::move(value)))
82{}
83#endif
84
85inline Any::Any( const Any & rAny )
86{
87 ::uno_type_any_construct( this, rAny.pData, rAny.pType, cpp_acquire );
88}
89
90inline Any::Any( const void * pData_, const Type & rType )
91{
93 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
95}
96
97inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr )
98{
100 this, const_cast< void * >( pData_ ), pTypeDescr, cpp_acquire );
101}
102
103inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ )
104{
106 this, const_cast< void * >( pData_ ), pType_, cpp_acquire );
107}
108
109inline Any::~Any()
110{
112 this, cpp_release );
113}
114
115inline Any & Any::operator = ( const Any & rAny )
116{
117 if (this != &rAny)
118 {
120 this, rAny.pData, rAny.pType,
122 }
123 return *this;
124}
125
126#if defined LIBO_INTERNAL_ONLY
127
128namespace detail {
129
130inline void moveAnyInternals(Any & from, Any & to) noexcept {
131 uno_any_construct(&to, nullptr, nullptr, &cpp_acquire);
132 std::swap(from.pType, to.pType);
133 std::swap(from.pData, to.pData);
134 std::swap(from.pReserved, to.pReserved);
135 if (to.pData == &from.pReserved) {
136 to.pData = &to.pReserved;
137 }
138 // This leaves from.pData (where "from" is now VOID) dangling to somewhere (cf.
139 // CONSTRUCT_EMPTY_ANY, cppu/source/uno/prim.hxx), but what's relevant is
140 // only that it isn't a nullptr (as e.g. >>= -> uno_type_assignData ->
141 // _assignData takes a null pSource to mean "construct a default value").
142}
143
144}
145
146Any::Any(Any && other) noexcept {
147 detail::moveAnyInternals(other, *this);
148}
149
150Any & Any::operator =(Any && other) noexcept {
152 detail::moveAnyInternals(other, *this);
153 return *this;
154}
155
156#endif
157
158inline ::rtl::OUString Any::getValueTypeName() const
159{
160 return ::rtl::OUString( pType->pTypeName );
161}
162
163inline void Any::setValue( const void * pData_, const Type & rType )
164{
166 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
168}
169
170inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ )
171{
173 this, const_cast< void * >( pData_ ), pType_,
175}
176
177inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr )
178{
180 this, const_cast< void * >( pData_ ), pTypeDescr,
182}
183
184inline void Any::clear()
185{
187 this, cpp_release );
188}
189
190inline bool Any::isExtractableTo( const Type & rType ) const
191{
193 rType.getTypeLibType(), pData, pType,
195}
196
197
198template <typename T>
199inline bool Any::has() const
200{
201 Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(0));
203 rType.getTypeLibType(), pData, pType,
205 cpp_release );
206}
207
208#if defined LIBO_INTERNAL_ONLY
209template<> bool Any::has<Any>() const = delete;
210#endif
211
212inline bool Any::operator == ( const Any & rAny ) const
213{
215 pData, pType, rAny.pData, rAny.pType,
217}
218
219inline bool Any::operator != ( const Any & rAny ) const
220{
221 return (! ::uno_type_equalData(
222 pData, pType, rAny.pData, rAny.pType,
224}
225
226
227template< class C >
228inline Any SAL_CALL makeAny( const C & value )
229{
230 return Any(value);
231}
232
233#if !defined LIBO_INTERNAL_ONLY
234template<> Any makeAny(sal_uInt16 const & value)
236#endif
237
238template<typename T> Any toAny(T const & value) { return makeAny(value); }
239
240template<> Any toAny(Any const & value) { return value; }
241
242#if defined LIBO_INTERNAL_ONLY
243
244template<typename T1, typename T2>
245Any makeAny(rtl::OUStringConcat<T1, T2> && value)
246{ return Any(std::move(value)); }
247
248template<typename T1, typename T2>
249Any toAny(rtl::OUStringConcat<T1, T2> && value)
250{ return makeAny(std::move(value)); }
251
252template<typename T>
253Any makeAny(rtl::OUStringNumber<T> && value)
254{ return Any(OUString(std::move(value))); }
255
256template<typename T>
257Any toAny(rtl::OUStringNumber<T> && value)
258{ return makeAny(std::move(value)); }
259
260template<typename T> bool fromAny(Any const & any, T * value) {
261 assert(value != nullptr);
262 return any >>= *value;
263}
264
265template<> bool fromAny(Any const & any, Any * value) {
266 assert(value != nullptr);
267 *value = any;
268 return true;
269}
270
271#endif
272
273template< class C >
274inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
275{
276 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
278 &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
280}
281
282// additionally for C++ bool:
283
284template<>
285inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
286{
287 sal_Bool b = value;
289 &rAny, &b, cppu::UnoType<bool>::get().getTypeLibType(),
291}
292
293
294#ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
295template< class C1, class C2 >
296inline void SAL_CALL operator <<= ( Any & rAny, rtl::OUStringConcat< C1, C2 >&& value )
297{
298 const rtl::OUString str( std::move(value) );
299 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
301 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
303}
304template<typename T1, typename T2>
305void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
306template< class C >
307inline void SAL_CALL operator <<= ( Any & rAny, rtl::OUStringNumber< C >&& value )
308{
309 const rtl::OUString str( std::move(value) );
310 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
312 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
314}
315template<typename T>
316void operator <<=(Any &, rtl::OUStringNumber<T> const &) = delete;
317#endif
318
319#if defined LIBO_INTERNAL_ONLY
320template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
321#endif
322
323template< class C >
324inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
325{
326 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
328 &value, rType.getTypeLibType(),
329 rAny.pData, rAny.pType,
332}
333
334// bool
335
336template<>
337inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value )
338{
339 if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
340 {
341 value = bool(* static_cast< const sal_Bool * >( rAny.pData ));
342 return true;
343 }
344 return false;
345}
346
347template<>
348inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value )
349{
350 return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
351 bool(value) == bool(* static_cast< const sal_Bool * >( rAny.pData )));
352}
353
354
355template<>
356inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
357{
358 if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
359 {
360 value = *static_cast< sal_Bool const * >( rAny.pData );
361 return true;
362 }
363 return false;
364}
365
366
367template<>
368inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
369{
370 return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
371 (value ==
372 bool(*static_cast< sal_Bool const * >( rAny.pData ))));
373}
374
375// byte
376
377template<>
378inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value )
379{
380 if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
381 {
382 value = * static_cast< const sal_Int8 * >( rAny.pData );
383 return true;
384 }
385 return false;
386}
387// short
388
389template<>
390inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value )
391{
392 switch (rAny.pType->eTypeClass)
393 {
395 value = * static_cast< const sal_Int8 * >( rAny.pData );
396 return true;
399 value = * static_cast< const sal_Int16 * >( rAny.pData );
400 return true;
401 default:
402 return false;
403 }
404}
405
406template<>
407inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
408{
409 switch (rAny.pType->eTypeClass)
410 {
412 value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
413 return true;
416 value = * static_cast< const sal_uInt16 * >( rAny.pData );
417 return true;
418 default:
419 return false;
420 }
421}
422// long
423
424template<>
425inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value )
426{
427 switch (rAny.pType->eTypeClass)
428 {
430 value = * static_cast< const sal_Int8 * >( rAny.pData );
431 return true;
433 value = * static_cast< const sal_Int16 * >( rAny.pData );
434 return true;
436 value = * static_cast< const sal_uInt16 * >( rAny.pData );
437 return true;
440 value = * static_cast< const sal_Int32 * >( rAny.pData );
441 return true;
442 default:
443 return false;
444 }
445}
446
447template<>
448inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
449{
450 switch (rAny.pType->eTypeClass)
451 {
453 value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
454 return true;
456 value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
457 return true;
459 value = * static_cast< const sal_uInt16 * >( rAny.pData );
460 return true;
463 value = * static_cast< const sal_uInt32 * >( rAny.pData );
464 return true;
465 default:
466 return false;
467 }
468}
469// hyper
470
471template<>
472inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value )
473{
474 switch (rAny.pType->eTypeClass)
475 {
477 value = * static_cast< const sal_Int8 * >( rAny.pData );
478 return true;
480 value = * static_cast< const sal_Int16 * >( rAny.pData );
481 return true;
483 value = * static_cast< const sal_uInt16 * >( rAny.pData );
484 return true;
486 value = * static_cast< const sal_Int32 * >( rAny.pData );
487 return true;
489 value = * static_cast< const sal_uInt32 * >( rAny.pData );
490 return true;
493 value = * static_cast< const sal_Int64 * >( rAny.pData );
494 return true;
495 default:
496 return false;
497 }
498}
499
500template<>
501inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
502{
503 switch (rAny.pType->eTypeClass)
504 {
506 value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
507 return true;
509 value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
510 return true;
512 value = * static_cast< const sal_uInt16 * >( rAny.pData );
513 return true;
515 value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
516 return true;
518 value = * static_cast< const sal_uInt32 * >( rAny.pData );
519 return true;
522 value = * static_cast< const sal_uInt64 * >( rAny.pData );
523 return true;
524 default:
525 return false;
526 }
527}
528// float
529
530template<>
531inline bool SAL_CALL operator >>= ( const Any & rAny, float & value )
532{
533 switch (rAny.pType->eTypeClass)
534 {
536 value = * static_cast< const sal_Int8 * >( rAny.pData );
537 return true;
539 value = * static_cast< const sal_Int16 * >( rAny.pData );
540 return true;
542 value = * static_cast< const sal_uInt16 * >( rAny.pData );
543 return true;
545 value = * static_cast< const float * >( rAny.pData );
546 return true;
547 default:
548 return false;
549 }
550}
551// double
552
553template<>
554inline bool SAL_CALL operator >>= ( const Any & rAny, double & value )
555{
556 switch (rAny.pType->eTypeClass)
557 {
559 value = * static_cast< const sal_Int8 * >( rAny.pData );
560 return true;
562 value = * static_cast< const sal_Int16 * >( rAny.pData );
563 return true;
565 value = * static_cast< const sal_uInt16 * >( rAny.pData );
566 return true;
568 value = * static_cast< const sal_Int32 * >( rAny.pData );
569 return true;
571 value = * static_cast< const sal_uInt32 * >( rAny.pData );
572 return true;
574 value = * static_cast< const float * >( rAny.pData );
575 return true;
577 value = * static_cast< const double * >( rAny.pData );
578 return true;
579 default:
580 return false;
581 }
582}
583// string
584
585template<>
586inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value )
587{
588 if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
589 {
590 value = * static_cast< const ::rtl::OUString * >( rAny.pData );
591 return true;
592 }
593 return false;
594}
595
596template<>
597inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value )
598{
599 return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
600 value == * static_cast< const ::rtl::OUString * >( rAny.pData ) );
601}
602// type
603
604template<>
605inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value )
606{
607 if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
608 {
609 value = * static_cast< const Type * >( rAny.pData );
610 return true;
611 }
612 return false;
613}
614
615template<>
616inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
617{
618 return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
619 value.equals( * static_cast< const Type * >( rAny.pData ) ));
620}
621// any
622
623#if defined LIBO_INTERNAL_ONLY
624template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
625#else
626template<>
627inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
628{
629 if (&rAny != &value)
630 {
632 &value, rAny.pData, rAny.pType,
634 }
635 return true;
636}
637#endif
638// interface
639
640template<>
641inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value )
642{
643 if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
644 {
645 return static_cast< const BaseReference * >( rAny.pData )->operator == ( value );
646 }
647 return false;
648}
649
650// operator to compare to an any.
651
652template< class C >
653inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
654{
655 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
657 rAny.pData, rAny.pType,
658 const_cast< C * >( &value ), rType.getTypeLibType(),
660}
661// operator to compare to an any. may use specialized operators ==.
662
663template< class C >
664inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
665{
666 return (! operator == ( rAny, value ));
667}
668
669template <typename T>
670T Any::get() const
671{
672 T value = T();
673 if (! (*this >>= value)) {
674 throw RuntimeException(
677 this,
678 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
679 SAL_NO_ACQUIRE ) );
680 }
681 return value;
682}
683
684#if defined LIBO_INTERNAL_ONLY
685template<> Any Any::get() const = delete;
686#endif
687
694template<typename charT, typename traits>
695inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
696 o << "<Any: (" << any.getValueTypeName() << ')';
697 switch(any.pType->eTypeClass) {
699 break;
701 o << ' ' << any.get<bool>();
702 break;
707 o << ' ' << any.get<sal_Int64>();
708 break;
712 o << ' ' << any.get<sal_uInt64>();
713 break;
716 o << ' ' << any.get<double>();
717 break;
719 std::ios_base::fmtflags flgs = o.setf(
720 std::ios_base::hex, std::ios_base::basefield);
721 charT fill = o.fill('0');
722 o << " U+" << std::setw(4)
723 << unsigned(*static_cast<sal_Unicode const *>(any.getValue()));
724 o.setf(flgs);
725 o.fill(fill);
726 break;
727 }
729 o << ' ' << any.get<rtl::OUString>();
730 break;
732 o << ' ' << any.get<css::uno::Type>().getTypeName();
733 break;
735 o << " len "
736 << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
737 nElements);
738 break;
740 o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
741 break;
744 o << ' ' << any.getValue();
745 break;
747 o << ' ' << *static_cast<void * const *>(any.getValue());
748 break;
749 default:
750 assert(false); // this cannot happen
751 break;
752 }
753 o << '>';
754 return o;
755}
756
757}
758}
759}
760}
761
762#endif
763
764/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ SAL_NO_ACQUIRE
definition of a no acquire enum for ctors
Definition: types.h:352
unsigned char sal_Bool
Definition: types.h:34
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:324
sal_uInt16 sal_Unicode
Definition: types.h:119
signed char sal_Int8
Definition: types.h:39
@ typelib_TypeClass_VOID
type class of void
Definition: typeclass.h:28
@ typelib_TypeClass_UNSIGNED_SHORT
type class of unsigned short
Definition: typeclass.h:38
@ typelib_TypeClass_STRUCT
type class of struct
Definition: typeclass.h:62
@ typelib_TypeClass_CHAR
type class of char
Definition: typeclass.h:30
@ typelib_TypeClass_HYPER
type class of hyper
Definition: typeclass.h:44
@ typelib_TypeClass_BYTE
type class of byte
Definition: typeclass.h:34
@ typelib_TypeClass_BOOLEAN
type class of boolean
Definition: typeclass.h:32
@ typelib_TypeClass_INTERFACE
type class of interface
Definition: typeclass.h:78
@ typelib_TypeClass_STRING
type class of string
Definition: typeclass.h:52
@ typelib_TypeClass_SHORT
type class of short
Definition: typeclass.h:36
@ typelib_TypeClass_FLOAT
type class of float
Definition: typeclass.h:48
@ typelib_TypeClass_DOUBLE
type class of double
Definition: typeclass.h:50
@ typelib_TypeClass_TYPE
type class of type
Definition: typeclass.h:54
@ typelib_TypeClass_UNSIGNED_HYPER
type class of unsigned hyper
Definition: typeclass.h:46
@ typelib_TypeClass_SEQUENCE
type class of sequence
Definition: typeclass.h:71
@ typelib_TypeClass_LONG
type class of long
Definition: typeclass.h:40
@ typelib_TypeClass_ENUM
type class of enum
Definition: typeclass.h:58
@ typelib_TypeClass_UNSIGNED_LONG
type class of unsigned long
Definition: typeclass.h:42
@ typelib_TypeClass_EXCEPTION
type class of exception
Definition: typeclass.h:69
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:10
CPPU_DLLPUBLIC rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:320
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
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:695
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:228
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
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:324
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:46
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:51
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:41
Any toAny(T const &value)
Wrap a value in an Any, if necessary.
Definition: Any.hxx:238
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:274
Definition: unotype.hxx:43
Get the css::uno::Type instance representing a certain UNO type.
Definition: unotype.hxx:286
This String class provides base functionality for C++ like Unicode character array handling.
Definition: ustring.hxx:161
This is the binary specification of a SAL sequence.
Definition: types.h:300
C++ class representing an IDL any.
Definition: Any.h:53
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:199
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:670
bool operator!=(const Any &rAny) const
Inequality operator: compares two anys.
Definition: Any.hxx:219
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:115
inline ::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:158
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:212
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:163
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:190
const void * getValue() const
Gets a pointer to the set value.
Definition: Any.h:190
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:109
void clear()
Clears this any.
Definition: Any.hxx:184
Any()
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:55
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:63
C++ class representing an IDL meta type.
Definition: Type.h:55
bool equals(const Type &rType) const
Compares two types.
Definition: Type.h:173
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154