LibreOffice
LibreOffice 7.4 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 
35 #include "com/sun/star/uno/Any.h"
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 
45 extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
46  uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
48 
49 namespace com
50 {
51 namespace sun
52 {
53 namespace star
54 {
55 namespace uno
56 {
57 
58 
59 inline Any::Any()
60 {
61  ::uno_any_construct( this, NULL, NULL, cpp_acquire );
62 }
63 
64 
65 template <typename T>
66 inline Any::Any( T const & value )
67 {
69  this, const_cast<T *>(&value),
70  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
71  cpp_acquire );
72 }
73 
74 inline Any::Any( bool value )
75 {
76  sal_Bool b = value;
78  this, &b, cppu::UnoType<bool>::get().getTypeLibType(),
79  cpp_acquire );
80 }
81 
82 #if defined LIBO_INTERNAL_ONLY
83 template<typename T1, typename T2>
84 Any::Any(rtl::OUStringConcat<T1, T2> && value):
85  Any(rtl::OUString(std::move(value)))
86 {}
87 template<typename T>
88 Any::Any(rtl::OUStringNumber<T> && value): Any(rtl::OUString(std::move(value))) {}
89 #endif
90 
91 inline Any::Any( const Any & rAny )
92 {
93  ::uno_type_any_construct( this, rAny.pData, rAny.pType, cpp_acquire );
94 }
95 
96 inline Any::Any( const void * pData_, const Type & rType )
97 {
99  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
100  cpp_acquire );
101 }
102 
103 inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr )
104 {
106  this, const_cast< void * >( pData_ ), pTypeDescr, cpp_acquire );
107 }
108 
109 inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ )
110 {
112  this, const_cast< void * >( pData_ ), pType_, cpp_acquire );
113 }
114 
115 inline Any::~Any()
116 {
118  this, cpp_release );
119 }
120 
121 inline Any & Any::operator = ( const Any & rAny )
122 {
123  if (this != &rAny)
124  {
126  this, rAny.pData, rAny.pType,
128  }
129  return *this;
130 }
131 
132 #if defined LIBO_INTERNAL_ONLY
133 
134 Any::Any(Any && other) noexcept {
135  uno_any_construct(this, nullptr, nullptr, &cpp_acquire);
136  std::swap(other.pType, pType);
137  std::swap(other.pData, pData);
138  std::swap(other.pReserved, pReserved);
139  if (pData == &other.pReserved) {
140  pData = &pReserved;
141  }
142  // This leaves other.pData (where "other" 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 Any & Any::operator =(Any && other) noexcept {
149  std::swap(other.pType, pType);
150  std::swap(other.pData, pData);
151  std::swap(other.pReserved, pReserved);
152  if (pData == &other.pReserved) {
153  pData = &pReserved;
154  }
155  if (other.pData == &pReserved) {
156  other.pData = &other.pReserved;
157  }
158  return *this;
159 }
160 
161 #endif
162 
163 inline ::rtl::OUString Any::getValueTypeName() const
164 {
165  return ::rtl::OUString( pType->pTypeName );
166 }
167 
168 inline void Any::setValue( const void * pData_, const Type & rType )
169 {
171  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
173 }
174 
175 inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ )
176 {
178  this, const_cast< void * >( pData_ ), pType_,
180 }
181 
182 inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr )
183 {
185  this, const_cast< void * >( pData_ ), pTypeDescr,
187 }
188 
189 inline void Any::clear()
190 {
192  this, cpp_release );
193 }
194 
195 inline bool Any::isExtractableTo( const Type & rType ) const
196 {
198  rType.getTypeLibType(), pData, pType,
200 }
201 
202 
203 template <typename T>
204 inline bool Any::has() const
205 {
206  Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(NULL));
208  rType.getTypeLibType(), pData, pType,
210  cpp_release );
211 }
212 
213 #if defined LIBO_INTERNAL_ONLY
214 template<> bool Any::has<Any>() const = delete;
215 #endif
216 
217 inline bool Any::operator == ( const Any & rAny ) const
218 {
220  pData, pType, rAny.pData, rAny.pType,
222 }
223 
224 inline bool Any::operator != ( const Any & rAny ) const
225 {
226  return (! ::uno_type_equalData(
227  pData, pType, rAny.pData, rAny.pType,
229 }
230 
231 
232 #if !defined LIBO_INTERNAL_ONLY
233 template< class C >
234 inline Any SAL_CALL makeAny( const C & value )
235 {
236  return Any(value);
237 }
238 
239 template<> Any makeAny(sal_uInt16 const & value)
241 #endif
242 
243 template<typename T> Any toAny(T const & value) {
244  return Any(value);
245 }
246 
247 template<> Any toAny(Any const & value) { return value; }
248 
249 #if defined LIBO_INTERNAL_ONLY
250 
251 template<typename T1, typename T2>
252 Any toAny(rtl::OUStringConcat<T1, T2> && value)
253 { return Any(std::move(value)); }
254 
255 template<typename T>
256 Any toAny(rtl::OUStringNumber<T> && value)
257 { return Any(std::move(value)); }
258 
259 template<typename T> bool fromAny(Any const & any, T * value) {
260  assert(value != nullptr);
261  return any >>= *value;
262 }
263 
264 template<> bool fromAny(Any const & any, Any * value) {
265  assert(value != nullptr);
266  *value = any;
267  return true;
268 }
269 
270 #endif
271 
272 template< class C >
273 inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
274 {
275  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
277  &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
279 }
280 
281 // additionally for C++ bool:
282 
283 template<>
284 inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
285 {
286  sal_Bool b = value;
288  &rAny, &b, cppu::UnoType<bool>::get().getTypeLibType(),
290 }
291 
292 
293 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
294 template< class C1, class C2 >
295 inline void operator <<= ( Any & rAny, rtl::OUStringConcat< C1, C2 >&& value )
296 {
297  const rtl::OUString str( std::move(value) );
298  const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
300  &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
302 }
303 template<typename T1, typename T2>
304 void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
305 template< class C >
306 inline void operator <<= ( Any & rAny, rtl::OUStringNumber< C >&& value )
307 {
308  const rtl::OUString str( std::move(value) );
309  const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
311  &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
313 }
314 template<typename T>
315 void operator <<=(Any &, rtl::OUStringNumber<T> const &) = delete;
316 #endif
317 
318 #if defined LIBO_INTERNAL_ONLY
319 template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
320 #endif
321 
322 template< class C >
323 inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
324 {
325  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
327  &value, rType.getTypeLibType(),
328  rAny.pData, rAny.pType,
331 }
332 
333 // bool
334 
335 template<>
336 inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value )
337 {
338  if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
339  {
340  value = bool(* static_cast< const sal_Bool * >( rAny.pData ));
341  return true;
342  }
343  return false;
344 }
345 
346 template<>
347 inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value )
348 {
349  return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
350  bool(value) == bool(* static_cast< const sal_Bool * >( rAny.pData )));
351 }
352 
353 
354 template<>
355 inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
356 {
357  if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
358  {
359  value = *static_cast< sal_Bool const * >( rAny.pData );
360  return true;
361  }
362  return false;
363 }
364 
365 
366 template<>
367 inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
368 {
369  return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
370  (value ==
371  bool(*static_cast< sal_Bool const * >( rAny.pData ))));
372 }
373 
374 // byte
375 
376 template<>
377 inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value )
378 {
379  if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
380  {
381  value = * static_cast< const sal_Int8 * >( rAny.pData );
382  return true;
383  }
384  return false;
385 }
386 // short
387 
388 template<>
389 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value )
390 {
391  switch (rAny.pType->eTypeClass)
392  {
394  value = * static_cast< const sal_Int8 * >( rAny.pData );
395  return true;
398  value = * static_cast< const sal_Int16 * >( rAny.pData );
399  return true;
400  default:
401  return false;
402  }
403 }
404 
405 template<>
406 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
407 {
408  switch (rAny.pType->eTypeClass)
409  {
411  value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
412  return true;
415  value = * static_cast< const sal_uInt16 * >( rAny.pData );
416  return true;
417  default:
418  return false;
419  }
420 }
421 // long
422 
423 template<>
424 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value )
425 {
426  switch (rAny.pType->eTypeClass)
427  {
429  value = * static_cast< const sal_Int8 * >( rAny.pData );
430  return true;
432  value = * static_cast< const sal_Int16 * >( rAny.pData );
433  return true;
435  value = * static_cast< const sal_uInt16 * >( rAny.pData );
436  return true;
439  value = * static_cast< const sal_Int32 * >( rAny.pData );
440  return true;
441  default:
442  return false;
443  }
444 }
445 
446 template<>
447 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
448 {
449  switch (rAny.pType->eTypeClass)
450  {
452  value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
453  return true;
455  value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
456  return true;
458  value = * static_cast< const sal_uInt16 * >( rAny.pData );
459  return true;
462  value = * static_cast< const sal_uInt32 * >( rAny.pData );
463  return true;
464  default:
465  return false;
466  }
467 }
468 // hyper
469 
470 template<>
471 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value )
472 {
473  switch (rAny.pType->eTypeClass)
474  {
476  value = * static_cast< const sal_Int8 * >( rAny.pData );
477  return true;
479  value = * static_cast< const sal_Int16 * >( rAny.pData );
480  return true;
482  value = * static_cast< const sal_uInt16 * >( rAny.pData );
483  return true;
485  value = * static_cast< const sal_Int32 * >( rAny.pData );
486  return true;
488  value = * static_cast< const sal_uInt32 * >( rAny.pData );
489  return true;
492  value = * static_cast< const sal_Int64 * >( rAny.pData );
493  return true;
494  default:
495  return false;
496  }
497 }
498 
499 template<>
500 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
501 {
502  switch (rAny.pType->eTypeClass)
503  {
505  value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
506  return true;
508  value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
509  return true;
511  value = * static_cast< const sal_uInt16 * >( rAny.pData );
512  return true;
514  value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
515  return true;
517  value = * static_cast< const sal_uInt32 * >( rAny.pData );
518  return true;
521  value = * static_cast< const sal_uInt64 * >( rAny.pData );
522  return true;
523  default:
524  return false;
525  }
526 }
527 // float
528 
529 template<>
530 inline bool SAL_CALL operator >>= ( const Any & rAny, float & value )
531 {
532  switch (rAny.pType->eTypeClass)
533  {
535  value = * static_cast< const sal_Int8 * >( rAny.pData );
536  return true;
538  value = * static_cast< const sal_Int16 * >( rAny.pData );
539  return true;
541  value = * static_cast< const sal_uInt16 * >( rAny.pData );
542  return true;
544  value = * static_cast< const float * >( rAny.pData );
545  return true;
546  default:
547  return false;
548  }
549 }
550 // double
551 
552 template<>
553 inline bool SAL_CALL operator >>= ( const Any & rAny, double & value )
554 {
555  switch (rAny.pType->eTypeClass)
556  {
558  value = * static_cast< const sal_Int8 * >( rAny.pData );
559  return true;
561  value = * static_cast< const sal_Int16 * >( rAny.pData );
562  return true;
564  value = * static_cast< const sal_uInt16 * >( rAny.pData );
565  return true;
567  value = * static_cast< const sal_Int32 * >( rAny.pData );
568  return true;
570  value = * static_cast< const sal_uInt32 * >( rAny.pData );
571  return true;
573  value = * static_cast< const float * >( rAny.pData );
574  return true;
576  value = * static_cast< const double * >( rAny.pData );
577  return true;
578  default:
579  return false;
580  }
581 }
582 // string
583 
584 template<>
585 inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value )
586 {
587  if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
588  {
589  value = * static_cast< const ::rtl::OUString * >( rAny.pData );
590  return true;
591  }
592  return false;
593 }
594 
595 template<>
596 inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value )
597 {
598  return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
599  value == * static_cast< const ::rtl::OUString * >( rAny.pData ) );
600 }
601 // type
602 
603 template<>
604 inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value )
605 {
606  if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
607  {
608  value = * static_cast< const Type * >( rAny.pData );
609  return true;
610  }
611  return false;
612 }
613 
614 template<>
615 inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
616 {
617  return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
618  value.equals( * static_cast< const Type * >( rAny.pData ) ));
619 }
620 // any
621 
622 #if defined LIBO_INTERNAL_ONLY
623 template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
624 #else
625 template<>
626 inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
627 {
628  if (&rAny != &value)
629  {
631  &value, rAny.pData, rAny.pType,
633  }
634  return true;
635 }
636 #endif
637 // interface
638 
639 template<>
640 inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value )
641 {
642  if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
643  {
644  return static_cast< const BaseReference * >( rAny.pData )->operator == ( value );
645  }
646  return false;
647 }
648 
649 // operator to compare to an any.
650 
651 template< class C >
652 inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
653 {
654  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
656  rAny.pData, rAny.pType,
657  const_cast< C * >( &value ), rType.getTypeLibType(),
659 }
660 // operator to compare to an any. may use specialized operators ==.
661 
662 template< class C >
663 inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
664 {
665  return (! operator == ( rAny, value ));
666 }
667 
668 template <typename T>
669 T Any::get() const
670 {
671  T value = T();
672  if (! (*this >>= value)) {
673  throw RuntimeException(
674  ::rtl::OUString(
676  this,
677  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
678  SAL_NO_ACQUIRE ) );
679  }
680  return value;
681 }
682 
683 #if defined LIBO_INTERNAL_ONLY
684 template<> Any Any::get() const = delete;
685 #endif
686 
693 template<typename charT, typename traits>
694 inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
695  o << "<Any: (" << any.getValueTypeName() << ')';
696  switch(any.pType->eTypeClass) {
698  break;
700  o << ' ' << any.get<bool>();
701  break;
706  o << ' ' << any.get<sal_Int64>();
707  break;
711  o << ' ' << any.get<sal_uInt64>();
712  break;
715  o << ' ' << any.get<double>();
716  break;
717  case typelib_TypeClass_CHAR: {
718  std::ios_base::fmtflags flgs = o.setf(
719  std::ios_base::hex, std::ios_base::basefield);
720  charT fill = o.fill('0');
721  o << " U+" << std::setw(4)
722  << unsigned(*static_cast<sal_Unicode const *>(any.getValue()));
723  o.setf(flgs);
724  o.fill(fill);
725  break;
726  }
728  o << ' ' << any.get<rtl::OUString>();
729  break;
731  o << ' ' << any.get<css::uno::Type>().getTypeName();
732  break;
734  o << " len "
735  << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
736  nElements);
737  break;
739  o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
740  break;
743  o << ' ' << any.getValue();
744  break;
746  o << ' ' << *static_cast<void * const *>(any.getValue());
747  break;
748  default:
749  assert(false); // this cannot happen
750  break;
751  }
752  o << '>';
753  return o;
754 }
755 
756 }
757 }
758 }
759 }
760 
761 #endif
762 
763 /* 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:652
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:234
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:663
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:323
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:50
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:694
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:243
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:273
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: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:204
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:669
bool operator!=(const Any &rAny) const
Inequality operator: compares two anys.
Definition: Any.hxx:224
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:121
inline ::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:163
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:217
const void * getValue() const
Gets a pointer to the set value.
Definition: Any.h:196
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:168
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:195
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:115
void clear()
Clears this any.
Definition: Any.hxx:189
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