1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_CPPU_SOURCE_UNO_EQ_HXX
20 #define INCLUDED_CPPU_SOURCE_UNO_EQ_HXX
32 //#### equality ####################################################################################
36 inline bool _equalObject(
37 void * pI1
, void * pI2
,
38 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
42 if ((0 == pI1
) || (0 == pI2
))
46 typelib_TypeDescriptionReference
* type_XInterface
=
47 * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE
);
48 if (0 == queryInterface
)
49 queryInterface
= binuno_queryInterface
;
50 pI1
= (*queryInterface
)( pI1
, type_XInterface
);
53 pI2
= (*queryInterface
)( pI2
, type_XInterface
);
57 _release( pI2
, release
);
59 _release( pI1
, release
);
66 void * pDest
, void *pSource
,
67 typelib_CompoundTypeDescription
* pTypeDescr
,
68 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
);
70 inline bool _equalStruct(
71 void * pDest
, void *pSource
,
72 typelib_CompoundTypeDescription
* pTypeDescr
,
73 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
75 if (pTypeDescr
->pBaseTypeDescription
&&
76 !equalStruct( pDest
, pSource
, pTypeDescr
->pBaseTypeDescription
, queryInterface
, release
))
81 typelib_TypeDescriptionReference
** ppTypeRefs
= pTypeDescr
->ppTypeRefs
;
82 sal_Int32
* pMemberOffsets
= pTypeDescr
->pMemberOffsets
;
83 sal_Int32 nDescr
= pTypeDescr
->nMembers
;
87 sal_Int32 nOffset
= pMemberOffsets
[nDescr
];
88 if (! ::uno_type_equalData( static_cast<char *>(pDest
) + nOffset
,
90 static_cast<char *>(pSource
) + nOffset
,
92 queryInterface
, release
))
101 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
102 typelib_TypeDescriptionReference
* pElementType
,
103 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
);
105 inline bool _equalSequence(
106 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
107 typelib_TypeDescriptionReference
* pElementType
,
108 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
110 if (pDest
== pSource
)
112 sal_Int32 nElements
= pDest
->nElements
;
113 if (nElements
!= pSource
->nElements
)
118 void * pDestElements
= pDest
->elements
;
119 void * pSourceElements
= pSource
->elements
;
121 switch (pElementType
->eTypeClass
)
123 case typelib_TypeClass_CHAR
:
124 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Unicode
) * nElements
));
125 case typelib_TypeClass_BOOLEAN
:
127 for ( sal_Int32 nPos
= nElements
; nPos
--; )
129 if ((static_cast<sal_Bool
*>(pDestElements
)[nPos
] != sal_False
) !=
130 (static_cast<sal_Bool
*>(pSourceElements
)[nPos
] != sal_False
))
137 case typelib_TypeClass_BYTE
:
138 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int8
) * nElements
));
139 case typelib_TypeClass_SHORT
:
140 case typelib_TypeClass_UNSIGNED_SHORT
:
141 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int16
) * nElements
));
142 case typelib_TypeClass_LONG
:
143 case typelib_TypeClass_UNSIGNED_LONG
:
144 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
145 case typelib_TypeClass_HYPER
:
146 case typelib_TypeClass_UNSIGNED_HYPER
:
147 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int64
) * nElements
));
148 case typelib_TypeClass_FLOAT
:
150 for ( sal_Int32 nPos
= nElements
; nPos
--; )
152 if (static_cast<float *>(pDestElements
)[nPos
] != static_cast<float *>(pSourceElements
)[nPos
])
157 case typelib_TypeClass_DOUBLE
:
159 for ( sal_Int32 nPos
= nElements
; nPos
--; )
161 if (static_cast<double *>(pDestElements
)[nPos
] != static_cast<double *>(pSourceElements
)[nPos
])
166 case typelib_TypeClass_STRING
:
168 for ( sal_Int32 nPos
= nElements
; nPos
--; )
170 if (! (static_cast<OUString
*>(pDestElements
) +nPos
)->equals( static_cast<const ::rtl::OUString
*>(pSourceElements
)[nPos
] ))
175 case typelib_TypeClass_TYPE
:
177 for ( sal_Int32 nPos
= nElements
; nPos
--; )
179 if (! _type_equals( static_cast<typelib_TypeDescriptionReference
**>(pDestElements
)[nPos
],
180 static_cast<typelib_TypeDescriptionReference
**>(pSourceElements
)[nPos
] ))
187 case typelib_TypeClass_ANY
:
189 for ( sal_Int32 nPos
= nElements
; nPos
--; )
191 uno_Any
* pDest2
= static_cast<uno_Any
*>(pDestElements
) + nPos
;
192 uno_Any
* pSource2
= static_cast<uno_Any
*>(pSourceElements
) + nPos
;
193 if (! ::uno_type_equalData( pDest2
->pData
, pDest2
->pType
,
194 pSource2
->pData
, pSource2
->pType
,
195 queryInterface
, release
))
202 case typelib_TypeClass_ENUM
:
203 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
204 case typelib_TypeClass_STRUCT
:
205 case typelib_TypeClass_EXCEPTION
:
207 typelib_TypeDescription
* pElementTypeDescr
= 0;
208 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
209 sal_Int32 nElementSize
= pElementTypeDescr
->nSize
;
210 for ( sal_Int32 nPos
= nElements
; nPos
--; )
212 if (! _equalStruct( static_cast<char *>(pDestElements
) + (nPos
* nElementSize
),
213 static_cast<char *>(pSourceElements
) + (nPos
* nElementSize
),
214 reinterpret_cast<typelib_CompoundTypeDescription
*>(pElementTypeDescr
),
215 queryInterface
, release
))
217 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
221 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
224 case typelib_TypeClass_SEQUENCE
: // sequence of sequence
226 typelib_TypeDescription
* pElementTypeDescr
= 0;
227 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
228 typelib_TypeDescriptionReference
* pSeqElementType
=
229 reinterpret_cast<typelib_IndirectTypeDescription
*>(pElementTypeDescr
)->pType
;
230 for ( sal_Int32 nPos
= nElements
; nPos
--; )
232 if (! equalSequence( static_cast<uno_Sequence
**>(pDestElements
)[nPos
],
233 static_cast<uno_Sequence
**>(pSourceElements
)[nPos
],
234 pSeqElementType
, queryInterface
, release
))
236 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
240 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
243 case typelib_TypeClass_INTERFACE
:
245 for ( sal_Int32 nPos
= nElements
; nPos
--; )
247 if (! _equalObject( static_cast<void **>(pDestElements
)[nPos
], static_cast<void **>(pSourceElements
)[nPos
],
248 queryInterface
, release
))
261 inline bool _equalData(
263 typelib_TypeDescriptionReference
* pDestType
, typelib_TypeDescription
* pDestTypeDescr
,
265 typelib_TypeDescriptionReference
* pSourceType
,
266 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
268 typelib_TypeClass eSourceTypeClass
, eDestTypeClass
;
269 while (typelib_TypeClass_ANY
== (eDestTypeClass
= pDestType
->eTypeClass
))
272 pDestType
= static_cast<uno_Any
*>(pDest
)->pType
;
273 pDest
= static_cast<uno_Any
*>(pDest
)->pData
;
275 while (typelib_TypeClass_ANY
== (eSourceTypeClass
= pSourceType
->eTypeClass
))
277 pSourceType
= static_cast<uno_Any
*>(pSource
)->pType
;
278 pSource
= static_cast<uno_Any
*>(pSource
)->pData
;
281 switch (eDestTypeClass
)
283 case typelib_TypeClass_VOID
:
284 return eSourceTypeClass
== typelib_TypeClass_VOID
;
285 case typelib_TypeClass_CHAR
:
286 return eSourceTypeClass
== typelib_TypeClass_CHAR
287 && *static_cast<sal_Unicode
*>(pDest
) == *static_cast<sal_Unicode
*>(pSource
);
288 case typelib_TypeClass_BOOLEAN
:
289 return eSourceTypeClass
== typelib_TypeClass_BOOLEAN
290 && ((*static_cast<sal_Bool
*>(pDest
) != sal_False
)
291 == (*static_cast<sal_Bool
*>(pSource
) != sal_False
));
292 case typelib_TypeClass_BYTE
:
293 switch (eSourceTypeClass
)
295 case typelib_TypeClass_BYTE
:
296 return (*static_cast<sal_Int8
*>(pDest
) == *static_cast<sal_Int8
*>(pSource
));
297 case typelib_TypeClass_SHORT
:
298 return ((sal_Int16
)*static_cast<sal_Int8
*>(pDest
) == *static_cast<sal_Int16
*>(pSource
));
299 case typelib_TypeClass_UNSIGNED_SHORT
:
300 return ((sal_Int32
)*static_cast<sal_Int8
*>(pDest
) == (sal_Int32
)*static_cast<sal_uInt16
*>(pSource
));
301 case typelib_TypeClass_LONG
:
302 return ((sal_Int32
)*static_cast<sal_Int8
*>(pDest
) == *static_cast<sal_Int32
*>(pSource
));
303 case typelib_TypeClass_UNSIGNED_LONG
:
304 return ((sal_Int64
)*static_cast<sal_Int8
*>(pDest
) == (sal_Int64
)*static_cast<sal_uInt32
*>(pSource
));
305 case typelib_TypeClass_HYPER
:
306 return ((sal_Int64
)*static_cast<sal_Int8
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
));
307 case typelib_TypeClass_UNSIGNED_HYPER
:
308 return (*static_cast<sal_Int8
*>(pDest
) >= 0 &&
309 (sal_Int64
)*static_cast<sal_Int8
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
)); // same size
310 case typelib_TypeClass_FLOAT
:
311 return ((float)*static_cast<sal_Int8
*>(pDest
) == *static_cast<float *>(pSource
));
312 case typelib_TypeClass_DOUBLE
:
313 return ((double)*static_cast<sal_Int8
*>(pDest
) == *static_cast<double *>(pSource
));
317 case typelib_TypeClass_SHORT
:
318 switch (eSourceTypeClass
)
320 case typelib_TypeClass_BYTE
:
321 return (*static_cast<sal_Int16
*>(pDest
) == (sal_Int16
)*static_cast<sal_Int8
*>(pSource
));
322 case typelib_TypeClass_SHORT
:
323 return (*static_cast<sal_Int16
*>(pDest
) == *static_cast<sal_Int16
*>(pSource
));
324 case typelib_TypeClass_UNSIGNED_SHORT
:
325 return ((sal_Int32
)*static_cast<sal_Int16
*>(pDest
) == (sal_Int32
)*static_cast<sal_uInt16
*>(pSource
));
326 case typelib_TypeClass_LONG
:
327 return ((sal_Int32
)*static_cast<sal_Int16
*>(pDest
) == *static_cast<sal_Int32
*>(pSource
));
328 case typelib_TypeClass_UNSIGNED_LONG
:
329 return ((sal_Int64
)*static_cast<sal_Int16
*>(pDest
) == (sal_Int64
)*static_cast<sal_uInt32
*>(pSource
));
330 case typelib_TypeClass_HYPER
:
331 return ((sal_Int64
)*static_cast<sal_Int16
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
));
332 case typelib_TypeClass_UNSIGNED_HYPER
:
333 return (*static_cast<sal_Int16
*>(pDest
) >= 0 &&
334 (sal_Int64
)*static_cast<sal_Int16
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
)); // same size
335 case typelib_TypeClass_FLOAT
:
336 return ((float)*static_cast<sal_Int16
*>(pDest
) == *static_cast<float *>(pSource
));
337 case typelib_TypeClass_DOUBLE
:
338 return ((double)*static_cast<sal_Int16
*>(pDest
) == *static_cast<double *>(pSource
));
342 case typelib_TypeClass_UNSIGNED_SHORT
:
343 switch (eSourceTypeClass
)
345 case typelib_TypeClass_BYTE
:
346 return ((sal_Int32
)*static_cast<sal_uInt16
*>(pDest
) == (sal_Int32
)*static_cast<sal_Int8
*>(pSource
));
347 case typelib_TypeClass_SHORT
:
348 return ((sal_Int32
)*static_cast<sal_uInt16
*>(pDest
) == (sal_Int32
)*static_cast<sal_Int16
*>(pSource
));
349 case typelib_TypeClass_UNSIGNED_SHORT
:
350 return (*static_cast<sal_uInt16
*>(pDest
) == *static_cast<sal_uInt16
*>(pSource
));
351 case typelib_TypeClass_LONG
:
352 return ((sal_Int32
)*static_cast<sal_uInt16
*>(pDest
) == *static_cast<sal_Int32
*>(pSource
));
353 case typelib_TypeClass_UNSIGNED_LONG
:
354 return ((sal_uInt32
)*static_cast<sal_uInt16
*>(pDest
) == *static_cast<sal_uInt32
*>(pSource
));
355 case typelib_TypeClass_HYPER
:
356 return ((sal_Int64
)*static_cast<sal_uInt16
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
));
357 case typelib_TypeClass_UNSIGNED_HYPER
:
358 return ((sal_uInt64
)*static_cast<sal_uInt16
*>(pDest
) == *static_cast<sal_uInt64
*>(pSource
));
359 case typelib_TypeClass_FLOAT
:
360 return ((float)*static_cast<sal_uInt16
*>(pDest
) == *static_cast<float *>(pSource
));
361 case typelib_TypeClass_DOUBLE
:
362 return ((double)*static_cast<sal_uInt16
*>(pDest
) == *static_cast<double *>(pSource
));
366 case typelib_TypeClass_LONG
:
367 switch (eSourceTypeClass
)
369 case typelib_TypeClass_BYTE
:
370 return (*static_cast<sal_Int32
*>(pDest
) == (sal_Int32
)*static_cast<sal_Int8
*>(pSource
));
371 case typelib_TypeClass_SHORT
:
372 return (*static_cast<sal_Int32
*>(pDest
) == (sal_Int32
)*static_cast<sal_Int16
*>(pSource
));
373 case typelib_TypeClass_UNSIGNED_SHORT
:
374 return (*static_cast<sal_Int32
*>(pDest
) == (sal_Int32
)*static_cast<sal_uInt16
*>(pSource
));
375 case typelib_TypeClass_LONG
:
376 return (*static_cast<sal_Int32
*>(pDest
) == *static_cast<sal_Int32
*>(pSource
));
377 case typelib_TypeClass_UNSIGNED_LONG
:
378 return ((sal_Int64
)*static_cast<sal_Int32
*>(pDest
) == (sal_Int64
)*static_cast<sal_uInt32
*>(pSource
));
379 case typelib_TypeClass_HYPER
:
380 return ((sal_Int64
)*static_cast<sal_Int32
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
));
381 case typelib_TypeClass_UNSIGNED_HYPER
:
382 return (*static_cast<sal_Int32
*>(pDest
) >= 0 &&
383 (sal_Int64
)*static_cast<sal_Int32
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
)); // same size
384 case typelib_TypeClass_FLOAT
:
385 return ((float)*static_cast<sal_Int32
*>(pDest
) == *static_cast<float *>(pSource
));
386 case typelib_TypeClass_DOUBLE
:
387 return ((double)*static_cast<sal_Int32
*>(pDest
) == *static_cast<double *>(pSource
));
391 case typelib_TypeClass_UNSIGNED_LONG
:
392 switch (eSourceTypeClass
)
394 case typelib_TypeClass_BYTE
:
395 return ((sal_Int64
)*static_cast<sal_uInt32
*>(pDest
) == (sal_Int64
)*static_cast<sal_Int8
*>(pSource
));
396 case typelib_TypeClass_SHORT
:
397 return ((sal_Int64
)*static_cast<sal_uInt32
*>(pDest
) == (sal_Int64
)*static_cast<sal_Int16
*>(pSource
));
398 case typelib_TypeClass_UNSIGNED_SHORT
:
399 return (*static_cast<sal_uInt32
*>(pDest
) == (sal_uInt32
)*static_cast<sal_uInt16
*>(pSource
));
400 case typelib_TypeClass_LONG
:
401 return ((sal_Int64
)*static_cast<sal_uInt32
*>(pDest
) == (sal_Int64
)*static_cast<sal_Int32
*>(pSource
));
402 case typelib_TypeClass_UNSIGNED_LONG
:
403 return (*static_cast<sal_uInt32
*>(pDest
) == *static_cast<sal_uInt32
*>(pSource
));
404 case typelib_TypeClass_HYPER
:
405 return ((sal_Int64
)*static_cast<sal_uInt32
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
));
406 case typelib_TypeClass_UNSIGNED_HYPER
:
407 return ((sal_uInt64
)*static_cast<sal_uInt32
*>(pDest
) == *static_cast<sal_uInt64
*>(pSource
));
408 case typelib_TypeClass_FLOAT
:
409 return ((float)*static_cast<sal_uInt32
*>(pDest
) == *static_cast<float *>(pSource
));
410 case typelib_TypeClass_DOUBLE
:
411 return ((double)*static_cast<sal_uInt32
*>(pDest
) == *static_cast<double *>(pSource
));
415 case typelib_TypeClass_HYPER
:
416 switch (eSourceTypeClass
)
418 case typelib_TypeClass_BYTE
:
419 return (*static_cast<sal_Int64
*>(pDest
) == (sal_Int64
)*static_cast<sal_Int8
*>(pSource
));
420 case typelib_TypeClass_SHORT
:
421 return (*static_cast<sal_Int64
*>(pDest
) == (sal_Int64
)*static_cast<sal_Int16
*>(pSource
));
422 case typelib_TypeClass_UNSIGNED_SHORT
:
423 return (*static_cast<sal_Int64
*>(pDest
) == (sal_Int64
)*static_cast<sal_uInt16
*>(pSource
));
424 case typelib_TypeClass_LONG
:
425 return (*static_cast<sal_Int64
*>(pDest
) == (sal_Int64
)*static_cast<sal_Int32
*>(pSource
));
426 case typelib_TypeClass_UNSIGNED_LONG
:
427 return (*static_cast<sal_Int64
*>(pDest
) == (sal_Int64
)*static_cast<sal_uInt32
*>(pSource
));
428 case typelib_TypeClass_HYPER
:
429 return (*static_cast<sal_Int64
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
));
430 case typelib_TypeClass_UNSIGNED_HYPER
:
431 return (*static_cast<sal_Int64
*>(pDest
) >= 0 &&
432 *static_cast<sal_Int64
*>(pDest
) == *static_cast<sal_Int64
*>(pSource
)); // same size
433 case typelib_TypeClass_FLOAT
:
434 return ((float)*static_cast<sal_Int64
*>(pDest
) == *static_cast<float *>(pSource
));
435 case typelib_TypeClass_DOUBLE
:
436 return ((double)*static_cast<sal_Int64
*>(pDest
) == *static_cast<double *>(pSource
));
440 case typelib_TypeClass_UNSIGNED_HYPER
:
441 switch (eSourceTypeClass
)
443 case typelib_TypeClass_BYTE
:
444 return (*static_cast<sal_Int8
*>(pSource
) >= 0 &&
445 *static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<sal_Int8
*>(pSource
));
446 case typelib_TypeClass_SHORT
:
447 return (*static_cast<sal_Int16
*>(pSource
) >= 0 &&
448 *static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<sal_Int16
*>(pSource
));
449 case typelib_TypeClass_UNSIGNED_SHORT
:
450 return (*static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<sal_uInt16
*>(pSource
));
451 case typelib_TypeClass_LONG
:
452 return (*static_cast<sal_Int32
*>(pSource
) >= 0 &&
453 *static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<sal_Int32
*>(pSource
));
454 case typelib_TypeClass_UNSIGNED_LONG
:
455 return (*static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<sal_uInt32
*>(pSource
));
456 case typelib_TypeClass_HYPER
:
457 return (*static_cast<sal_Int64
*>(pSource
) >= 0 &&
458 *static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<sal_Int64
*>(pSource
));
459 case typelib_TypeClass_UNSIGNED_HYPER
:
460 return (*static_cast<sal_uInt64
*>(pDest
) == *static_cast<sal_uInt64
*>(pSource
));
461 case typelib_TypeClass_FLOAT
:
462 if (::floor( *static_cast<float *>(pSource
) ) != *static_cast<float *>(pSource
) || *static_cast<float *>(pSource
) < 0)
464 return (*static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<float *>(pSource
));
465 case typelib_TypeClass_DOUBLE
:
466 if (::floor( *static_cast<double *>(pSource
) ) != *static_cast<double *>(pSource
) || *static_cast<double *>(pSource
) < 0)
468 return (*static_cast<sal_uInt64
*>(pDest
) == (sal_uInt64
)*static_cast<double *>(pSource
));
472 case typelib_TypeClass_FLOAT
:
473 switch (eSourceTypeClass
)
475 case typelib_TypeClass_BYTE
:
476 return (*static_cast<float *>(pDest
) == (float)*static_cast<sal_Int8
*>(pSource
));
477 case typelib_TypeClass_SHORT
:
478 return (*static_cast<float *>(pDest
) == (float)*static_cast<sal_Int16
*>(pSource
));
479 case typelib_TypeClass_UNSIGNED_SHORT
:
480 return (*static_cast<float *>(pDest
) == (float)*static_cast<sal_uInt16
*>(pSource
));
481 case typelib_TypeClass_LONG
:
482 return (*static_cast<float *>(pDest
) == (float)*static_cast<sal_Int32
*>(pSource
));
483 case typelib_TypeClass_UNSIGNED_LONG
:
484 return (*static_cast<float *>(pDest
) == (float)*static_cast<sal_uInt32
*>(pSource
));
485 case typelib_TypeClass_HYPER
:
486 return (*static_cast<float *>(pDest
) == (float)*static_cast<sal_Int64
*>(pSource
));
487 case typelib_TypeClass_UNSIGNED_HYPER
:
488 if (::floor( *static_cast<float *>(pDest
) ) != *static_cast<float *>(pDest
) || *static_cast<float *>(pDest
) < 0)
490 return ((sal_uInt64
)*static_cast<float *>(pDest
) == *static_cast<sal_uInt64
*>(pSource
));
491 case typelib_TypeClass_FLOAT
:
492 return (*static_cast<float *>(pDest
) == *static_cast<float *>(pSource
));
493 case typelib_TypeClass_DOUBLE
:
494 return ((double)*static_cast<float *>(pDest
) == *static_cast<double *>(pSource
));
498 case typelib_TypeClass_DOUBLE
:
499 switch (eSourceTypeClass
)
501 case typelib_TypeClass_BYTE
:
502 return (*static_cast<double *>(pDest
) == (double)*static_cast<sal_Int8
*>(pSource
));
503 case typelib_TypeClass_SHORT
:
504 return (*static_cast<double *>(pDest
) == (double)*static_cast<sal_Int16
*>(pSource
));
505 case typelib_TypeClass_UNSIGNED_SHORT
:
506 return (*static_cast<double *>(pDest
) == (double)*static_cast<sal_uInt16
*>(pSource
));
507 case typelib_TypeClass_LONG
:
508 return (*static_cast<double *>(pDest
) == (double)*static_cast<sal_Int32
*>(pSource
));
509 case typelib_TypeClass_UNSIGNED_LONG
:
510 return (*static_cast<double *>(pDest
) == (double)*static_cast<sal_uInt32
*>(pSource
));
511 case typelib_TypeClass_HYPER
:
512 return (*static_cast<double *>(pDest
) == (double)*static_cast<sal_Int64
*>(pSource
));
513 case typelib_TypeClass_UNSIGNED_HYPER
:
514 if (::floor( *static_cast<double *>(pDest
) ) != *static_cast<double *>(pDest
) || *static_cast<double *>(pDest
) < 0)
516 return ((sal_uInt64
)*static_cast<double *>(pDest
) == *static_cast<sal_uInt64
*>(pSource
));
517 case typelib_TypeClass_FLOAT
:
518 return (*static_cast<double *>(pDest
) == (double)*static_cast<float *>(pSource
));
519 case typelib_TypeClass_DOUBLE
:
520 return (*static_cast<double *>(pDest
) == *static_cast<double *>(pSource
));
524 case typelib_TypeClass_STRING
:
525 return eSourceTypeClass
== typelib_TypeClass_STRING
526 && (static_cast<OUString
*>(pDest
))->equals(
527 *static_cast<OUString
const *>(pSource
) );
528 case typelib_TypeClass_TYPE
:
529 return eSourceTypeClass
== typelib_TypeClass_TYPE
531 *static_cast<typelib_TypeDescriptionReference
**>(pDest
),
532 *static_cast<typelib_TypeDescriptionReference
**>(pSource
) );
533 case typelib_TypeClass_ENUM
:
534 return (_type_equals( pDestType
, pSourceType
) &&
535 *static_cast<sal_Int32
*>(pDest
) == *static_cast<sal_Int32
*>(pSource
));
536 case typelib_TypeClass_STRUCT
:
537 case typelib_TypeClass_EXCEPTION
:
538 if (! _type_equals( pDestType
, pSourceType
))
544 reinterpret_cast<typelib_CompoundTypeDescription
*>(pDestTypeDescr
),
545 queryInterface
, release
);
549 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
550 bool bRet
= _equalStruct(
552 reinterpret_cast<typelib_CompoundTypeDescription
*>(pDestTypeDescr
),
553 queryInterface
, release
);
554 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
557 case typelib_TypeClass_SEQUENCE
:
558 if (_type_equals( pDestType
, pSourceType
))
562 return _equalSequence(
563 *static_cast<uno_Sequence
**>(pDest
), *static_cast<uno_Sequence
**>(pSource
),
564 reinterpret_cast<typelib_IndirectTypeDescription
*>(pDestTypeDescr
)->pType
,
565 queryInterface
, release
);
569 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
570 bool bRet
= _equalSequence(
571 *static_cast<uno_Sequence
**>(pDest
), *static_cast<uno_Sequence
**>(pSource
),
572 reinterpret_cast<typelib_IndirectTypeDescription
*>(pDestTypeDescr
)->pType
,
573 queryInterface
, release
);
574 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
579 case typelib_TypeClass_INTERFACE
:
580 if (typelib_TypeClass_INTERFACE
== eSourceTypeClass
)
581 return _equalObject( *static_cast<void **>(pDest
), *static_cast<void **>(pSource
), queryInterface
, release
);
594 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */