bump product version to 4.2.0.1
[LibreOffice.git] / include / com / sun / star / uno / Any.hxx
blobe86322ff3b8f02550bb2d4133eb793d1f1fc9a93
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
20 #define INCLUDED_COM_SUN_STAR_UNO_ANY_HXX
22 #include <sal/config.h>
24 #include <cassert>
25 #include <iomanip>
26 #include <ostream>
28 #include <com/sun/star/uno/Any.h>
29 #include <uno/data.h>
30 #include <uno/sequence2.h>
31 #include <com/sun/star/uno/Type.hxx>
32 #include <com/sun/star/uno/XInterface.hpp>
33 #include <com/sun/star/uno/genfunc.hxx>
34 #include <cppu/unotype.hxx>
36 namespace com
38 namespace sun
40 namespace star
42 namespace uno
45 //__________________________________________________________________________________________________
46 inline Any::Any() SAL_THROW(())
48 ::uno_any_construct( this, 0, 0, (uno_AcquireFunc)cpp_acquire );
51 //______________________________________________________________________________
52 template <typename T>
53 inline Any::Any( T const & value )
55 ::uno_type_any_construct(
56 this, const_cast<T *>(&value),
57 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType(),
58 (uno_AcquireFunc) cpp_acquire );
60 //______________________________________________________________________________
61 inline Any::Any( bool value )
63 sal_Bool b = value;
64 ::uno_type_any_construct(
65 this, &b, ::getCppuBooleanType().getTypeLibType(),
66 (uno_AcquireFunc) cpp_acquire );
69 //__________________________________________________________________________________________________
70 inline Any::Any( const Any & rAny ) SAL_THROW(())
72 ::uno_type_any_construct( this, rAny.pData, rAny.pType, (uno_AcquireFunc)cpp_acquire );
74 //__________________________________________________________________________________________________
75 inline Any::Any( const void * pData_, const Type & rType ) SAL_THROW(())
77 ::uno_type_any_construct(
78 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
79 (uno_AcquireFunc)cpp_acquire );
81 //__________________________________________________________________________________________________
82 inline Any::Any( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
84 ::uno_any_construct(
85 this, const_cast< void * >( pData_ ), pTypeDescr, (uno_AcquireFunc)cpp_acquire );
87 //__________________________________________________________________________________________________
88 inline Any::Any( const void * pData_, typelib_TypeDescriptionReference * pType_ ) SAL_THROW(())
90 ::uno_type_any_construct(
91 this, const_cast< void * >( pData_ ), pType_, (uno_AcquireFunc)cpp_acquire );
93 //__________________________________________________________________________________________________
94 inline Any::~Any() SAL_THROW(())
96 ::uno_any_destruct(
97 this, (uno_ReleaseFunc)cpp_release );
99 //__________________________________________________________________________________________________
100 inline Any & Any::operator = ( const Any & rAny ) SAL_THROW(())
102 if (this != &rAny)
104 ::uno_type_any_assign(
105 this, rAny.pData, rAny.pType,
106 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
108 return *this;
110 //__________________________________________________________________________________________________
111 inline ::rtl::OUString Any::getValueTypeName() const SAL_THROW(())
113 return ::rtl::OUString( pType->pTypeName );
115 //__________________________________________________________________________________________________
116 inline void Any::setValue( const void * pData_, const Type & rType ) SAL_THROW(())
118 ::uno_type_any_assign(
119 this, const_cast< void * >( pData_ ), rType.getTypeLibType(),
120 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
122 //__________________________________________________________________________________________________
123 inline void Any::setValue( const void * pData_, typelib_TypeDescriptionReference * pType_ ) SAL_THROW(())
125 ::uno_type_any_assign(
126 this, const_cast< void * >( pData_ ), pType_,
127 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
129 //__________________________________________________________________________________________________
130 inline void Any::setValue( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW(())
132 ::uno_any_assign(
133 this, const_cast< void * >( pData_ ), pTypeDescr,
134 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
136 //__________________________________________________________________________________________________
137 inline void Any::clear() SAL_THROW(())
139 ::uno_any_clear(
140 this, (uno_ReleaseFunc)cpp_release );
142 //__________________________________________________________________________________________________
143 inline sal_Bool Any::isExtractableTo( const Type & rType ) const SAL_THROW(())
145 return ::uno_type_isAssignableFromData(
146 rType.getTypeLibType(), pData, pType,
147 (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release );
150 //______________________________________________________________________________
151 template <typename T>
152 inline bool Any::has() const
154 Type const & rType = ::cppu::getTypeFavourUnsigned(static_cast< T * >(0));
155 return ::uno_type_isAssignableFromData(
156 rType.getTypeLibType(), pData, pType,
157 (uno_QueryInterfaceFunc) cpp_queryInterface,
158 (uno_ReleaseFunc) cpp_release );
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)
166 //__________________________________________________________________________________________________
167 inline sal_Bool Any::operator == ( const Any & rAny ) const SAL_THROW(())
169 return ::uno_type_equalData(
170 pData, pType, rAny.pData, rAny.pType,
171 (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release );
173 //__________________________________________________________________________________________________
174 inline sal_Bool Any::operator != ( const Any & rAny ) const SAL_THROW(())
176 return (! ::uno_type_equalData(
177 pData, pType, rAny.pData, rAny.pType,
178 (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release ));
181 //__________________________________________________________________________________________________
182 template< class C >
183 inline Any SAL_CALL makeAny( const C & value ) SAL_THROW(())
185 return Any( &value, ::cppu::getTypeFavourUnsigned(&value) );
188 // additionally specialized for C++ bool
189 //______________________________________________________________________________
190 template<>
191 inline Any SAL_CALL makeAny( bool const & value ) SAL_THROW(())
193 const sal_Bool b = value;
194 return Any( &b, ::getCppuBooleanType() );
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(())
202 const rtl::OUString str( value );
203 return Any( &str, ::cppu::getTypeFavourUnsigned(&str) );
205 #endif
206 //__________________________________________________________________________________________________
207 template< class C >
208 inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW(())
210 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
211 ::uno_type_any_assign(
212 &rAny, const_cast< C * >( &value ), rType.getTypeLibType(),
213 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
216 // additionally for C++ bool:
217 //______________________________________________________________________________
218 inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
219 SAL_THROW(())
221 sal_Bool b = value;
222 ::uno_type_any_assign(
223 &rAny, &b, ::getCppuBooleanType().getTypeLibType(),
224 (uno_AcquireFunc) cpp_acquire, (uno_ReleaseFunc) cpp_release );
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(())
233 const rtl::OUString str( value );
234 const Type & rType = ::cppu::getTypeFavourUnsigned(&str);
235 ::uno_type_any_assign(
236 &rAny, const_cast< rtl::OUString * >( &str ), rType.getTypeLibType(),
237 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
239 #endif
240 //__________________________________________________________________________________________________
241 template< class C >
242 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW(())
244 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
245 return ::uno_type_assignData(
246 &value, rType.getTypeLibType(),
247 rAny.pData, rAny.pType,
248 (uno_QueryInterfaceFunc)cpp_queryInterface,
249 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
252 // bool
253 //__________________________________________________________________________________________________
254 inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Bool & value ) SAL_THROW(())
256 if (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass)
258 value = (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False);
259 return sal_True;
261 return sal_False;
263 //__________________________________________________________________________________________________
264 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW(())
266 return (typelib_TypeClass_BOOLEAN == rAny.pType->eTypeClass &&
267 (value != sal_False) == (* reinterpret_cast< const sal_Bool * >( rAny.pData ) != sal_False));
270 //______________________________________________________________________________
271 template<>
272 inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
273 SAL_THROW(())
275 if (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN)
277 value = *reinterpret_cast< sal_Bool const * >(
278 rAny.pData ) != sal_False;
279 return true;
281 return false;
284 //______________________________________________________________________________
285 template<>
286 inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
287 SAL_THROW(())
289 return (rAny.pType->eTypeClass == typelib_TypeClass_BOOLEAN &&
290 (value ==
291 (*reinterpret_cast< sal_Bool const * >( rAny.pData )
292 != sal_False)));
295 // byte
296 //__________________________________________________________________________________________________
297 inline sal_Bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & rAny, sal_Int8 & value ) SAL_THROW(())
299 if (typelib_TypeClass_BYTE == rAny.pType->eTypeClass)
301 value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
302 return sal_True;
304 return sal_False;
306 // short
307 //__________________________________________________________________________________________________
308 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW(())
310 switch (rAny.pType->eTypeClass)
312 case typelib_TypeClass_BYTE:
313 value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
314 return sal_True;
315 case typelib_TypeClass_SHORT:
316 case typelib_TypeClass_UNSIGNED_SHORT:
317 value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
318 return sal_True;
319 default:
320 return sal_False;
323 //__________________________________________________________________________________________________
324 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW(())
326 switch (rAny.pType->eTypeClass)
328 case typelib_TypeClass_BYTE:
329 value = (sal_uInt16)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
330 return sal_True;
331 case typelib_TypeClass_SHORT:
332 case typelib_TypeClass_UNSIGNED_SHORT:
333 value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
334 return sal_True;
335 default:
336 return sal_False;
339 // long
340 //__________________________________________________________________________________________________
341 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW(())
343 switch (rAny.pType->eTypeClass)
345 case typelib_TypeClass_BYTE:
346 value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
347 return sal_True;
348 case typelib_TypeClass_SHORT:
349 value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
350 return sal_True;
351 case typelib_TypeClass_UNSIGNED_SHORT:
352 value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
353 return sal_True;
354 case typelib_TypeClass_LONG:
355 case typelib_TypeClass_UNSIGNED_LONG:
356 value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
357 return sal_True;
358 default:
359 return sal_False;
362 //__________________________________________________________________________________________________
363 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW(())
365 switch (rAny.pType->eTypeClass)
367 case typelib_TypeClass_BYTE:
368 value = (sal_uInt32)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
369 return sal_True;
370 case typelib_TypeClass_SHORT:
371 value = (sal_uInt32)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
372 return sal_True;
373 case typelib_TypeClass_UNSIGNED_SHORT:
374 value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
375 return sal_True;
376 case typelib_TypeClass_LONG:
377 case typelib_TypeClass_UNSIGNED_LONG:
378 value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
379 return sal_True;
380 default:
381 return sal_False;
384 // hyper
385 //__________________________________________________________________________________________________
386 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW(())
388 switch (rAny.pType->eTypeClass)
390 case typelib_TypeClass_BYTE:
391 value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
392 return sal_True;
393 case typelib_TypeClass_SHORT:
394 value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
395 return sal_True;
396 case typelib_TypeClass_UNSIGNED_SHORT:
397 value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
398 return sal_True;
399 case typelib_TypeClass_LONG:
400 value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
401 return sal_True;
402 case typelib_TypeClass_UNSIGNED_LONG:
403 value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
404 return sal_True;
405 case typelib_TypeClass_HYPER:
406 case typelib_TypeClass_UNSIGNED_HYPER:
407 value = * reinterpret_cast< const sal_Int64 * >( rAny.pData );
408 return sal_True;
409 default:
410 return sal_False;
413 //__________________________________________________________________________________________________
414 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW(())
416 switch (rAny.pType->eTypeClass)
418 case typelib_TypeClass_BYTE:
419 value = (sal_uInt64)( * reinterpret_cast< const sal_Int8 * >( rAny.pData ) );
420 return sal_True;
421 case typelib_TypeClass_SHORT:
422 value = (sal_uInt64)( * reinterpret_cast< const sal_Int16 * >( rAny.pData ) );
423 return sal_True;
424 case typelib_TypeClass_UNSIGNED_SHORT:
425 value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
426 return sal_True;
427 case typelib_TypeClass_LONG:
428 value = (sal_uInt64)( * reinterpret_cast< const sal_Int32 * >( rAny.pData ) );
429 return sal_True;
430 case typelib_TypeClass_UNSIGNED_LONG:
431 value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
432 return sal_True;
433 case typelib_TypeClass_HYPER:
434 case typelib_TypeClass_UNSIGNED_HYPER:
435 value = * reinterpret_cast< const sal_uInt64 * >( rAny.pData );
436 return sal_True;
437 default:
438 return sal_False;
441 // float
442 //__________________________________________________________________________________________________
443 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW(())
445 switch (rAny.pType->eTypeClass)
447 case typelib_TypeClass_BYTE:
448 value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
449 return sal_True;
450 case typelib_TypeClass_SHORT:
451 value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
452 return sal_True;
453 case typelib_TypeClass_UNSIGNED_SHORT:
454 value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
455 return sal_True;
456 case typelib_TypeClass_FLOAT:
457 value = * reinterpret_cast< const float * >( rAny.pData );
458 return sal_True;
459 default:
460 return sal_False;
463 // double
464 //__________________________________________________________________________________________________
465 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW(())
467 switch (rAny.pType->eTypeClass)
469 case typelib_TypeClass_BYTE:
470 value = * reinterpret_cast< const sal_Int8 * >( rAny.pData );
471 return sal_True;
472 case typelib_TypeClass_SHORT:
473 value = * reinterpret_cast< const sal_Int16 * >( rAny.pData );
474 return sal_True;
475 case typelib_TypeClass_UNSIGNED_SHORT:
476 value = * reinterpret_cast< const sal_uInt16 * >( rAny.pData );
477 return sal_True;
478 case typelib_TypeClass_LONG:
479 value = * reinterpret_cast< const sal_Int32 * >( rAny.pData );
480 return sal_True;
481 case typelib_TypeClass_UNSIGNED_LONG:
482 value = * reinterpret_cast< const sal_uInt32 * >( rAny.pData );
483 return sal_True;
484 case typelib_TypeClass_FLOAT:
485 value = * reinterpret_cast< const float * >( rAny.pData );
486 return sal_True;
487 case typelib_TypeClass_DOUBLE:
488 value = * reinterpret_cast< const double * >( rAny.pData );
489 return sal_True;
490 default:
491 return sal_False;
494 // string
495 //__________________________________________________________________________________________________
496 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW(())
498 if (typelib_TypeClass_STRING == rAny.pType->eTypeClass)
500 value = * reinterpret_cast< const ::rtl::OUString * >( rAny.pData );
501 return sal_True;
503 return sal_False;
505 //__________________________________________________________________________________________________
506 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW(())
508 return (typelib_TypeClass_STRING == rAny.pType->eTypeClass &&
509 value.equals( * reinterpret_cast< const ::rtl::OUString * >( rAny.pData ) ));
511 // type
512 //__________________________________________________________________________________________________
513 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW(())
515 if (typelib_TypeClass_TYPE == rAny.pType->eTypeClass)
517 value = * reinterpret_cast< const Type * >( rAny.pData );
518 return sal_True;
520 return sal_False;
522 //__________________________________________________________________________________________________
523 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW(())
525 return (typelib_TypeClass_TYPE == rAny.pType->eTypeClass &&
526 value.equals( * reinterpret_cast< const Type * >( rAny.pData ) ));
528 // any
529 //__________________________________________________________________________________________________
530 inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW(())
532 if (&rAny != &value)
534 ::uno_type_any_assign(
535 &value, rAny.pData, rAny.pType,
536 (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release );
538 return sal_True;
540 // interface
541 //__________________________________________________________________________________________________
542 inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW(())
544 if (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass)
546 return reinterpret_cast< const BaseReference * >( rAny.pData )->operator == ( value );
548 return sal_False;
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(())
556 const Type & rType = ::cppu::getTypeFavourUnsigned(&value);
557 return ::uno_type_equalData(
558 rAny.pData, rAny.pType,
559 const_cast< C * >( &value ), rType.getTypeLibType(),
560 (uno_QueryInterfaceFunc)cpp_queryInterface, (uno_ReleaseFunc)cpp_release );
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(())
567 return (! operator == ( rAny, value ));
570 extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
571 uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
572 SAL_THROW_EXTERN_C();
574 //______________________________________________________________________________
575 template <typename T>
576 T Any::get() const
578 T value = T();
579 if (! (*this >>= value)) {
580 throw RuntimeException(
581 ::rtl::OUString(
582 cppu_Any_extraction_failure_msg(
583 this,
584 ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ),
585 SAL_NO_ACQUIRE ),
586 Reference<XInterface>() );
588 return value;
590 // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
591 template <>
592 sal_uInt16 Any::get<sal_uInt16>() const;
595 Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO
596 macros, for example).
598 @since LibreOffice 4.2
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) {
604 case typelib_TypeClass_VOID:
605 break;
606 case typelib_TypeClass_BOOLEAN:
607 o << ' ' << any.get<bool>();
608 break;
609 case typelib_TypeClass_BYTE:
610 case typelib_TypeClass_SHORT:
611 case typelib_TypeClass_LONG:
612 case typelib_TypeClass_HYPER:
613 o << ' ' << any.get<sal_Int64>();
614 break;
615 case typelib_TypeClass_UNSIGNED_SHORT:
616 case typelib_TypeClass_UNSIGNED_LONG:
617 case typelib_TypeClass_UNSIGNED_HYPER:
618 o << ' ' << any.get<sal_uInt64>();
619 break;
620 case typelib_TypeClass_FLOAT:
621 case typelib_TypeClass_DOUBLE:
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;
634 case typelib_TypeClass_STRING:
635 o << ' ' << any.get<rtl::OUString>();
636 break;
637 case typelib_TypeClass_TYPE:
638 o << ' ' << any.get<css::uno::Type>().getTypeName();
639 break;
640 case typelib_TypeClass_SEQUENCE:
641 o << " len "
642 << ((*static_cast<uno_Sequence * const *>(any.getValue()))->
643 nElements);
644 break;
645 case typelib_TypeClass_ENUM:
646 o << ' ' << *static_cast<sal_Int32 const *>(any.getValue());
647 break;
648 case typelib_TypeClass_STRUCT:
649 case typelib_TypeClass_EXCEPTION:
650 o << ' ' << any.getValue();
651 break;
652 case typelib_TypeClass_INTERFACE:
653 o << ' ' << *static_cast<void * const *>(any.getValue());
654 break;
655 default:
656 assert(false); // this cannot happen
657 break;
659 o << '>';
660 return o;
668 #endif
670 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */