LibreOffice
LibreOffice 4.2 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 sal_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 #if ! defined(__SUNPRO_CC)
161 // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
162 template <>
163 bool Any::has<sal_uInt16>() const;
164 #endif // ! defined(__SUNPRO_CC)
165 
166 //__________________________________________________________________________________________________
167 inline sal_Bool Any::operator == ( const Any & rAny ) const SAL_THROW(())
168 {
170  pData, pType, rAny.pData, rAny.pType,
172 }
173 //__________________________________________________________________________________________________
174 inline sal_Bool Any::operator != ( const Any & rAny ) const SAL_THROW(())
175 {
176  return (! ::uno_type_equalData(
177  pData, pType, rAny.pData, rAny.pType,
179 }
180 
181 //__________________________________________________________________________________________________
182 template< class C >
183 inline Any SAL_CALL makeAny( const C & value ) SAL_THROW(())
184 {
185  return Any( &value, ::cppu::getTypeFavourUnsigned(&value) );
186 }
187 
188 // additionally specialized for C++ bool
189 //______________________________________________________________________________
190 template<>
191 inline Any SAL_CALL makeAny( bool const & value ) SAL_THROW(())
192 {
193  const sal_Bool b = value;
194  return Any( &b, ::getCppuBooleanType() );
195 }
196 
197 //__________________________________________________________________________________________________
198 #ifdef RTL_FAST_STRING
199 template< class C1, class C2 >
200 inline Any SAL_CALL makeAny( const rtl::OUStringConcat< C1, C2 >& value ) SAL_THROW(())
201 {
202  const rtl::OUString str( value );
203  return Any( &str, ::cppu::getTypeFavourUnsigned(&str) );
204 }
205 #endif
206 //__________________________________________________________________________________________________
207 template< class C >
208 inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW(())
209 {
210  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
212  &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
214 }
215 
216 // additionally for C++ bool:
217 //______________________________________________________________________________
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 sal_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 inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) SAL_THROW(())
255 {
256  if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
257  {
258  value = (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False);
259  return sal_True;
260  }
261  return sal_False;
262 }
263 //__________________________________________________________________________________________________
264 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(())
265 {
266  return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
267  (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False));
268 }
269 
270 //______________________________________________________________________________
271 template<>
272 inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
273  SAL_THROW(())
274 {
275  if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
276  {
277  value = *reinterpret_cast< sal_Bool const * >(
278  rAny.pData ) != sal_False;
279  return true;
280  }
281  return false;
282 }
283 
284 //______________________________________________________________________________
285 template<>
286 inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
287  SAL_THROW(())
288 {
289  return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
290  (value ==
291  (*reinterpret_cast< sal_Bool const * >( rAny.pData )
292  != sal_False)));
293 }
294 
295 // byte
296 //__________________________________________________________________________________________________
297 inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) SAL_THROW(())
298 {
299  if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
300  {
301  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
302  return sal_True;
303  }
304  return sal_False;
305 }
306 // short
307 //__________________________________________________________________________________________________
308 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(())
309 {
310  switch (rAny.pType->eTypeClass)
311  {
313  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
314  return sal_True;
317  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
318  return sal_True;
319  default:
320  return sal_False;
321  }
322 }
323 //__________________________________________________________________________________________________
324 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(())
325 {
326  switch (rAny.pType->eTypeClass)
327  {
329  value = (sal_uInt16)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
330  return sal_True;
333  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
334  return sal_True;
335  default:
336  return sal_False;
337  }
338 }
339 // long
340 //__________________________________________________________________________________________________
341 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(())
342 {
343  switch (rAny.pType->eTypeClass)
344  {
346  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
347  return sal_True;
349  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
350  return sal_True;
352  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
353  return sal_True;
356  value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
357  return sal_True;
358  default:
359  return sal_False;
360  }
361 }
362 //__________________________________________________________________________________________________
363 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(())
364 {
365  switch (rAny.pType->eTypeClass)
366  {
368  value = (sal_uInt32)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
369  return sal_True;
371  value = (sal_uInt32)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
372  return sal_True;
374  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
375  return sal_True;
378  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
379  return sal_True;
380  default:
381  return sal_False;
382  }
383 }
384 // hyper
385 //__________________________________________________________________________________________________
386 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(())
387 {
388  switch (rAny.pType->eTypeClass)
389  {
391  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
392  return sal_True;
394  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
395  return sal_True;
397  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
398  return sal_True;
400  value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
401  return sal_True;
403  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
404  return sal_True;
407  value = * reinterpret_cast< const sal_Int64 * >( rAny.pData );
408  return sal_True;
409  default:
410  return sal_False;
411  }
412 }
413 //__________________________________________________________________________________________________
414 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(())
415 {
416  switch (rAny.pType->eTypeClass)
417  {
419  value = (sal_uInt64)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
420  return sal_True;
422  value = (sal_uInt64)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
423  return sal_True;
425  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
426  return sal_True;
428  value = (sal_uInt64)( * reinterpret_cast< const sal_Int32 * >( rAny.pData ) );
429  return sal_True;
431  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
432  return sal_True;
435  value = * reinterpret_cast< const sal_uInt64 * >( rAny.pData );
436  return sal_True;
437  default:
438  return sal_False;
439  }
440 }
441 // float
442 //__________________________________________________________________________________________________
443 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(())
444 {
445  switch (rAny.pType->eTypeClass)
446  {
448  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
449  return sal_True;
451  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
452  return sal_True;
454  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
455  return sal_True;
457  value = * reinterpret_cast< const float * >( rAny.pData );
458  return sal_True;
459  default:
460  return sal_False;
461  }
462 }
463 // double
464 //__________________________________________________________________________________________________
465 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(())
466 {
467  switch (rAny.pType->eTypeClass)
468  {
470  value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
471  return sal_True;
473  value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
474  return sal_True;
476  value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
477  return sal_True;
479  value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
480  return sal_True;
482  value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
483  return sal_True;
485  value = * reinterpret_cast< const float * >( rAny.pData );
486  return sal_True;
488  value = * reinterpret_cast< const double * >( rAny.pData );
489  return sal_True;
490  default:
491  return sal_False;
492  }
493 }
494 // string
495 //__________________________________________________________________________________________________
496 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(())
497 {
498  if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
499  {
500  value = * reinterpret_cast< const ::rtl::OUString * >( rAny.pData );
501  return sal_True;
502  }
503  return sal_False;
504 }
505 //__________________________________________________________________________________________________
506 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(())
507 {
508  return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
509  value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) ));
510 }
511 // type
512 //__________________________________________________________________________________________________
513 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(())
514 {
515  if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
516  {
517  value = * reinterpret_cast< const Type * >( rAny.pData );
518  return sal_True;
519  }
520  return sal_False;
521 }
522 //__________________________________________________________________________________________________
523 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(())
524 {
525  return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
526  value.equals( * reinterpret_cast< const Type * >( rAny.pData ) ));
527 }
528 // any
529 //__________________________________________________________________________________________________
530 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(())
531 {
532  if (&rAny != &value)
533  {
535  &value, rAny.pData, rAny.pType,
537  }
538  return sal_True;
539 }
540 // interface
541 //__________________________________________________________________________________________________
542 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(())
543 {
544  if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
545  {
546  return reinterpret_cast< const BaseReference * >( rAny.pData )->operator == ( value );
547  }
548  return sal_False;
549 }
550 
551 // operator to compare to an any.
552 //__________________________________________________________________________________________________
553 template< class C >
554 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW(())
555 {
556  const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
558  rAny.pData, rAny.pType,
559  const_cast< C * >( &value ), rType.getTypeLibType(),
561 }
562 // operator to compare to an any. may use specialized operators ==.
563 //__________________________________________________________________________________________________
564 template< class C >
565 inline sal_Bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW(())
566 {
567  return (! operator == ( rAny, value ));
568 }
569 
570 extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
571  uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
573 
574 //______________________________________________________________________________
575 template <typename T>
576 T Any::get() const
577 {
578  T value = T();
579  if (! (*this >>= value)) {
580  throw RuntimeException(
581  ::rtl::OUString(
583  this,
584  ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
585  SAL_NO_ACQUIRE ),
587  }
588  return value;
589 }
590 // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
591 template <>
592 sal_uInt16 Any::get<sal_uInt16>() const;
593 
600 template<typename charT, typename traits>
601 inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any &any) {
602  o << "<Any: (" << any.getValueTypeName() << ')';
603  switch(any.pType->eTypeClass) {
605  break;
607  o << ' ' << any.get<bool>();
608  break;
613  o << ' ' << any.get<sal_Int64>();
614  break;
618  o << ' ' << any.get<sal_uInt64>();
619  break;
622  o << ' ' << any.get<double>();
623  break;
624  case typelib_TypeClass_CHAR: {
625  std::ios_base::fmtflags flgs = o.setf(
626  std::ios_base::hex, std::ios_base::basefield);
627  charT fill = o.fill('0');
628  o << " U+" << std::setw(4)
629  << *static_cast<sal_Unicode const *>(any.getValue());
630  o.setf(flgs);
631  o.fill(fill);
632  break;
633  }
635  o << ' ' << any.get<rtl::OUString>();
636  break;
638  o << ' ' << any.get<css::uno::Type>().getTypeName();
639  break;
641  o << " len "
642  << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
643  nElements);
644  break;
646  o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
647  break;
650  o << ' ' << any.getValue();
651  break;
653  o << ' ' << *static_cast<void * const *>(any.getValue());
654  break;
655  default:
656  assert(false); // this cannot happen
657  break;
658  }
659  o << '>';
660  return o;
661 }
662 
663 }
664 }
665 }
666 }
667 
668 #endif
669 
670 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CPPU_DLLPUBLIC void uno_any_clear(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Sets value to void.
type class of exception
Definition: typeclass.h:67
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.
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:36
sal_Bool isExtractableTo(const Type &rType) const
Tests whether this any is extractable to a value of given type.
Definition: Any.hxx:143
type class of short
Definition: typeclass.h:37
Any & operator=(const Any &rAny)
Assignment operator: Sets the value of the given any.
Definition: Any.hxx:100
rtl::OUString getTypeName(rtl::OUString const &rEnvDcp)
Get the OBI type part of an environment descriptor.
Definition: EnvDcp.hxx:38
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
Any()
Default constructor: Any holds no value; its type is void.
Definition: Any.hxx:46
sal_Bool operator!=(const Any &rAny, const C &value)
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:565
Holds a weak reference to a type description.
Definition: typedescription.h:40
bool has() const
Tests whether this any can provide a value of specified type.
Definition: Any.hxx:152
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
type class of unsigned hyper
Definition: typeclass.h:47
type class of unsigned short
Definition: typeclass.h:39
C++ class representing an IDL meta type.
Definition: Type.h:55
void clear()
Clears this any.
Definition: Any.hxx:137
#define sal_True
Definition: types.h:48
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.
#define SAL_THROW_EXTERN_C()
Definition: types.h:360
void *(* uno_QueryInterfaceFunc)(void *pInterface, struct _typelib_TypeDescriptionReference *pType)
Generic function pointer declaration to query for an interface.
Definition: data.h:40
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:42
type class of hyper
Definition: typeclass.h:45
type class of interface
Definition: typeclass.h:73
type class of sequence
Definition: typeclass.h:69
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.
void(* uno_ReleaseFunc)(void *pInterface)
Generic function pointer declaration to release an interface.
Definition: data.h:52
This base class serves as a base class for all template reference classes and has been introduced due...
Definition: Reference.h:54
sal_uInt16 sal_Unicode
Definition: types.h:136
::com::sun::star::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:287
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.
rtl_uString * pTypeName
fully qualified name of type
Definition: typedescription.h:55
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
struct _typelib_TypeDescriptionReference * pType
type of value
Definition: any2.h:44
type class of string
Definition: typeclass.h:53
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 long
Definition: typeclass.h:41
type class of char
Definition: typeclass.h:31
type class of type
Definition: typeclass.h:55
sal_Bool operator!=(const Any &rAny) const
Unequality operator: compares two anys.
Definition: Any.hxx:174
Full type description of a type.
Definition: typedescription.h:71
This is the binary specification of a SAL sequence.
Definition: types.h:325
void operator<<=(Any &rAny, const C &value)
Template binary <<= operator to set the value of an any.
Definition: Any.hxx:208
sal_Bool operator>>=(const Any &rAny, C &value)
Template binary >>= operator to assign a value from an any.
Definition: Any.hxx:242
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.
inline::rtl::OUString getValueTypeName() const
Gets the type name of the set value.
Definition: Any.hxx:111
const ::com::sun::star::uno::Type & getCppuBooleanType()
Gets the meta type of IDL type boolean.
Definition: Type.hxx:111
type class of boolean
Definition: typeclass.h:33
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
type class of float
Definition: typeclass.h:49
C++ class representing an IDL any.
Definition: Any.h:46
definition of a no acquire enum for ctors
Definition: types.h:376
T get() const
Provides a value of specified type, so you can easily write e.g.
Definition: Any.hxx:576
unsigned char sal_Bool
Definition: types.h:46
rtl_uString * cppu_Any_extraction_failure_msg(uno_Any const *pAny, typelib_TypeDescriptionReference *pType) SAL_THROW_EXTERN_C()
This is the binary specification of an UNO any.
Definition: any2.h:40
sal_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:554
Any makeAny(const C &value)
Template function to generically construct an any from a C++ value.
Definition: Any.hxx:183
void(* uno_AcquireFunc)(void *pInterface)
Generic function pointer declaration to acquire an interface.
Definition: data.h:46
#define sal_False
Definition: types.h:47
void setValue(const void *pData_, const Type &rType)
Sets a value.
Definition: Any.hxx:116
~Any()
Destructor: Destructs any content and frees memory.
Definition: Any.hxx:94
CPPU_DLLPUBLIC void uno_any_destruct(uno_Any *pValue, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destructs an any.
type class of struct
Definition: typeclass.h:63
signed char sal_Int8
Definition: types.h:51
sal_Bool operator==(const Any &rAny) const
Equality operator: compares two anys.
Definition: Any.hxx:167
type class of void
Definition: typeclass.h:29
type class of enum
Definition: typeclass.h:59
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:48
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:155
type class of byte
Definition: typeclass.h:35
type class of double
Definition: typeclass.h:51
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:358
type class of unsigned long
Definition: typeclass.h:43