xref: /aoo4110/main/cppu/inc/com/sun/star/uno/Any.h (revision b1cdbd2c)
1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_UNO_ANY_H_
24*b1cdbd2cSJim Jagielski #define _COM_SUN_STAR_UNO_ANY_H_
25*b1cdbd2cSJim Jagielski 
26*b1cdbd2cSJim Jagielski #include <uno/any2.h>
27*b1cdbd2cSJim Jagielski #include <typelib/typedescription.h>
28*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/Type.h>
29*b1cdbd2cSJim Jagielski #include "cppu/unotype.hxx"
30*b1cdbd2cSJim Jagielski #include <rtl/alloc.h>
31*b1cdbd2cSJim Jagielski 
32*b1cdbd2cSJim Jagielski 
33*b1cdbd2cSJim Jagielski namespace com
34*b1cdbd2cSJim Jagielski {
35*b1cdbd2cSJim Jagielski namespace sun
36*b1cdbd2cSJim Jagielski {
37*b1cdbd2cSJim Jagielski namespace star
38*b1cdbd2cSJim Jagielski {
39*b1cdbd2cSJim Jagielski namespace uno
40*b1cdbd2cSJim Jagielski {
41*b1cdbd2cSJim Jagielski 
42*b1cdbd2cSJim Jagielski /** C++ class representing an IDL any.
43*b1cdbd2cSJim Jagielski 	This class is used to transport any type defined in IDL. The class inherits from the
44*b1cdbd2cSJim Jagielski     binary C representation of uno_Any.
45*b1cdbd2cSJim Jagielski 	You can insert a value by either using the <<= operators or the template function makeAny().
46*b1cdbd2cSJim Jagielski     No any can hold an any. You can extract values from an any by using the >>= operators which
47*b1cdbd2cSJim Jagielski     return true if the any contains an assignable value (no data loss), e.g. the any contains a
48*b1cdbd2cSJim Jagielski     short and you >>= it into a long variable.
49*b1cdbd2cSJim Jagielski */
50*b1cdbd2cSJim Jagielski class Any : public uno_Any
51*b1cdbd2cSJim Jagielski {
52*b1cdbd2cSJim Jagielski public:
53*b1cdbd2cSJim Jagielski 	// these are here to force memory de/allocation to sal lib.
54*b1cdbd2cSJim Jagielski     /** @internal */
operator new(size_t nSize)55*b1cdbd2cSJim Jagielski 	inline static void * SAL_CALL operator new ( size_t nSize ) SAL_THROW( () )
56*b1cdbd2cSJim Jagielski 		{ return ::rtl_allocateMemory( nSize ); }
57*b1cdbd2cSJim Jagielski     /** @internal */
operator delete(void * pMem)58*b1cdbd2cSJim Jagielski 	inline static void SAL_CALL operator delete ( void * pMem ) SAL_THROW( () )
59*b1cdbd2cSJim Jagielski 		{ ::rtl_freeMemory( pMem ); }
60*b1cdbd2cSJim Jagielski     /** @internal */
operator new(size_t,void * pMem)61*b1cdbd2cSJim Jagielski 	inline static void * SAL_CALL operator new ( size_t, void * pMem ) SAL_THROW( () )
62*b1cdbd2cSJim Jagielski 		{ return pMem; }
63*b1cdbd2cSJim Jagielski     /** @internal */
operator delete(void *,void *)64*b1cdbd2cSJim Jagielski 	inline static void SAL_CALL operator delete ( void *, void * ) SAL_THROW( () )
65*b1cdbd2cSJim Jagielski 		{}
66*b1cdbd2cSJim Jagielski 
67*b1cdbd2cSJim Jagielski 	/** Default constructor: Any holds no value; its type is void.
68*b1cdbd2cSJim Jagielski 	*/
69*b1cdbd2cSJim Jagielski 	inline Any() SAL_THROW( () );
70*b1cdbd2cSJim Jagielski 
71*b1cdbd2cSJim Jagielski     /** Templated ctor.  Sets a copy of the given value.
72*b1cdbd2cSJim Jagielski 
73*b1cdbd2cSJim Jagielski         @param value value of the Any
74*b1cdbd2cSJim Jagielski     */
75*b1cdbd2cSJim Jagielski     template <typename T>
76*b1cdbd2cSJim Jagielski     explicit inline Any( T const & value );
77*b1cdbd2cSJim Jagielski     /// Ctor support for C++ bool.
78*b1cdbd2cSJim Jagielski     explicit inline Any( bool value );
79*b1cdbd2cSJim Jagielski 
80*b1cdbd2cSJim Jagielski 	/** Copy constructor: Sets value of the given any.
81*b1cdbd2cSJim Jagielski 
82*b1cdbd2cSJim Jagielski 		@param rAny another any
83*b1cdbd2cSJim Jagielski 	*/
84*b1cdbd2cSJim Jagielski 	inline Any( const Any & rAny ) SAL_THROW( () );
85*b1cdbd2cSJim Jagielski 
86*b1cdbd2cSJim Jagielski 	/** Constructor: Sets a copy of the given data.
87*b1cdbd2cSJim Jagielski 
88*b1cdbd2cSJim Jagielski 		@param pData_ value
89*b1cdbd2cSJim Jagielski 		@param rType type of value
90*b1cdbd2cSJim Jagielski 	*/
91*b1cdbd2cSJim Jagielski 	inline Any( const void * pData_, const Type & rType ) SAL_THROW( () );
92*b1cdbd2cSJim Jagielski 
93*b1cdbd2cSJim Jagielski 	/** Constructor: Sets a copy of the given data.
94*b1cdbd2cSJim Jagielski 
95*b1cdbd2cSJim Jagielski 		@param pData_ value
96*b1cdbd2cSJim Jagielski 		@param pTypeDescr type of value
97*b1cdbd2cSJim Jagielski 	*/
98*b1cdbd2cSJim Jagielski 	inline Any( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW( () );
99*b1cdbd2cSJim Jagielski 
100*b1cdbd2cSJim Jagielski 	/** Constructor: Sets a copy of the given data.
101*b1cdbd2cSJim Jagielski 
102*b1cdbd2cSJim Jagielski 		@param pData_ value
103*b1cdbd2cSJim Jagielski 		@param pType type of value
104*b1cdbd2cSJim Jagielski 	*/
105*b1cdbd2cSJim Jagielski 	inline Any( const void * pData_, typelib_TypeDescriptionReference * pType ) SAL_THROW( () );
106*b1cdbd2cSJim Jagielski 
107*b1cdbd2cSJim Jagielski 	/** Destructor: Destructs any content and frees memory.
108*b1cdbd2cSJim Jagielski 	*/
109*b1cdbd2cSJim Jagielski 	inline ~Any() SAL_THROW( () );
110*b1cdbd2cSJim Jagielski 
111*b1cdbd2cSJim Jagielski 	/** Assignment operator: Sets the value of the given any.
112*b1cdbd2cSJim Jagielski 
113*b1cdbd2cSJim Jagielski 		@param rAny another any (right side)
114*b1cdbd2cSJim Jagielski 		@return this any
115*b1cdbd2cSJim Jagielski 	*/
116*b1cdbd2cSJim Jagielski 	inline Any & SAL_CALL operator = ( const Any & rAny ) SAL_THROW( () );
117*b1cdbd2cSJim Jagielski 
118*b1cdbd2cSJim Jagielski 	/** Gets the type of the set value.
119*b1cdbd2cSJim Jagielski 
120*b1cdbd2cSJim Jagielski 		@return a Type object of the set value
121*b1cdbd2cSJim Jagielski 	 */
getValueType() const122*b1cdbd2cSJim Jagielski 	inline const Type & SAL_CALL getValueType() const SAL_THROW( () )
123*b1cdbd2cSJim Jagielski 		{ return * reinterpret_cast< const Type * >( &pType ); }
124*b1cdbd2cSJim Jagielski 	/** Gets the type of the set value.
125*b1cdbd2cSJim Jagielski 
126*b1cdbd2cSJim Jagielski 		@return the UNacquired type description reference of the set value
127*b1cdbd2cSJim Jagielski 	 */
getValueTypeRef() const128*b1cdbd2cSJim Jagielski 	inline typelib_TypeDescriptionReference * SAL_CALL getValueTypeRef() const SAL_THROW( () )
129*b1cdbd2cSJim Jagielski 		{ return pType; }
130*b1cdbd2cSJim Jagielski 
131*b1cdbd2cSJim Jagielski 	/** Gets the type description of the set value. Provides ownership of the type description!
132*b1cdbd2cSJim Jagielski 		Call an explicit typelib_typedescription_release() to release afterwards.
133*b1cdbd2cSJim Jagielski 
134*b1cdbd2cSJim Jagielski 		@param a pointer to type description pointer
135*b1cdbd2cSJim Jagielski 	*/
getValueTypeDescription(typelib_TypeDescription ** ppTypeDescr) const136*b1cdbd2cSJim Jagielski 	inline void SAL_CALL getValueTypeDescription( typelib_TypeDescription ** ppTypeDescr ) const SAL_THROW( () )
137*b1cdbd2cSJim Jagielski 		{ ::typelib_typedescriptionreference_getDescription( ppTypeDescr, pType ); }
138*b1cdbd2cSJim Jagielski 
139*b1cdbd2cSJim Jagielski 	/** Gets the type class of the set value.
140*b1cdbd2cSJim Jagielski 
141*b1cdbd2cSJim Jagielski 		@return the type class of the set value
142*b1cdbd2cSJim Jagielski 	 */
getValueTypeClass() const143*b1cdbd2cSJim Jagielski 	inline TypeClass SAL_CALL getValueTypeClass() const SAL_THROW( () )
144*b1cdbd2cSJim Jagielski 		{ return (TypeClass)pType->eTypeClass; }
145*b1cdbd2cSJim Jagielski 
146*b1cdbd2cSJim Jagielski 	/** Gets the type name of the set value.
147*b1cdbd2cSJim Jagielski 
148*b1cdbd2cSJim Jagielski 		@return the type name of the set value
149*b1cdbd2cSJim Jagielski 	*/
150*b1cdbd2cSJim Jagielski 	inline ::rtl::OUString SAL_CALL getValueTypeName() const SAL_THROW( () );
151*b1cdbd2cSJim Jagielski 
152*b1cdbd2cSJim Jagielski 	/** Tests if any contains a value.
153*b1cdbd2cSJim Jagielski 
154*b1cdbd2cSJim Jagielski 		@return true if any has a value, false otherwise
155*b1cdbd2cSJim Jagielski 	*/
hasValue() const156*b1cdbd2cSJim Jagielski 	inline sal_Bool SAL_CALL hasValue() const SAL_THROW( () )
157*b1cdbd2cSJim Jagielski 		{ return (typelib_TypeClass_VOID != pType->eTypeClass); }
158*b1cdbd2cSJim Jagielski 
159*b1cdbd2cSJim Jagielski 	/** Gets a pointer to the set value.
160*b1cdbd2cSJim Jagielski 
161*b1cdbd2cSJim Jagielski 		@return a pointer to the set value
162*b1cdbd2cSJim Jagielski 	*/
getValue() const163*b1cdbd2cSJim Jagielski 	inline const void * SAL_CALL getValue() const SAL_THROW( () )
164*b1cdbd2cSJim Jagielski 		{ return pData; }
165*b1cdbd2cSJim Jagielski 
166*b1cdbd2cSJim Jagielski #if ! defined(EXCEPTIONS_OFF)
167*b1cdbd2cSJim Jagielski     /** Provides a value of specified type, so you can easily write e.g.
168*b1cdbd2cSJim Jagielski         <pre>
169*b1cdbd2cSJim Jagielski         sal_Int32 myVal = myAny.get<sal_Int32>();
170*b1cdbd2cSJim Jagielski         </pre>
171*b1cdbd2cSJim Jagielski         Widening conversion without data loss is taken into account.
172*b1cdbd2cSJim Jagielski         Throws a
173*b1cdbd2cSJim Jagielski         <type scope="com::sun::star::uno">RuntimeException</type>
174*b1cdbd2cSJim Jagielski         if the specified type cannot be provided.
175*b1cdbd2cSJim Jagielski 
176*b1cdbd2cSJim Jagielski         @return value of specified type
177*b1cdbd2cSJim Jagielski         @exception <type scope="com::sun::star::uno">RuntimeException</type>
178*b1cdbd2cSJim Jagielski                    in case the specified type cannot be provided
179*b1cdbd2cSJim Jagielski     */
180*b1cdbd2cSJim Jagielski     template <typename T>
181*b1cdbd2cSJim Jagielski     inline T get() const;
182*b1cdbd2cSJim Jagielski #endif // ! defined(EXCEPTIONS_OFF)
183*b1cdbd2cSJim Jagielski 
184*b1cdbd2cSJim Jagielski 	/** Sets a value. If the any already contains a value, that value will be destructed
185*b1cdbd2cSJim Jagielski         and its memory freed.
186*b1cdbd2cSJim Jagielski 
187*b1cdbd2cSJim Jagielski 		@param pData_ pointer to value
188*b1cdbd2cSJim Jagielski 		@param rType type of value
189*b1cdbd2cSJim Jagielski 	*/
190*b1cdbd2cSJim Jagielski 	inline void SAL_CALL setValue( const void * pData_, const Type & rType ) SAL_THROW( () );
191*b1cdbd2cSJim Jagielski 	/** Sets a value. If the any already contains a value, that value will be destructed
192*b1cdbd2cSJim Jagielski 		and its memory freed.
193*b1cdbd2cSJim Jagielski 
194*b1cdbd2cSJim Jagielski 		@param pData_ pointer to value
195*b1cdbd2cSJim Jagielski 		@param pType type of value
196*b1cdbd2cSJim Jagielski 	*/
197*b1cdbd2cSJim Jagielski 	inline void SAL_CALL setValue( const void * pData_, typelib_TypeDescriptionReference * pType ) SAL_THROW( () );
198*b1cdbd2cSJim Jagielski 	/** Sets a value. If the any already contains a value, that value will be destructed
199*b1cdbd2cSJim Jagielski 		and its memory freed.
200*b1cdbd2cSJim Jagielski 
201*b1cdbd2cSJim Jagielski 		@param pData_ pointer to value
202*b1cdbd2cSJim Jagielski 		@param pTypeDescr type description of value
203*b1cdbd2cSJim Jagielski 	*/
204*b1cdbd2cSJim Jagielski 	inline void SAL_CALL setValue( const void * pData_, typelib_TypeDescription * pTypeDescr ) SAL_THROW( () );
205*b1cdbd2cSJim Jagielski 
206*b1cdbd2cSJim Jagielski 	/** Clears this any. If the any already contains a value, that value will be destructed
207*b1cdbd2cSJim Jagielski 		and its memory freed. After this has been called, the any does not contain a value.
208*b1cdbd2cSJim Jagielski 	*/
209*b1cdbd2cSJim Jagielski 	inline void SAL_CALL clear() SAL_THROW( () );
210*b1cdbd2cSJim Jagielski 
211*b1cdbd2cSJim Jagielski 	/** Tests whether this any is extractable to a value of given type.
212*b1cdbd2cSJim Jagielski         Widening conversion without data loss is taken into account.
213*b1cdbd2cSJim Jagielski 
214*b1cdbd2cSJim Jagielski 		@param rType destination type
215*b1cdbd2cSJim Jagielski 		@return true if this any is extractable to value of given type (e.g. using >>= operator)
216*b1cdbd2cSJim Jagielski 	*/
217*b1cdbd2cSJim Jagielski 	inline sal_Bool SAL_CALL isExtractableTo( const Type & rType ) const SAL_THROW( () );
218*b1cdbd2cSJim Jagielski 
219*b1cdbd2cSJim Jagielski 	/** Tests whether this any can provide a value of specified type.
220*b1cdbd2cSJim Jagielski         Widening conversion without data loss is taken into account.
221*b1cdbd2cSJim Jagielski 
222*b1cdbd2cSJim Jagielski 		@return true if this any can provide a value of specified type
223*b1cdbd2cSJim Jagielski 		(e.g. using >>= operator)
224*b1cdbd2cSJim Jagielski 	*/
225*b1cdbd2cSJim Jagielski     template <typename T>
226*b1cdbd2cSJim Jagielski 	inline bool has() const;
227*b1cdbd2cSJim Jagielski 
228*b1cdbd2cSJim Jagielski 	/** Equality operator: compares two anys.
229*b1cdbd2cSJim Jagielski 		The values need not be of equal type, e.g. a short integer is compared to a long integer.
230*b1cdbd2cSJim Jagielski 
231*b1cdbd2cSJim Jagielski 		@param rAny another any (right side)
232*b1cdbd2cSJim Jagielski 		@return true if both any contains equal values
233*b1cdbd2cSJim Jagielski 	*/
234*b1cdbd2cSJim Jagielski 	inline sal_Bool SAL_CALL operator == ( const Any & rAny ) const SAL_THROW( () );
235*b1cdbd2cSJim Jagielski 	/** Unequality operator: compares two anys.
236*b1cdbd2cSJim Jagielski 		The values need not be of equal type, e.g. a short integer is compared to a long integer.
237*b1cdbd2cSJim Jagielski 
238*b1cdbd2cSJim Jagielski 		@param rAny another any (right side)
239*b1cdbd2cSJim Jagielski 		@return true if both any contains unequal values
240*b1cdbd2cSJim Jagielski 	*/
241*b1cdbd2cSJim Jagielski 	inline sal_Bool SAL_CALL operator != ( const Any & rAny ) const SAL_THROW( () );
242*b1cdbd2cSJim Jagielski 
243*b1cdbd2cSJim Jagielski private:
244*b1cdbd2cSJim Jagielski     // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
245*b1cdbd2cSJim Jagielski     explicit Any( sal_uInt16 );
246*b1cdbd2cSJim Jagielski #if defined(_MSC_VER)
247*b1cdbd2cSJim Jagielski     // Omitting the following private declarations leads to an internal compiler
248*b1cdbd2cSJim Jagielski     // error on MSVC (version 1310).
249*b1cdbd2cSJim Jagielski     // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16)
250*b1cdbd2cSJim Jagielski #if ! defined(EXCEPTIONS_OFF)
251*b1cdbd2cSJim Jagielski     template <>
252*b1cdbd2cSJim Jagielski     sal_uInt16 get<sal_uInt16>() const;
253*b1cdbd2cSJim Jagielski #endif // ! defined(EXCEPTIONS_OFF)
254*b1cdbd2cSJim Jagielski     template <>
255*b1cdbd2cSJim Jagielski 	bool has<sal_uInt16>() const;
256*b1cdbd2cSJim Jagielski #endif // defined(_MSC_VER)
257*b1cdbd2cSJim Jagielski };
258*b1cdbd2cSJim Jagielski 
259*b1cdbd2cSJim Jagielski /** Template function to generically construct an any from a C++ value.
260*b1cdbd2cSJim Jagielski 
261*b1cdbd2cSJim Jagielski     @tplparam C value type
262*b1cdbd2cSJim Jagielski 	@param value a value
263*b1cdbd2cSJim Jagielski 	@return an any
264*b1cdbd2cSJim Jagielski */
265*b1cdbd2cSJim Jagielski template< class C >
266*b1cdbd2cSJim Jagielski inline Any SAL_CALL makeAny( const C & value ) SAL_THROW( () );
267*b1cdbd2cSJim Jagielski 
268*b1cdbd2cSJim Jagielski // additionally specialized for C++ bool
269*b1cdbd2cSJim Jagielski template<>
270*b1cdbd2cSJim Jagielski inline Any SAL_CALL makeAny( bool const & value ) SAL_THROW( () );
271*b1cdbd2cSJim Jagielski 
272*b1cdbd2cSJim Jagielski class BaseReference;
273*b1cdbd2cSJim Jagielski class Type;
274*b1cdbd2cSJim Jagielski 
275*b1cdbd2cSJim Jagielski /** Template binary <<= operator to set the value of an any.
276*b1cdbd2cSJim Jagielski 
277*b1cdbd2cSJim Jagielski     @tplparam C value type
278*b1cdbd2cSJim Jagielski 	@param rAny destination any (left side)
279*b1cdbd2cSJim Jagielski 	@param value source value (right side)
280*b1cdbd2cSJim Jagielski */
281*b1cdbd2cSJim Jagielski template< class C >
282*b1cdbd2cSJim Jagielski inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) SAL_THROW( () );
283*b1cdbd2cSJim Jagielski 
284*b1cdbd2cSJim Jagielski // additionally for C++ bool:
285*b1cdbd2cSJim Jagielski inline void SAL_CALL operator <<= ( Any & rAny, bool const & value )
286*b1cdbd2cSJim Jagielski     SAL_THROW( () );
287*b1cdbd2cSJim Jagielski 
288*b1cdbd2cSJim Jagielski /** Template binary >>= operator to assign a value from an any.
289*b1cdbd2cSJim Jagielski 	If the any does not contain a value that can be assigned without data loss, then this
290*b1cdbd2cSJim Jagielski     operation will fail returning false.
291*b1cdbd2cSJim Jagielski 
292*b1cdbd2cSJim Jagielski     @tplparam C value type
293*b1cdbd2cSJim Jagielski 	@param rAny source any (left side)
294*b1cdbd2cSJim Jagielski 	@param value destination value (right side)
295*b1cdbd2cSJim Jagielski 	@return true if assignment was possible without data loss
296*b1cdbd2cSJim Jagielski */
297*b1cdbd2cSJim Jagielski template< class C >
298*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, C & value ) SAL_THROW( () );
299*b1cdbd2cSJim Jagielski 
300*b1cdbd2cSJim Jagielski /** Template equality operator: compares set value of left side any to right side value.
301*b1cdbd2cSJim Jagielski 	The values need not be of equal type, e.g. a short integer is compared to a long integer.
302*b1cdbd2cSJim Jagielski 	This operator can be implemented as template member function, if all supported compilers
303*b1cdbd2cSJim Jagielski     can cope with template member functions.
304*b1cdbd2cSJim Jagielski 
305*b1cdbd2cSJim Jagielski     @tplparam C value type
306*b1cdbd2cSJim Jagielski 	@param rAny another any (left side)
307*b1cdbd2cSJim Jagielski 	@param value a value (right side)
308*b1cdbd2cSJim Jagielski 	@return true if values are equal, false otherwise
309*b1cdbd2cSJim Jagielski */
310*b1cdbd2cSJim Jagielski template< class C >
311*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator == ( const Any & rAny, const C & value ) SAL_THROW( () );
312*b1cdbd2cSJim Jagielski /** Template unequality operator: compares set value of left side any to right side value.
313*b1cdbd2cSJim Jagielski 	The values need not be of equal type, e.g. a short integer is compared to a long integer.
314*b1cdbd2cSJim Jagielski 	This operator can be implemented as template member function, if all supported compilers
315*b1cdbd2cSJim Jagielski     can cope with template member functions.
316*b1cdbd2cSJim Jagielski 
317*b1cdbd2cSJim Jagielski     @tplparam C value type
318*b1cdbd2cSJim Jagielski 	@param rAny another any (left side)
319*b1cdbd2cSJim Jagielski 	@param value a value (right side)
320*b1cdbd2cSJim Jagielski 	@return true if values are unequal, false otherwise
321*b1cdbd2cSJim Jagielski */
322*b1cdbd2cSJim Jagielski template< class C >
323*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_THROW( () );
324*b1cdbd2cSJim Jagielski 
325*b1cdbd2cSJim Jagielski // additional specialized >>= and == operators
326*b1cdbd2cSJim Jagielski // bool
327*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Bool & value ) SAL_THROW( () );
328*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator == ( const Any & rAny, const sal_Bool & value ) SAL_THROW( () );
329*b1cdbd2cSJim Jagielski template<>
330*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( Any const & rAny, bool & value )
331*b1cdbd2cSJim Jagielski     SAL_THROW( () );
332*b1cdbd2cSJim Jagielski template<>
333*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator == ( Any const & rAny, bool const & value )
334*b1cdbd2cSJim Jagielski     SAL_THROW( () );
335*b1cdbd2cSJim Jagielski // byte
336*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int8 & value ) SAL_THROW( () );
337*b1cdbd2cSJim Jagielski // short
338*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int16 & value ) SAL_THROW( () );
339*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt16 & value ) SAL_THROW( () );
340*b1cdbd2cSJim Jagielski // long
341*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int32 & value ) SAL_THROW( () );
342*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt32 & value ) SAL_THROW( () );
343*b1cdbd2cSJim Jagielski // hyper
344*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_Int64 & value ) SAL_THROW( () );
345*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, sal_uInt64 & value ) SAL_THROW( () );
346*b1cdbd2cSJim Jagielski // float
347*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, float & value ) SAL_THROW( () );
348*b1cdbd2cSJim Jagielski // double
349*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, double & value ) SAL_THROW( () );
350*b1cdbd2cSJim Jagielski // string
351*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, ::rtl::OUString & value ) SAL_THROW( () );
352*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator == ( const Any & rAny, const ::rtl::OUString & value ) SAL_THROW( () );
353*b1cdbd2cSJim Jagielski // type
354*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Type & value ) SAL_THROW( () );
355*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator == ( const Any & rAny, const Type & value ) SAL_THROW( () );
356*b1cdbd2cSJim Jagielski // any
357*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator >>= ( const Any & rAny, Any & value ) SAL_THROW( () );
358*b1cdbd2cSJim Jagielski // interface
359*b1cdbd2cSJim Jagielski inline sal_Bool SAL_CALL operator == ( const Any & rAny, const BaseReference & value ) SAL_THROW( () );
360*b1cdbd2cSJim Jagielski 
361*b1cdbd2cSJim Jagielski }
362*b1cdbd2cSJim Jagielski }
363*b1cdbd2cSJim Jagielski }
364*b1cdbd2cSJim Jagielski }
365*b1cdbd2cSJim Jagielski 
366*b1cdbd2cSJim Jagielski /** Gets the meta type of IDL type any.
367*b1cdbd2cSJim Jagielski 
368*b1cdbd2cSJim Jagielski     There are cases (involving templates) where uses of getCppuType are known to
369*b1cdbd2cSJim Jagielski     not compile.  Use cppu::UnoType or cppu::getTypeFavourUnsigned instead.
370*b1cdbd2cSJim Jagielski 
371*b1cdbd2cSJim Jagielski 	@param dummy typed pointer for function signature
372*b1cdbd2cSJim Jagielski 	@return type of IDL type any
373*b1cdbd2cSJim Jagielski */
getCppuType(const::com::sun::star::uno::Any *)374*b1cdbd2cSJim Jagielski inline const ::com::sun::star::uno::Type & SAL_CALL getCppuType( const ::com::sun::star::uno::Any * ) SAL_THROW( () )
375*b1cdbd2cSJim Jagielski {
376*b1cdbd2cSJim Jagielski     return ::cppu::UnoType< ::com::sun::star::uno::Any >::get();
377*b1cdbd2cSJim Jagielski }
378*b1cdbd2cSJim Jagielski 
379*b1cdbd2cSJim Jagielski #endif
380