LibreOffice
LibreOffice 6.2 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 
31 #include "com/sun/star/uno/Any.h"
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 
41 extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
42  uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
44 
45 namespace com
46 {
47 namespace sun
48 {
49 namespace star
50 {
51 namespace uno
52 {
53 
54 
55 inline Any::Any()
56 {
57  ::uno_any_construct( this, NULL, NULL, cpp_acquire );
58 }
59 
60 
61 template <typename T>
62 inline Any::Any( T const & value )
63 {
65  this, const_cast<T *>(&value),
66  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
67  cpp_acquire );
68 }
69 
70 inline Any::Any( bool value )
71 {
72  sal_Bool b = value;
74  this, &b, cppu::UnoType<bool>::get().getTypeLibType(),
75  cpp_acquire );
76 }
77 
78 #if defined LIBO_INTERNAL_ONLY
79 template<typename T1, typename T2>
80 Any::Any(rtl::OUStringConcat<T1, T2> && value):
81  Any(rtl::OUString(std::move(value)))
82 {}
83 #endif
84 
85 inline Any::Any( const Any & rAny )
86 {
87  ::uno_type_any_construct( this, rAny.pData, rAny.pType, cpp_acquire );
88 }
89 
90 inline Any::Any( const void * pData_, const Type & rType )
91 {
93  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
94  cpp_acquire );
95 }
96 
97 inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr )
98 {
100  this, const_cast< void * >( pData_ ), pTypeDescr, cpp_acquire );
101 }
102 
103 inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ )
104 {
106  this, const_cast< void * >( pData_ ), pType_, cpp_acquire );
107 }
108 
109 inline Any::~Any()
110 {
112  this, cpp_release );
113 }
114 
115 inline 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 
128 namespace detail {
129 
130 inline void moveAnyInternals(Any & from, Any & to) {
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 
146 Any::Any(Any && other) {
147  detail::moveAnyInternals(other, *this);
148 }
149 
150 Any & Any::operator =(Any && other) {
152  detail::moveAnyInternals(other, *this);
153  return *this;
154 }
155 
156 #endif
157 
158 inline ::rtl::OUString Any::getValueTypeName() const
159 {
160  return ::rtl::OUString( pType->pTypeName );
161 }
162 
163 inline void Any::setValue( const void * pData_, const Type & rType )
164 {
166  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
168 }
169 
170 inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ )
171 {
173  this, const_cast< void * >( pData_ ), pType_,
175 }
176 
177 inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr )
178 {
180  this, const_cast< void * >( pData_ ), pTypeDescr,
182 }
183 
184 inline void Any::clear()
185 {
187  this, cpp_release );
188 }
189 
190 inline bool Any::isExtractableTo( const Type & rType ) const
191 {
193  rType.getTypeLibType(), pData, pType,
195 }
196 
197 
198 template <typename T>
199 inline 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
209 template<> bool Any::has<Any>() const = delete;
210 #endif
211 
212 inline bool Any::operator == ( const Any & rAny ) const
213 {
215  pData, pType, rAny.pData, rAny.pType,
217 }
218 
219 inline bool Any::operator != ( const Any & rAny ) const
220 {
221  return (! ::uno_type_equalData(
222  pData, pType, rAny.pData, rAny.pType,
224 }
225 
226 
227 template< class C >
228 inline Any SAL_CALL makeAny( const C & value )
229 {
230  return Any(value);
231 }
232 
233 #if !defined LIBO_INTERNAL_ONLY
234 template<> Any makeAny(sal_uInt16 const & value)
236 #endif
237 
238 template<typename T> Any toAny(T const & value) { return makeAny(value); }
239 
240 template<> Any toAny(Any const & value) { return value; }
241 
242 #if defined LIBO_INTERNAL_ONLY
243 
244 template<typename T1, typename T2>
245 Any makeAny(rtl::OUStringConcat<T1, T2> && value)
246 { return Any(std::move(value)); }
247 
248 template<typename T1, typename T2>
249 Any toAny(rtl::OUStringConcat<T1, T2> && value)
250 { return makeAny(std::move(value)); }
251 
252 template<typename T> bool fromAny(Any const & any, T * value) {
253  assert(value != nullptr);
254  return any >>= *value;
255 }
256 
257 template<> bool fromAny(Any const & any, Any * value) {
258  assert(value != nullptr);
259  *value = any;
260  return true;
261 }
262 
263 #endif
264 
265 template< class C >
266 inline void SAL_CALL operator <<= ( Any & rAny, const C & value )
267 {
268  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
270  &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
272 }
273 
274 // additionally for C++ bool:
275 
276 template<>
277 inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
278 {
279  sal_Bool b = value;
281  &rAny, &b, cppu::UnoType<bool>::get().getTypeLibType(),
283 }
284 
285 
286 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
287 template< class C1, class C2 >
288 inline void SAL_CALL operator <<= ( Any & rAny, rtl::OUStringConcat< C1, C2 >&& value )
289 {
290  const rtl::OUString str( std::move(value) );
291  const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
293  &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
295 }
296 template<typename T1, typename T2>
297 void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
298 #endif
299 
300 #if defined LIBO_INTERNAL_ONLY
301 template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
302 #endif
303 
304 template< class C >
305 inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
306 {
307  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
309  &value, rType.getTypeLibType(),
310  rAny.pData, rAny.pType,
313 }
314 
315 // bool
316 
317 template<>
318 inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value )
319 {
320  if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
321  {
322  value = bool(* static_cast< const sal_Bool * >( rAny.pData ));
323  return true;
324  }
325  return false;
326 }
327 
328 template<>
329 inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value )
330 {
331  return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
332  bool(value) == bool(* static_cast< const sal_Bool * >( rAny.pData )));
333 }
334 
335 
336 template<>
337 inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
338 {
339  if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
340  {
341  value = *static_cast< sal_Bool const * >( rAny.pData );
342  return true;
343  }
344  return false;
345 }
346 
347 
348 template<>
349 inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
350 {
351  return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
352  (value ==
353  bool(*static_cast< sal_Bool const * >( rAny.pData ))));
354 }
355 
356 // byte
357 
358 template<>
359 inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value )
360 {
361  if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
362  {
363  value = * static_cast< const sal_Int8 * >( rAny.pData );
364  return true;
365  }
366  return false;
367 }
368 // short
369 
370 template<>
371 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value )
372 {
373  switch (rAny.pType->eTypeClass)
374  {
376  value = * static_cast< const sal_Int8 * >( rAny.pData );
377  return true;
380  value = * static_cast< const sal_Int16 * >( rAny.pData );
381  return true;
382  default:
383  return false;
384  }
385 }
386 
387 template<>
388 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value )
389 {
390  switch (rAny.pType->eTypeClass)
391  {
393  value = static_cast<sal_uInt16>( * static_cast< const sal_Int8 * >( rAny.pData ) );
394  return true;
397  value = * static_cast< const sal_uInt16 * >( rAny.pData );
398  return true;
399  default:
400  return false;
401  }
402 }
403 // long
404 
405 template<>
406 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value )
407 {
408  switch (rAny.pType->eTypeClass)
409  {
411  value = * static_cast< const sal_Int8 * >( rAny.pData );
412  return true;
414  value = * static_cast< const sal_Int16 * >( rAny.pData );
415  return true;
417  value = * static_cast< const sal_uInt16 * >( rAny.pData );
418  return true;
421  value = * static_cast< const sal_Int32 * >( rAny.pData );
422  return true;
423  default:
424  return false;
425  }
426 }
427 
428 template<>
429 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value )
430 {
431  switch (rAny.pType->eTypeClass)
432  {
434  value = static_cast<sal_uInt32>( * static_cast< const sal_Int8 * >( rAny.pData ) );
435  return true;
437  value = static_cast<sal_uInt32>( * static_cast< const sal_Int16 * >( rAny.pData ) );
438  return true;
440  value = * static_cast< const sal_uInt16 * >( rAny.pData );
441  return true;
444  value = * static_cast< const sal_uInt32 * >( rAny.pData );
445  return true;
446  default:
447  return false;
448  }
449 }
450 // hyper
451 
452 template<>
453 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value )
454 {
455  switch (rAny.pType->eTypeClass)
456  {
458  value = * static_cast< const sal_Int8 * >( rAny.pData );
459  return true;
461  value = * static_cast< const sal_Int16 * >( rAny.pData );
462  return true;
464  value = * static_cast< const sal_uInt16 * >( rAny.pData );
465  return true;
467  value = * static_cast< const sal_Int32 * >( rAny.pData );
468  return true;
470  value = * static_cast< const sal_uInt32 * >( rAny.pData );
471  return true;
474  value = * static_cast< const sal_Int64 * >( rAny.pData );
475  return true;
476  default:
477  return false;
478  }
479 }
480 
481 template<>
482 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value )
483 {
484  switch (rAny.pType->eTypeClass)
485  {
487  value = static_cast<sal_uInt64>( * static_cast< const sal_Int8 * >( rAny.pData ) );
488  return true;
490  value = static_cast<sal_uInt64>( * static_cast< const sal_Int16 * >( rAny.pData ) );
491  return true;
493  value = * static_cast< const sal_uInt16 * >( rAny.pData );
494  return true;
496  value = static_cast<sal_uInt64>( * static_cast< const sal_Int32 * >( rAny.pData ) );
497  return true;
499  value = * static_cast< const sal_uInt32 * >( rAny.pData );
500  return true;
503  value = * static_cast< const sal_uInt64 * >( rAny.pData );
504  return true;
505  default:
506  return false;
507  }
508 }
509 // float
510 
511 template<>
512 inline bool SAL_CALL operator >>= ( const Any & rAny, float & value )
513 {
514  switch (rAny.pType->eTypeClass)
515  {
517  value = * static_cast< const sal_Int8 * >( rAny.pData );
518  return true;
520  value = * static_cast< const sal_Int16 * >( rAny.pData );
521  return true;
523  value = * static_cast< const sal_uInt16 * >( rAny.pData );
524  return true;
526  value = * static_cast< const float * >( rAny.pData );
527  return true;
528  default:
529  return false;
530  }
531 }
532 // double
533 
534 template<>
535 inline bool SAL_CALL operator >>= ( const Any & rAny, double & value )
536 {
537  switch (rAny.pType->eTypeClass)
538  {
540  value = * static_cast< const sal_Int8 * >( rAny.pData );
541  return true;
543  value = * static_cast< const sal_Int16 * >( rAny.pData );
544  return true;
546  value = * static_cast< const sal_uInt16 * >( rAny.pData );
547  return true;
549  value = * static_cast< const sal_Int32 * >( rAny.pData );
550  return true;
552  value = * static_cast< const sal_uInt32 * >( rAny.pData );
553  return true;
555  value = * static_cast< const float * >( rAny.pData );
556  return true;
558  value = * static_cast< const double * >( rAny.pData );
559  return true;
560  default:
561  return false;
562  }
563 }
564 // string
565 
566 template<>
567 inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value )
568 {
569  if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
570  {
571  value = * static_cast< const ::rtl::OUString * >( rAny.pData );
572  return true;
573  }
574  return false;
575 }
576 
577 template<>
578 inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value )
579 {
580  return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
581  value == * static_cast< const ::rtl::OUString * >( rAny.pData ) );
582 }
583 // type
584 
585 template<>
586 inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value )
587 {
588  if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
589  {
590  value = * static_cast< const Type * >( rAny.pData );
591  return true;
592  }
593  return false;
594 }
595 
596 template<>
597 inline bool SAL_CALL operator == ( const Any & rAny, const Type & value )
598 {
599  return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
600  value.equals( * static_cast< const Type * >( rAny.pData ) ));
601 }
602 // any
603 
604 #if defined LIBO_INTERNAL_ONLY
605 template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
606 #else
607 template<>
608 inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value )
609 {
610  if (&rAny != &value)
611  {
613  &value, rAny.pData, rAny.pType,
615  }
616  return true;
617 }
618 #endif
619 // interface
620 
621 template<>
622 inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value )
623 {
624  if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
625  {
626  return static_cast< const BaseReference * >( rAny.pData )->operator == ( value );
627  }
628  return false;
629 }
630 
631 // operator to compare to an any.
632 
633 template< class C >
634 inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
635 {
636  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
638  rAny.pData, rAny.pType,
639  const_cast< C * >( &value ), rType.getTypeLibType(),
641 }
642 // operator to compare to an any. may use specialized operators ==.
643 
644 template< class C >
645 inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
646 {
647  return (! operator == ( rAny, value ));
648 }
649 
650 template <typename T>
651 T Any::get() const
652 {
653  T value = T();
654  if (! (*this >>= value)) {
655  throw RuntimeException(
656  ::rtl::OUString(
658  this,
659  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
660  SAL_NO_ACQUIRE ) );
661  }
662  return value;
663 }
664 
665 #if defined LIBO_INTERNAL_ONLY
666 template<> Any Any::get() const = delete;
667 #endif
668 
675 template<typename charT, typename traits>
676 inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
677  o << "<Any: (" << any.getValueTypeName() << ')';
678  switch(any.pType->eTypeClass) {
680  break;
682  o << ' ' << any.get<bool>();
683  break;
688  o << ' ' << any.get<sal_Int64>();
689  break;
693  o << ' ' << any.get<sal_uInt64>();
694  break;
697  o << ' ' << any.get<double>();
698  break;
699  case typelib_TypeClass_CHAR: {
700  std::ios_base::fmtflags flgs = o.setf(
701  std::ios_base::hex, std::ios_base::basefield);
702  charT fill = o.fill('0');
703  o << " U+" << std::setw(4)
704  << *static_cast<sal_Unicode const *>(any.getValue());
705  o.setf(flgs);
706  o.fill(fill);
707  break;
708  }
710  o << ' ' << any.get<rtl::OUString>();
711  break;
713  o << ' ' << any.get<css::uno::Type>().getTypeName();
714  break;
716  o << " len "
717  << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
718  nElements);
719  break;
721  o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
722  break;
725  o << ' ' << any.getValue();
726  break;
728  o << ' ' << *static_cast<void * const *>(any.getValue());
729  break;
730  default:
731  assert(false); // this cannot happen
732  break;
733  }
734  o << '>';
735  return o;
736 }
737 
738 }
739 }
740 }
741 }
742 
743 #endif
744 
745 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
type class of double
Definition: typeclass.h:51
type class of unsigned long
Definition: typeclass.h:43
type class of short
Definition: typeclass.h:37
const void * getValue() const
Gets a pointer to the set value.
Definition: Any.h:190
type class of unsigned hyper
Definition: typeclass.h:47
type class of unsigned short
Definition: typeclass.h:39
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
inline::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:158
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:190
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:51
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:266
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:10
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:115
type class of interface
Definition: typeclass.h:79
type class of sequence
Definition: typeclass.h:72
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:320
C++ class representing an IDL any.
Definition: Any.h:52
type class of hyper
Definition: typeclass.h:45
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.
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:199
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:109
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:212
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
Get the OBI type part of an environment descriptor.
Definition: EnvDcp.hxx:38
struct SAL_DLLPUBLIC_RTTI _uno_Any uno_Any
This is the binary specification of an UNO any.
Definition: types.h:377
bool operator!=(const Any &rAny) const
Unequality operator: compares two anys.
Definition: Any.hxx:219
type class of long
Definition: typeclass.h:41
type class of string
Definition: typeclass.h:53
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:46
unsigned char sal_Bool
Definition: types.h:38
type class of type
Definition: typeclass.h:55
type class of char
Definition: typeclass.h:31
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.
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
CPPU_DLLPUBLIC rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
bool equals(const Type &rType) const
Compares two types.
Definition: Type.h:173
C++ class representing an IDL meta type.
Definition: Type.h:54
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.
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription typelib_TypeDescription
Full type description of a type.
signed char sal_Int8
Definition: types.h:43
sal_uInt16 sal_Unicode
Definition: types.h:141
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.
Any()
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:55
type class of boolean
Definition: typeclass.h:33
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.
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:163
This is the binary specification of a SAL sequence.
Definition: types.h:321
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:123
definition of a no acquire enum for ctors
Definition: types.h:374
type class of float
Definition: typeclass.h:49
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:41
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:228
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:346
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:58
type class of struct
Definition: typeclass.h:63
Any toAny(T const &value)
Wrap a value in an Any, if necessary.
Definition: Any.hxx:238
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:651
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:305
Get the css::uno::Type instance representing a certain UNO type.
Definition: unotype.hxx:47
type class of enum
Definition: typeclass.h:59
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.
type class of void
Definition: typeclass.h:29
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.
type class of byte
Definition: typeclass.h:35
void clear()
Clears this any.
Definition: Any.hxx:184
type class of exception
Definition: typeclass.h:70