LibreOffice
LibreOffice 24.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 
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<std::size_t nBufSize>
88 Any::Any(rtl::StringNumber<sal_Unicode, nBufSize> && value): Any(rtl::OUString(std::move(value))) {}
89 template <std::size_t N>
90 Any::Any(const rtl::OUStringLiteral<N>& value): Any(rtl::OUString(value)) {}
91 #endif
92 
93 inline Any::Any( const Any & rAny )
94 {
95  ::uno_type_any_construct( this, rAny.pData, rAny.pType, cpp_acquire );
96 }
97 
98 inline Any::Any( const void * pData_, const Type & rType )
99 {
101  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
102  cpp_acquire );
103 }
104 
105 inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr )
106 {
108  this, const_cast< void * >( pData_ ), pTypeDescr, cpp_acquire );
109 }
110 
111 inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ )
112 {
114  this, const_cast< void * >( pData_ ), pType_, cpp_acquire );
115 }
116 
117 inline Any::~Any()
118 {
120  this, cpp_release );
121 }
122 
123 inline 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 
136 Any::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 
150 Any & 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 
165 inline ::rtl::OUString Any::getValueTypeName() const
166 {
167  return ::rtl::OUString( pType->pTypeName );
168 }
169 
170 inline void Any::setValue( const void * pData_, const Type & rType )
171 {
173  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
175 }
176 
177 inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ )
178 {
180  this, const_cast< void * >( pData_ ), pType_,
182 }
183 
184 inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr )
185 {
187  this, const_cast< void * >( pData_ ), pTypeDescr,
189 }
190 
191 inline void Any::clear()
192 {
194  this, cpp_release );
195 }
196 
197 inline bool Any::isExtractableTo( const Type & rType ) const
198 {
200  rType.getTypeLibType(), pData, pType,
202 }
203 
204 
205 template <typename T>
206 inline bool Any::has() const
207 {
208  Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(NULL));
210  rType.getTypeLibType(), pData, pType,
212  cpp_release );
213 }
214 
215 #if defined LIBO_INTERNAL_ONLY
216 template<> bool Any::has<Any>() const = delete;
217 #endif
218 
219 inline bool Any::operator == ( const Any & rAny ) const
220 {
222  pData, pType, rAny.pData, rAny.pType,
224 }
225 
226 inline 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
235 template< class C >
236 inline Any SAL_CALL makeAny( const C & value )
237 {
238  return Any(value);
239 }
240 
241 template<> Any makeAny(sal_uInt16 const & value)
243 #endif
244 
245 template<typename T> Any toAny(T const & value) {
246  return Any(value);
247 }
248 
249 template<> Any toAny(Any const & value) { return value; }
250 
251 #if defined LIBO_INTERNAL_ONLY
252 
253 inline Any toAny(Any&& value) { return std::move(value); }
254 
255 template<typename T1, typename T2>
256 Any toAny(rtl::OUStringConcat<T1, T2> && value)
257 { return Any(std::move(value)); }
258 
259 template<std::size_t nBufSize>
260 Any toAny(rtl::StringNumber<sal_Unicode, nBufSize> && value)
261 { return Any(std::move(value)); }
262 
263 template<typename T> bool fromAny(Any const & any, T * value) {
264  assert(value != nullptr);
265  return any >>= *value;
266 }
267 
268 template<> bool fromAny(Any const & any, Any * value) {
269  assert(value != nullptr);
270  *value = any;
271  return true;
272 }
273 
274 #endif
275 
276 template< class C >
277 inline 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 
287 template<>
288 inline 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"
298 template< class C1, class C2 >
299 inline 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 }
307 template<typename T1, typename T2>
308 void operator <<=(Any &, rtl::OUStringConcat<T1, T2> const &) = delete;
309 template< std::size_t nBufSize >
310 inline 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 }
318 template<std::size_t nBufSize>
319 void operator <<=(Any &, rtl::StringNumber<sal_Unicode, nBufSize> const &) = delete;
320 #endif
321 
322 #if defined LIBO_INTERNAL_ONLY
323 template<> void SAL_CALL operator <<=(Any &, Any const &) = delete;
324 #endif
325 
326 template< class C >
327 inline bool SAL_CALL operator >>= ( const Any & rAny, C & value )
328 {
329  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
331  &value, rType.getTypeLibType(),
332  rAny.pData, rAny.pType,
335 }
336 
337 // bool
338 
339 template<>
340 inline 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 
350 template<>
351 inline 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 
358 template<>
359 inline 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 
370 template<>
371 inline 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 
380 template<>
381 inline 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 
392 template<>
393 inline 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 
409 template<>
410 inline 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 
427 template<>
428 inline 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 
450 template<>
451 inline 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 
474 template<>
475 inline 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 
503 template<>
504 inline 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 
533 template<>
534 inline 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 
556 template<>
557 inline 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 
588 template<>
589 inline 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 
599 template<>
600 inline 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
607 template<std::size_t N>
608 inline 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 
615 template<>
616 inline 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 
626 template<>
627 inline 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
635 template<> bool SAL_CALL operator >>=(Any const &, Any &) = delete;
636 #else
637 template<>
638 inline 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 
651 template<>
652 inline 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 
663 template< class C >
664 inline bool SAL_CALL operator == ( const Any & rAny, const C & value )
665 {
666  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
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 
674 template< class C >
675 inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
676 {
677  return (! operator == ( rAny, value ));
678 }
679 
680 template <typename T>
681 T Any::get() const
682 {
683  T value = T();
684  if (! (*this >>= value)) {
685  throw RuntimeException(
686  ::rtl::OUString(
688  this,
689  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
690  SAL_NO_ACQUIRE ) );
691  }
692  return value;
693 }
694 
695 #if defined LIBO_INTERNAL_ONLY
696 template<> Any Any::get() const = delete;
697 #endif
698 
705 template<typename charT, typename traits>
706 inline 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;
729  case typelib_TypeClass_CHAR: {
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: */
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:50
type class of float
Definition: typeclass.h:52
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:334
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:681
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.
bool equals(const Type &rType) const
Compares two types.
Definition: Type.h:181
Any()
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:59
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:123
CPPU_DLLPUBLIC rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:206
signed char sal_Int8
Definition: types.h:43
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:170
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:162
Any toAny(T const &value)
Wrap a value in an Any, if necessary.
Definition: Any.hxx:245
This is the binary specification of a SAL sequence.
Definition: types.h:303
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
type class of enum
Definition: typeclass.h:62
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
type class of boolean
Definition: typeclass.h:36
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
void clear()
Clears this any.
Definition: Any.hxx:191
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:55
type class of exception
Definition: typeclass.h:73
bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:327
bool operator!=(const Any &rAny) const
Inequality operator: compares two anys.
Definition: Any.hxx:226
C++ class representing an IDL any.
Definition: Any.h:57
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 byte
Definition: typeclass.h:38
#define CPPU_DLLPUBLIC
Definition: cppudllapi.h:13
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
Get the OBI type part of an environment descriptor.
Definition: EnvDcp.hxx:41
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 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 unsigned long
Definition: typeclass.h:46
type class of struct
Definition: typeclass.h:66
Definition: types.h:359
type class of short
Definition: typeclass.h:40
inline ::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:165
unsigned char sal_Bool
Definition: types.h:38
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:45
type class of void
Definition: typeclass.h:32
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.
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:277
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescription typelib_TypeDescription
Full type description of a type.
type class of double
Definition: typeclass.h:54
Get the css::uno::Type instance representing a certain UNO type.
Definition: unotype.hxx:51
Definition: bootstrap.hxx:33
bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:219
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:117
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.
type class of unsigned hyper
Definition: typeclass.h:50
type class of interface
Definition: typeclass.h:82
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:170
definition of a no acquire enum for ctors
Definition: types.h:356
type class of unsigned short
Definition: typeclass.h:42
type class of string
Definition: typeclass.h:56
type class of char
Definition: typeclass.h:34
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:66
type class of long
Definition: typeclass.h:44
type class of hyper
Definition: typeclass.h:48
type class of sequence
Definition: typeclass.h:75
struct SAL_DLLPUBLIC_RTTI _uno_Any uno_Any
This is the binary specification of a UNO any.
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:324
bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:197
C++ class representing an IDL meta type.
Definition: Type.h:58
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.
type class of type
Definition: typeclass.h:58
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:236