LibreOffice
LibreOffice 4.3 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 <cassert>
25 #include <iomanip>
26 #include <ostream>
27 
28 #include <com/sun/star/uno/Any.h>
29 #include <uno/data.h>
30 #include <uno/sequence2.h>
32 #include <com/sun/star/uno/XInterface.hpp>
34 #include <cppu/unotype.hxx>
35 
36 namespace com
37 {
38 namespace sun
39 {
40 namespace star
41 {
42 namespace uno
43 {
44 
45 
46 inline Any::Any() SAL_THROW(())
47 {
49 }
50 
51 
52 template <typename T>
53 inline Any::Any( T const & value )
54 {
56  this, const_cast<T *>(&value),
57  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
59 }
60 
61 inline Any::Any( bool value )
62 {
63  sal_Bool b = value;
65  this, &b, ::getCppuBooleanType().getTypeLibType(),
67 }
68 
69 
70 inline Any::Any( const Any & rAny ) SAL_THROW(())
71 {
72  ::uno_type_any_construct( this, rAny.pData, rAny.pType, (uno_AcquireFunc)cpp_acquire );
73 }
74 
75 inline Any::Any( const void * pData_, const Type & rType ) SAL_THROW(())
76 {
78  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
80 }
81 
82 inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
83 {
85  this, const_cast< void * >( pData_ ), pTypeDescr, (uno_AcquireFunc)cpp_acquire );
86 }
87 
88 inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ ) SAL_THROW(())
89 {
91  this, const_cast< void * >( pData_ ), pType_, (uno_AcquireFunc)cpp_acquire );
92 }
93 
94 inline Any::~Any() SAL_THROW(())
95 {
98 }
99 
100 inline Any & Any::operator = ( const Any & rAny ) SAL_THROW(())
101 {
102  if (this != &rAny)
103  {
105  this, rAny.pData, rAny.pType,
107  }
108  return *this;
109 }
110 
111 inline ::rtl::OUString Any::getValueTypeName() const SAL_THROW(())
112 {
113  return ::rtl::OUString( pType->pTypeName );
114 }
115 
116 inline void Any::setValue( const void * pData_, const Type & rType ) SAL_THROW(())
117 {
119  this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
121 }
122 
123 inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ ) SAL_THROW(())
124 {
126  this, const_cast< void * >( pData_ ), pType_,
128 }
129 
130 inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
131 {
133  this, const_cast< void * >( pData_ ), pTypeDescr,
135 }
136 
137 inline void Any::clear() SAL_THROW(())
138 {
140  this, (uno_ReleaseFunc)cpp_release );
141 }
142 
143 inline bool Any::isExtractableTo( const Type & rType ) const SAL_THROW(())
144 {
146  rType.getTypeLibType(), pData, pType,
148 }
149 
150 
151 template <typename T>
152 inline bool Any::has() const
153 {
154  Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(0));
156  rType.getTypeLibType(), pData, pType,
159 }
160 
161 // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
162 template <>
163 bool Any::has<sal_uInt16>() const;
164 
165 
166 inline bool Any::operator == ( const Any & rAny ) const SAL_THROW(())
167 {
169  pData, pType, rAny.pData, rAny.pType,
171 }
172 
173 inline bool Any::operator != ( const Any & rAny ) const SAL_THROW(())
174 {
175  return (! ::uno_type_equalData(
176  pData, pType, rAny.pData, rAny.pType,
178 }
179 
180 
181 template< class C >
182 inline Any SAL_CALL makeAny( const C & value ) SAL_THROW(())
183 {
184  return Any( &value, ::cppu::getTypeFavourUnsigned(&value) );
185 }
186 
187 // additionally specialized for C++ bool
188 
189 template<>
190 inline Any SAL_CALL makeAny( bool const & value ) SAL_THROW(())
191 {
192  const sal_Bool b = value;
193  return Any( &b, ::getCppuBooleanType() );
194 }
195 
196 
197 #ifdef RTL_FAST_STRING
198 template< class C1, class C2 >
199 inline Any SAL_CALL makeAny( const rtl::OUStringConcat< C1, C2 >& value ) SAL_THROW(())
200 {
201  const rtl::OUString str( value );
202  return Any( &str, ::cppu::getTypeFavourUnsigned(&str) );
203 }
204 #endif
205 
206 template< class C >
207 inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW(())
208 {
209  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
211  &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
213 }
214 
215 // additionally for C++ bool:
216 
217 template<>
218 inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
219  SAL_THROW(())
220 {
221  sal_Bool b = value;
223  &rAny, &b, ::getCppuBooleanType().getTypeLibType(),
225 }
226 
227 
228 #ifdef RTL_FAST_STRING
229 template< class C1, class C2 >
230 inline void SAL_CALL operator <<= ( Any & rAny, const rtl::OUStringConcat< C1, C2 >& value )
231  SAL_THROW(())
232 {
233  const rtl::OUString str( value );
234  const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
236  &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
238 }
239 #endif
240 
241 template< class C >
242 inline bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(())
243 {
244  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
246  &value, rType.getTypeLibType(),
247  rAny.pData, rAny.pType,
250 }
251 
252 // bool
253 
254 template<>
255 inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) SAL_THROW(())
256 {
257  if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
258  {
259  value = (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False);
260  return true;
261  }
262  return false;
263 }
264 
265 template<>
266 inline bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(())
267 {
268  return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
269  (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False));
270 }
271 
272 
273 template<>
274 inline bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
275  SAL_THROW(())
276 {
277  if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
278  {
279  value = *reinterpret_cast< sal_Bool const * >(
280  rAny.pData ) != sal_False;
281  return true;
282  }
283  return false;
284 }
285 
286 
287 template<>
288 inline bool SAL_CALL operator == ( Any const & rAny, bool const & value )
289  SAL_THROW(())
290 {
291  return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
292  (value ==
293  (*reinterpret_cast< sal_Bool const * >( rAny.pData )
294  != sal_False)));
295 }
296 
297 // byte
298 
299 template<>
300 inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) SAL_THROW(())
301 {
302  if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
303  {
304  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
305  return true;
306  }
307  return false;
308 }
309 // short
310 
311 template<>
312 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(())
313 {
314  switch (rAny.pType->eTypeClass)
315  {
317  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
318  return true;
321  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
322  return true;
323  default:
324  return false;
325  }
326 }
327 
328 template<>
329 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(())
330 {
331  switch (rAny.pType->eTypeClass)
332  {
334  value = (sal_uInt16)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
335  return true;
338  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
339  return true;
340  default:
341  return false;
342  }
343 }
344 // long
345 
346 template<>
347 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(())
348 {
349  switch (rAny.pType->eTypeClass)
350  {
352  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
353  return true;
355  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
356  return true;
358  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
359  return true;
362  value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
363  return true;
364  default:
365  return false;
366  }
367 }
368 
369 template<>
370 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(())
371 {
372  switch (rAny.pType->eTypeClass)
373  {
375  value = (sal_uInt32)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
376  return true;
378  value = (sal_uInt32)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
379  return true;
381  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
382  return true;
385  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
386  return true;
387  default:
388  return false;
389  }
390 }
391 // hyper
392 
393 template<>
394 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(())
395 {
396  switch (rAny.pType->eTypeClass)
397  {
399  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
400  return true;
402  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
403  return true;
405  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
406  return true;
408  value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
409  return true;
411  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
412  return true;
415  value = * reinterpret_cast< const sal_Int64 * >( rAny.pData );
416  return true;
417  default:
418  return false;
419  }
420 }
421 
422 template<>
423 inline bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(())
424 {
425  switch (rAny.pType->eTypeClass)
426  {
428  value = (sal_uInt64)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
429  return true;
431  value = (sal_uInt64)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
432  return true;
434  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
435  return true;
437  value = (sal_uInt64)( * reinterpret_cast< const sal_Int32 * >( rAny.pData ) );
438  return true;
440  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
441  return true;
444  value = * reinterpret_cast< const sal_uInt64 * >( rAny.pData );
445  return true;
446  default:
447  return false;
448  }
449 }
450 // float
451 
452 template<>
453 inline bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(())
454 {
455  switch (rAny.pType->eTypeClass)
456  {
458  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
459  return true;
461  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
462  return true;
464  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
465  return true;
467  value = * reinterpret_cast< const float * >( rAny.pData );
468  return true;
469  default:
470  return false;
471  }
472 }
473 // double
474 
475 template<>
476 inline bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(())
477 {
478  switch (rAny.pType->eTypeClass)
479  {
481  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
482  return true;
484  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
485  return true;
487  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
488  return true;
490  value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
491  return true;
493  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
494  return true;
496  value = * reinterpret_cast< const float * >( rAny.pData );
497  return true;
499  value = * reinterpret_cast< const double * >( rAny.pData );
500  return true;
501  default:
502  return false;
503  }
504 }
505 // string
506 
507 template<>
508 inline bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(())
509 {
510  if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
511  {
512  value = * reinterpret_cast< const ::rtl::OUString * >( rAny.pData );
513  return true;
514  }
515  return false;
516 }
517 
518 template<>
519 inline bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(())
520 {
521  return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
522  value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) ));
523 }
524 // type
525 
526 template<>
527 inline bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(())
528 {
529  if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
530  {
531  value = * reinterpret_cast< const Type * >( rAny.pData );
532  return true;
533  }
534  return false;
535 }
536 
537 template<>
538 inline bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(())
539 {
540  return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
541  value.equals( * reinterpret_cast< const Type * >( rAny.pData ) ));
542 }
543 // any
544 
545 template<>
546 inline bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(())
547 {
548  if (&rAny != &value)
549  {
551  &value, rAny.pData, rAny.pType,
553  }
554  return true;
555 }
556 // interface
557 
558 template<>
559 inline bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(())
560 {
561  if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
562  {
563  return reinterpret_cast< const BaseReference * >( rAny.pData )->operator == ( value );
564  }
565  return false;
566 }
567 
568 // operator to compare to an any.
569 
570 template< class C >
571 inline bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW(())
572 {
573  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
575  rAny.pData, rAny.pType,
576  const_cast< C * >( &value ), rType.getTypeLibType(),
578 }
579 // operator to compare to an any. may use specialized operators ==.
580 
581 template< class C >
582 inline bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW(())
583 {
584  return (! operator == ( rAny, value ));
585 }
586 
587 extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
588  uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
590 
591 
592 template <typename T>
593 T Any::get() const
594 {
595  T value = T();
596  if (! (*this >>= value)) {
597  throw RuntimeException(
598  ::rtl::OUString(
600  this,
601  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
602  SAL_NO_ACQUIRE ),
604  }
605  return value;
606 }
607 // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
608 template <>
609 sal_uInt16 Any::get<sal_uInt16>() const;
610 
617 template<typename charT, typename traits>
618 inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any const &any) {
619  o << "<Any: (" << any.getValueTypeName() << ')';
620  switch(any.pType->eTypeClass) {
622  break;
624  o << ' ' << any.get<bool>();
625  break;
630  o << ' ' << any.get<sal_Int64>();
631  break;
635  o << ' ' << any.get<sal_uInt64>();
636  break;
639  o << ' ' << any.get<double>();
640  break;
641  case typelib_TypeClass_CHAR: {
642  std::ios_base::fmtflags flgs = o.setf(
643  std::ios_base::hex, std::ios_base::basefield);
644  charT fill = o.fill('0');
645  o << " U+" << std::setw(4)
646  << *static_cast<sal_Unicode const *>(any.getValue());
647  o.setf(flgs);
648  o.fill(fill);
649  break;
650  }
652  o << ' ' << any.get<rtl::OUString>();
653  break;
655  o << ' ' << any.get<css::uno::Type>().getTypeName();
656  break;
658  o << " len "
659  << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
660  nElements);
661  break;
663  o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
664  break;
667  o << ' ' << any.getValue();
668  break;
670  o << ' ' << *static_cast<void * const *>(any.getValue());
671  break;
672  default:
673  assert(false); // this cannot happen
674  break;
675  }
676  o << '>';
677  return o;
678 }
679 
680 }
681 }
682 }
683 }
684 
685 #endif
686 
687 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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.
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:152
bool operator!=(const Any &rAny, const C &value) SAL_THROW(())
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:582
type class of short
Definition: typeclass.h:37
void operator<<=(Any &rAny, const C &value) SAL_THROW(())
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:207
void setValue(const void *pData_, const Type &rType) SAL_THROW(())
Sets a value.
Definition: Any.hxx:116
type class of long
Definition: typeclass.h:41
typelib_TypeDescriptionReference * getTypeLibType() const SAL_THROW(())
Gets the C typelib type description reference pointer.
Definition: Type.h:155
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.
unsigned char sal_Bool
Definition: types.h:46
type class of enum
Definition: typeclass.h:59
C++ class representing an IDL meta type.
Definition: Type.h:55
type class of unsigned hyper
Definition: typeclass.h:47
type class of exception
Definition: typeclass.h:70
definition of a no acquire enum for ctors
Definition: types.h:388
type class of unsigned long
Definition: typeclass.h:43
#define sal_False
Definition: types.h:47
rtl_uString * pTypeName
fully qualified name of type
Definition: typedescription.h:55
type class of void
Definition: typeclass.h:29
type class of double
Definition: typeclass.h:51
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 _typelib_TypeDescriptionReference * pType
type of value
Definition: any2.h:44
type class of boolean
Definition: typeclass.h:33
Any() SAL_THROW(())
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:46
type class of float
Definition: typeclass.h:49
Holds a weak reference to a type description.
Definition: typedescription.h:40
~Any() SAL_THROW(())
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:94
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
Get the OBI type part of an environment descriptor.
Definition: EnvDcp.hxx:38
type class of interface
Definition: typeclass.h:79
This is the binary specification of a SAL sequence.
Definition: types.h:327
::com::sun::star::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:287
void(* uno_AcquireFunc)(void *pInterface)
Generic function pointer declaration to acquire an interface.
Definition: data.h:46
signed char sal_Int8
Definition: types.h:51
Any & operator=(const Any &rAny) SAL_THROW(())
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:100
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
bool operator!=(const Any &rAny) const SAL_THROW(())
Unequality operator: compares two anys.
Definition: Any.hxx:173
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.
bool operator==(const Any &rAny) const SAL_THROW(())
Equality operator: compares two anys.
Definition: Any.hxx:166
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.
struct _typelib_TypeDescription * pType
pointer to full typedescription; this value is only valid if the type is never swapped out ...
Definition: typedescription.h:58
C++ class representing an IDL any.
Definition: Any.h:46
bool isExtractableTo(const Type &rType) const SAL_THROW(())
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:143
#define SAL_THROW(x)
Exception specification documentation.
Definition: types.h:361
type class of type
Definition: typeclass.h:55
Full type description of a type.
Definition: typedescription.h:71
Any makeAny(const C &value) SAL_THROW(())
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:182
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:54
type class of sequence
Definition: typeclass.h:72
void clear() SAL_THROW(())
Clears this any.
Definition: Any.hxx:137
type class of hyper
Definition: typeclass.h:45
void cpp_acquire(void *pCppI) SAL_THROW(())
Function to acquire a C++ interface.
Definition: genfunc.hxx:36
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
bool operator==(const Any &rAny, const C &value) SAL_THROW(())
Template equality operator: compares set value of left side any to right side value.
Definition: Any.hxx:571
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
bool operator>>=(const Any &rAny, C &value) SAL_THROW(())
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:242
rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:367
type class of byte
Definition: typeclass.h:35
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.
void cpp_release(void *pCppI) SAL_THROW(())
Function to release a C++ interface.
Definition: genfunc.hxx:42
This is the binary specification of an UNO any.
Definition: any2.h:40
inline::rtl::OUString getValueTypeName() const SAL_THROW(())
Gets the type name of the set value.
Definition: Any.hxx:111
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
const ::com::sun::star::uno::Type & getCppuBooleanType() SAL_THROW(())
Gets the meta type of IDL type boolean.
Definition: Type.hxx:111
sal_uInt16 sal_Unicode
Definition: types.h:150
type class of unsigned short
Definition: typeclass.h:39
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType) SAL_THROW(())
Function to query for a C++ interface.
Definition: genfunc.hxx:48
type class of string
Definition: typeclass.h:53
type class of char
Definition: typeclass.h:31
void * pData
pointer to value; this may point to pReserved and thus the uno_Any is not anytime mem-copyable! You m...
Definition: any2.h:49
type class of struct
Definition: typeclass.h:63
void(* uno_ReleaseFunc)(void *pInterface)
Generic function pointer declaration to release an interface.
Definition: data.h:52
void *(* uno_QueryInterfaceFunc)(void *pInterface, struct _typelib_TypeDescriptionReference *pType)
Generic function pointer declaration to query for an interface.
Definition: data.h:40
Definition: types.h:391
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.
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:593