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 .
24 #include <o3tl/intcmp.hxx>
25 #include <osl/diagnose.h>
26 #include <rtl/ustring.hxx>
35 //#### equality ####################################################################################
38 inline bool _equalObject(
39 void * pI1
, void * pI2
,
40 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
44 if ((nullptr == pI1
) || (nullptr == pI2
))
48 typelib_TypeDescriptionReference
* type_XInterface
=
49 * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE
);
50 if (nullptr == queryInterface
)
51 queryInterface
= binuno_queryInterface
;
52 pI1
= (*queryInterface
)( pI1
, type_XInterface
);
55 pI2
= (*queryInterface
)( pI2
, type_XInterface
);
59 _release( pI2
, release
);
61 _release( pI1
, release
);
68 void * pDest
, void *pSource
,
69 typelib_CompoundTypeDescription
* pTypeDescr
,
70 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
);
72 inline bool _equalStruct(
73 void * pDest
, void *pSource
,
74 typelib_CompoundTypeDescription
* pTypeDescr
,
75 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
77 if (pTypeDescr
->pBaseTypeDescription
&&
78 !equalStruct( pDest
, pSource
, pTypeDescr
->pBaseTypeDescription
, queryInterface
, release
))
83 typelib_TypeDescriptionReference
** ppTypeRefs
= pTypeDescr
->ppTypeRefs
;
84 sal_Int32
* pMemberOffsets
= pTypeDescr
->pMemberOffsets
;
85 sal_Int32 nDescr
= pTypeDescr
->nMembers
;
89 sal_Int32 nOffset
= pMemberOffsets
[nDescr
];
90 if (! ::uno_type_equalData( static_cast<char *>(pDest
) + nOffset
,
92 static_cast<char *>(pSource
) + nOffset
,
94 queryInterface
, release
))
103 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
104 typelib_TypeDescriptionReference
* pElementType
,
105 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
);
107 inline bool _equalSequence(
108 uno_Sequence
* pDest
, uno_Sequence
* pSource
,
109 typelib_TypeDescriptionReference
* pElementType
,
110 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
112 if (pDest
== pSource
)
114 sal_Int32 nElements
= pDest
->nElements
;
115 if (nElements
!= pSource
->nElements
)
120 void * pDestElements
= pDest
->elements
;
121 void * pSourceElements
= pSource
->elements
;
123 switch (pElementType
->eTypeClass
)
125 case typelib_TypeClass_CHAR
:
126 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Unicode
) * nElements
));
127 case typelib_TypeClass_BOOLEAN
:
129 for ( sal_Int32 nPos
= nElements
; nPos
--; )
131 if (bool(static_cast<sal_Bool
*>(pDestElements
)[nPos
]) !=
132 bool(static_cast<sal_Bool
*>(pSourceElements
)[nPos
]))
139 case typelib_TypeClass_BYTE
:
140 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int8
) * nElements
));
141 case typelib_TypeClass_SHORT
:
142 case typelib_TypeClass_UNSIGNED_SHORT
:
143 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int16
) * nElements
));
144 case typelib_TypeClass_LONG
:
145 case typelib_TypeClass_UNSIGNED_LONG
:
146 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
147 case typelib_TypeClass_HYPER
:
148 case typelib_TypeClass_UNSIGNED_HYPER
:
149 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int64
) * nElements
));
150 case typelib_TypeClass_FLOAT
:
152 for ( sal_Int32 nPos
= nElements
; nPos
--; )
154 if (static_cast<float *>(pDestElements
)[nPos
] != static_cast<float *>(pSourceElements
)[nPos
])
159 case typelib_TypeClass_DOUBLE
:
161 for ( sal_Int32 nPos
= nElements
; nPos
--; )
163 if (static_cast<double *>(pDestElements
)[nPos
] != static_cast<double *>(pSourceElements
)[nPos
])
168 case typelib_TypeClass_STRING
:
170 for ( sal_Int32 nPos
= nElements
; nPos
--; )
172 if ( static_cast<OUString
*>(pDestElements
)[nPos
] != static_cast<const OUString
*>(pSourceElements
)[nPos
] )
177 case typelib_TypeClass_TYPE
:
179 for ( sal_Int32 nPos
= nElements
; nPos
--; )
181 if (! _type_equals( static_cast<typelib_TypeDescriptionReference
**>(pDestElements
)[nPos
],
182 static_cast<typelib_TypeDescriptionReference
**>(pSourceElements
)[nPos
] ))
189 case typelib_TypeClass_ANY
:
191 for ( sal_Int32 nPos
= nElements
; nPos
--; )
193 uno_Any
* pDest2
= static_cast<uno_Any
*>(pDestElements
) + nPos
;
194 uno_Any
* pSource2
= static_cast<uno_Any
*>(pSourceElements
) + nPos
;
195 if (! ::uno_type_equalData( pDest2
->pData
, pDest2
->pType
,
196 pSource2
->pData
, pSource2
->pType
,
197 queryInterface
, release
))
204 case typelib_TypeClass_ENUM
:
205 return (0 == memcmp( pDestElements
, pSourceElements
, sizeof(sal_Int32
) * nElements
));
206 case typelib_TypeClass_STRUCT
:
207 case typelib_TypeClass_EXCEPTION
:
209 typelib_TypeDescription
* pElementTypeDescr
= nullptr;
210 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
211 sal_Int32 nElementSize
= pElementTypeDescr
->nSize
;
212 for ( sal_Int32 nPos
= nElements
; nPos
--; )
214 if (! _equalStruct( static_cast<char *>(pDestElements
) + (nPos
* nElementSize
),
215 static_cast<char *>(pSourceElements
) + (nPos
* nElementSize
),
216 reinterpret_cast<typelib_CompoundTypeDescription
*>(pElementTypeDescr
),
217 queryInterface
, release
))
219 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
223 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
226 case typelib_TypeClass_SEQUENCE
: // sequence of sequence
228 typelib_TypeDescription
* pElementTypeDescr
= nullptr;
229 TYPELIB_DANGER_GET( &pElementTypeDescr
, pElementType
);
230 typelib_TypeDescriptionReference
* pSeqElementType
=
231 reinterpret_cast<typelib_IndirectTypeDescription
*>(pElementTypeDescr
)->pType
;
232 for ( sal_Int32 nPos
= nElements
; nPos
--; )
234 if (! equalSequence( static_cast<uno_Sequence
**>(pDestElements
)[nPos
],
235 static_cast<uno_Sequence
**>(pSourceElements
)[nPos
],
236 pSeqElementType
, queryInterface
, release
))
238 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
242 TYPELIB_DANGER_RELEASE( pElementTypeDescr
);
245 case typelib_TypeClass_INTERFACE
:
247 for ( sal_Int32 nPos
= nElements
; nPos
--; )
249 if (! _equalObject( static_cast<void **>(pDestElements
)[nPos
], static_cast<void **>(pSourceElements
)[nPos
],
250 queryInterface
, release
))
263 inline bool _equalData(
265 typelib_TypeDescriptionReference
* pDestType
, typelib_TypeDescription
* pDestTypeDescr
,
267 typelib_TypeDescriptionReference
* pSourceType
,
268 uno_QueryInterfaceFunc queryInterface
, uno_ReleaseFunc release
)
270 typelib_TypeClass eSourceTypeClass
, eDestTypeClass
;
271 while (typelib_TypeClass_ANY
== (eDestTypeClass
= pDestType
->eTypeClass
))
273 pDestTypeDescr
= nullptr;
274 pDestType
= static_cast<uno_Any
*>(pDest
)->pType
;
275 pDest
= static_cast<uno_Any
*>(pDest
)->pData
;
277 while (typelib_TypeClass_ANY
== (eSourceTypeClass
= pSourceType
->eTypeClass
))
279 pSourceType
= static_cast<uno_Any
*>(pSource
)->pType
;
280 pSource
= static_cast<uno_Any
*>(pSource
)->pData
;
283 switch (eDestTypeClass
)
285 case typelib_TypeClass_VOID
:
286 return eSourceTypeClass
== typelib_TypeClass_VOID
;
287 case typelib_TypeClass_CHAR
:
288 return eSourceTypeClass
== typelib_TypeClass_CHAR
289 && *static_cast<sal_Unicode
*>(pDest
) == *static_cast<sal_Unicode
*>(pSource
);
290 case typelib_TypeClass_BOOLEAN
:
291 return eSourceTypeClass
== typelib_TypeClass_BOOLEAN
292 && (bool(*static_cast<sal_Bool
*>(pDest
))
293 == bool(*static_cast<sal_Bool
*>(pSource
)));
294 case typelib_TypeClass_BYTE
:
295 switch (eSourceTypeClass
)
297 case typelib_TypeClass_BYTE
:
298 return o3tl::cmp_equal(
299 *static_cast<sal_Int8
*>(pDest
), *static_cast<sal_Int8
*>(pSource
));
300 case typelib_TypeClass_SHORT
:
301 return o3tl::cmp_equal(
302 *static_cast<sal_Int8
*>(pDest
), *static_cast<sal_Int16
*>(pSource
));
303 case typelib_TypeClass_UNSIGNED_SHORT
:
304 return o3tl::cmp_equal(
305 *static_cast<sal_Int8
*>(pDest
), *static_cast<sal_uInt16
*>(pSource
));
306 case typelib_TypeClass_LONG
:
307 return o3tl::cmp_equal(
308 *static_cast<sal_Int8
*>(pDest
), *static_cast<sal_Int32
*>(pSource
));
309 case typelib_TypeClass_UNSIGNED_LONG
:
310 return o3tl::cmp_equal(
311 *static_cast<sal_Int8
*>(pDest
), *static_cast<sal_uInt32
*>(pSource
));
312 case typelib_TypeClass_HYPER
:
313 return o3tl::cmp_equal(
314 *static_cast<sal_Int8
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
315 case typelib_TypeClass_UNSIGNED_HYPER
:
316 return o3tl::cmp_equal(
317 *static_cast<sal_Int8
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
318 case typelib_TypeClass_FLOAT
:
319 return (static_cast<float>(*static_cast<sal_Int8
*>(pDest
)) == *static_cast<float *>(pSource
));
320 case typelib_TypeClass_DOUBLE
:
321 return (static_cast<double>(*static_cast<sal_Int8
*>(pDest
)) == *static_cast<double *>(pSource
));
325 case typelib_TypeClass_SHORT
:
326 switch (eSourceTypeClass
)
328 case typelib_TypeClass_BYTE
:
329 return o3tl::cmp_equal(
330 *static_cast<sal_Int16
*>(pDest
), *static_cast<sal_Int8
*>(pSource
));
331 case typelib_TypeClass_SHORT
:
332 return o3tl::cmp_equal(
333 *static_cast<sal_Int16
*>(pDest
), *static_cast<sal_Int16
*>(pSource
));
334 case typelib_TypeClass_UNSIGNED_SHORT
:
335 return o3tl::cmp_equal(
336 *static_cast<sal_Int16
*>(pDest
), *static_cast<sal_uInt16
*>(pSource
));
337 case typelib_TypeClass_LONG
:
338 return o3tl::cmp_equal(
339 *static_cast<sal_Int16
*>(pDest
), *static_cast<sal_Int32
*>(pSource
));
340 case typelib_TypeClass_UNSIGNED_LONG
:
341 return o3tl::cmp_equal(
342 *static_cast<sal_Int16
*>(pDest
), *static_cast<sal_uInt32
*>(pSource
));
343 case typelib_TypeClass_HYPER
:
344 return o3tl::cmp_equal(
345 *static_cast<sal_Int16
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
346 case typelib_TypeClass_UNSIGNED_HYPER
:
347 return o3tl::cmp_equal(
348 *static_cast<sal_Int16
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
349 case typelib_TypeClass_FLOAT
:
350 return (static_cast<float>(*static_cast<sal_Int16
*>(pDest
)) == *static_cast<float *>(pSource
));
351 case typelib_TypeClass_DOUBLE
:
352 return (static_cast<double>(*static_cast<sal_Int16
*>(pDest
)) == *static_cast<double *>(pSource
));
356 case typelib_TypeClass_UNSIGNED_SHORT
:
357 switch (eSourceTypeClass
)
359 case typelib_TypeClass_BYTE
:
360 return o3tl::cmp_equal(
361 *static_cast<sal_uInt16
*>(pDest
), *static_cast<sal_Int8
*>(pSource
));
362 case typelib_TypeClass_SHORT
:
363 return o3tl::cmp_equal(
364 *static_cast<sal_uInt16
*>(pDest
), *static_cast<sal_Int16
*>(pSource
));
365 case typelib_TypeClass_UNSIGNED_SHORT
:
366 return o3tl::cmp_equal(
367 *static_cast<sal_uInt16
*>(pDest
), *static_cast<sal_uInt16
*>(pSource
));
368 case typelib_TypeClass_LONG
:
369 return o3tl::cmp_equal(
370 *static_cast<sal_uInt16
*>(pDest
), *static_cast<sal_Int32
*>(pSource
));
371 case typelib_TypeClass_UNSIGNED_LONG
:
372 return o3tl::cmp_equal(
373 *static_cast<sal_uInt16
*>(pDest
), *static_cast<sal_uInt32
*>(pSource
));
374 case typelib_TypeClass_HYPER
:
375 return o3tl::cmp_equal(
376 *static_cast<sal_uInt16
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
377 case typelib_TypeClass_UNSIGNED_HYPER
:
378 return o3tl::cmp_equal(
379 *static_cast<sal_uInt16
*>(pDest
), *static_cast<sal_uInt64
*>(pSource
));
380 case typelib_TypeClass_FLOAT
:
381 return (static_cast<float>(*static_cast<sal_uInt16
*>(pDest
)) == *static_cast<float *>(pSource
));
382 case typelib_TypeClass_DOUBLE
:
383 return (static_cast<double>(*static_cast<sal_uInt16
*>(pDest
)) == *static_cast<double *>(pSource
));
387 case typelib_TypeClass_LONG
:
388 switch (eSourceTypeClass
)
390 case typelib_TypeClass_BYTE
:
391 return o3tl::cmp_equal(
392 *static_cast<sal_Int32
*>(pDest
), *static_cast<sal_Int8
*>(pSource
));
393 case typelib_TypeClass_SHORT
:
394 return o3tl::cmp_equal(
395 *static_cast<sal_Int32
*>(pDest
), *static_cast<sal_Int16
*>(pSource
));
396 case typelib_TypeClass_UNSIGNED_SHORT
:
397 return o3tl::cmp_equal(
398 *static_cast<sal_Int32
*>(pDest
), *static_cast<sal_uInt16
*>(pSource
));
399 case typelib_TypeClass_LONG
:
400 return o3tl::cmp_equal(
401 *static_cast<sal_Int32
*>(pDest
), *static_cast<sal_Int32
*>(pSource
));
402 case typelib_TypeClass_UNSIGNED_LONG
:
403 return o3tl::cmp_equal(
404 *static_cast<sal_Int32
*>(pDest
), *static_cast<sal_uInt32
*>(pSource
));
405 case typelib_TypeClass_HYPER
:
406 return o3tl::cmp_equal(
407 *static_cast<sal_Int32
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
408 case typelib_TypeClass_UNSIGNED_HYPER
:
409 return o3tl::cmp_equal(
410 *static_cast<sal_Int32
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
411 case typelib_TypeClass_FLOAT
:
412 return (static_cast<float>(*static_cast<sal_Int32
*>(pDest
)) == *static_cast<float *>(pSource
));
413 case typelib_TypeClass_DOUBLE
:
414 return (static_cast<double>(*static_cast<sal_Int32
*>(pDest
)) == *static_cast<double *>(pSource
));
418 case typelib_TypeClass_UNSIGNED_LONG
:
419 switch (eSourceTypeClass
)
421 case typelib_TypeClass_BYTE
:
422 return o3tl::cmp_equal(
423 *static_cast<sal_uInt32
*>(pDest
), *static_cast<sal_Int8
*>(pSource
));
424 case typelib_TypeClass_SHORT
:
425 return o3tl::cmp_equal(
426 *static_cast<sal_uInt32
*>(pDest
), *static_cast<sal_Int16
*>(pSource
));
427 case typelib_TypeClass_UNSIGNED_SHORT
:
428 return o3tl::cmp_equal(
429 *static_cast<sal_uInt32
*>(pDest
), *static_cast<sal_uInt16
*>(pSource
));
430 case typelib_TypeClass_LONG
:
431 return o3tl::cmp_equal(
432 *static_cast<sal_uInt32
*>(pDest
), *static_cast<sal_Int32
*>(pSource
));
433 case typelib_TypeClass_UNSIGNED_LONG
:
434 return o3tl::cmp_equal(
435 *static_cast<sal_uInt32
*>(pDest
), *static_cast<sal_uInt32
*>(pSource
));
436 case typelib_TypeClass_HYPER
:
437 return o3tl::cmp_equal(
438 *static_cast<sal_uInt32
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
439 case typelib_TypeClass_UNSIGNED_HYPER
:
440 return o3tl::cmp_equal(
441 *static_cast<sal_uInt32
*>(pDest
), *static_cast<sal_uInt64
*>(pSource
));
442 case typelib_TypeClass_FLOAT
:
443 return (static_cast<float>(*static_cast<sal_uInt32
*>(pDest
)) == *static_cast<float *>(pSource
));
444 case typelib_TypeClass_DOUBLE
:
445 return (static_cast<double>(*static_cast<sal_uInt32
*>(pDest
)) == *static_cast<double *>(pSource
));
449 case typelib_TypeClass_HYPER
:
450 switch (eSourceTypeClass
)
452 case typelib_TypeClass_BYTE
:
453 return o3tl::cmp_equal(
454 *static_cast<sal_Int64
*>(pDest
), *static_cast<sal_Int8
*>(pSource
));
455 case typelib_TypeClass_SHORT
:
456 return o3tl::cmp_equal(
457 *static_cast<sal_Int64
*>(pDest
), *static_cast<sal_Int16
*>(pSource
));
458 case typelib_TypeClass_UNSIGNED_SHORT
:
459 return o3tl::cmp_equal(
460 *static_cast<sal_Int64
*>(pDest
), *static_cast<sal_uInt16
*>(pSource
));
461 case typelib_TypeClass_LONG
:
462 return o3tl::cmp_equal(
463 *static_cast<sal_Int64
*>(pDest
), *static_cast<sal_Int32
*>(pSource
));
464 case typelib_TypeClass_UNSIGNED_LONG
:
465 return o3tl::cmp_equal(
466 *static_cast<sal_Int64
*>(pDest
), *static_cast<sal_uInt32
*>(pSource
));
467 case typelib_TypeClass_HYPER
:
468 return o3tl::cmp_equal(
469 *static_cast<sal_Int64
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
470 case typelib_TypeClass_UNSIGNED_HYPER
:
471 return o3tl::cmp_equal(
472 *static_cast<sal_Int64
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
473 case typelib_TypeClass_FLOAT
:
474 return (static_cast<float>(*static_cast<sal_Int64
*>(pDest
)) == *static_cast<float *>(pSource
));
475 case typelib_TypeClass_DOUBLE
:
476 return (static_cast<double>(*static_cast<sal_Int64
*>(pDest
)) == *static_cast<double *>(pSource
));
480 case typelib_TypeClass_UNSIGNED_HYPER
:
481 switch (eSourceTypeClass
)
483 case typelib_TypeClass_BYTE
:
484 return o3tl::cmp_equal(
485 *static_cast<sal_uInt64
*>(pDest
), *static_cast<sal_Int8
*>(pSource
));
486 case typelib_TypeClass_SHORT
:
487 return o3tl::cmp_equal(
488 *static_cast<sal_uInt64
*>(pDest
), *static_cast<sal_Int16
*>(pSource
));
489 case typelib_TypeClass_UNSIGNED_SHORT
:
490 return o3tl::cmp_equal(
491 *static_cast<sal_uInt64
*>(pDest
), *static_cast<sal_uInt16
*>(pSource
));
492 case typelib_TypeClass_LONG
:
493 return o3tl::cmp_equal(
494 *static_cast<sal_uInt64
*>(pDest
), *static_cast<sal_Int32
*>(pSource
));
495 case typelib_TypeClass_UNSIGNED_LONG
:
496 return o3tl::cmp_equal(
497 *static_cast<sal_uInt64
*>(pDest
), *static_cast<sal_uInt32
*>(pSource
));
498 case typelib_TypeClass_HYPER
:
499 return o3tl::cmp_equal(
500 *static_cast<sal_uInt64
*>(pDest
), *static_cast<sal_Int64
*>(pSource
));
501 case typelib_TypeClass_UNSIGNED_HYPER
:
502 return o3tl::cmp_equal(
503 *static_cast<sal_uInt64
*>(pDest
), *static_cast<sal_uInt64
*>(pSource
));
504 case typelib_TypeClass_FLOAT
:
505 if (::floor( *static_cast<float *>(pSource
) ) != *static_cast<float *>(pSource
) || *static_cast<float *>(pSource
) < 0)
507 return (*static_cast<sal_uInt64
*>(pDest
) == static_cast<sal_uInt64
>(*static_cast<float *>(pSource
)));
508 case typelib_TypeClass_DOUBLE
:
509 if (::floor( *static_cast<double *>(pSource
) ) != *static_cast<double *>(pSource
) || *static_cast<double *>(pSource
) < 0)
511 return (*static_cast<sal_uInt64
*>(pDest
) == static_cast<sal_uInt64
>(*static_cast<double *>(pSource
)));
515 case typelib_TypeClass_FLOAT
:
516 switch (eSourceTypeClass
)
518 case typelib_TypeClass_BYTE
:
519 return (*static_cast<float *>(pDest
) == static_cast<float>(*static_cast<sal_Int8
*>(pSource
)));
520 case typelib_TypeClass_SHORT
:
521 return (*static_cast<float *>(pDest
) == static_cast<float>(*static_cast<sal_Int16
*>(pSource
)));
522 case typelib_TypeClass_UNSIGNED_SHORT
:
523 return (*static_cast<float *>(pDest
) == static_cast<float>(*static_cast<sal_uInt16
*>(pSource
)));
524 case typelib_TypeClass_LONG
:
525 return (*static_cast<float *>(pDest
) == static_cast<float>(*static_cast<sal_Int32
*>(pSource
)));
526 case typelib_TypeClass_UNSIGNED_LONG
:
527 return (*static_cast<float *>(pDest
) == static_cast<float>(*static_cast<sal_uInt32
*>(pSource
)));
528 case typelib_TypeClass_HYPER
:
529 return (*static_cast<float *>(pDest
) == static_cast<float>(*static_cast<sal_Int64
*>(pSource
)));
530 case typelib_TypeClass_UNSIGNED_HYPER
:
531 if (::floor( *static_cast<float *>(pDest
) ) != *static_cast<float *>(pDest
) || *static_cast<float *>(pDest
) < 0)
533 return (static_cast<sal_uInt64
>(*static_cast<float *>(pDest
)) == *static_cast<sal_uInt64
*>(pSource
));
534 case typelib_TypeClass_FLOAT
:
535 return (*static_cast<float *>(pDest
) == *static_cast<float *>(pSource
));
536 case typelib_TypeClass_DOUBLE
:
537 return (static_cast<double>(*static_cast<float *>(pDest
)) == *static_cast<double *>(pSource
));
541 case typelib_TypeClass_DOUBLE
:
542 switch (eSourceTypeClass
)
544 case typelib_TypeClass_BYTE
:
545 return (*static_cast<double *>(pDest
) == static_cast<double>(*static_cast<sal_Int8
*>(pSource
)));
546 case typelib_TypeClass_SHORT
:
547 return (*static_cast<double *>(pDest
) == static_cast<double>(*static_cast<sal_Int16
*>(pSource
)));
548 case typelib_TypeClass_UNSIGNED_SHORT
:
549 return (*static_cast<double *>(pDest
) == static_cast<double>(*static_cast<sal_uInt16
*>(pSource
)));
550 case typelib_TypeClass_LONG
:
551 return (*static_cast<double *>(pDest
) == static_cast<double>(*static_cast<sal_Int32
*>(pSource
)));
552 case typelib_TypeClass_UNSIGNED_LONG
:
553 return (*static_cast<double *>(pDest
) == static_cast<double>(*static_cast<sal_uInt32
*>(pSource
)));
554 case typelib_TypeClass_HYPER
:
555 return (*static_cast<double *>(pDest
) == static_cast<double>(*static_cast<sal_Int64
*>(pSource
)));
556 case typelib_TypeClass_UNSIGNED_HYPER
:
557 if (::floor( *static_cast<double *>(pDest
) ) != *static_cast<double *>(pDest
) || *static_cast<double *>(pDest
) < 0)
559 return (static_cast<sal_uInt64
>(*static_cast<double *>(pDest
)) == *static_cast<sal_uInt64
*>(pSource
));
560 case typelib_TypeClass_FLOAT
:
561 return (*static_cast<double *>(pDest
) == static_cast<double>(*static_cast<float *>(pSource
)));
562 case typelib_TypeClass_DOUBLE
:
563 return (*static_cast<double *>(pDest
) == *static_cast<double *>(pSource
));
567 case typelib_TypeClass_STRING
:
568 return eSourceTypeClass
== typelib_TypeClass_STRING
569 && *static_cast<OUString
*>(pDest
) ==
570 *static_cast<OUString
const *>(pSource
);
571 case typelib_TypeClass_TYPE
:
572 return eSourceTypeClass
== typelib_TypeClass_TYPE
574 *static_cast<typelib_TypeDescriptionReference
**>(pDest
),
575 *static_cast<typelib_TypeDescriptionReference
**>(pSource
) );
576 case typelib_TypeClass_ENUM
:
577 return (_type_equals( pDestType
, pSourceType
) &&
578 *static_cast<sal_Int32
*>(pDest
) == *static_cast<sal_Int32
*>(pSource
));
579 case typelib_TypeClass_STRUCT
:
580 case typelib_TypeClass_EXCEPTION
:
581 if (! _type_equals( pDestType
, pSourceType
))
587 reinterpret_cast<typelib_CompoundTypeDescription
*>(pDestTypeDescr
),
588 queryInterface
, release
);
592 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
593 bool bRet
= _equalStruct(
595 reinterpret_cast<typelib_CompoundTypeDescription
*>(pDestTypeDescr
),
596 queryInterface
, release
);
597 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
600 case typelib_TypeClass_SEQUENCE
:
601 if (_type_equals( pDestType
, pSourceType
))
605 return _equalSequence(
606 *static_cast<uno_Sequence
**>(pDest
), *static_cast<uno_Sequence
**>(pSource
),
607 reinterpret_cast<typelib_IndirectTypeDescription
*>(pDestTypeDescr
)->pType
,
608 queryInterface
, release
);
612 TYPELIB_DANGER_GET( &pDestTypeDescr
, pDestType
);
613 bool bRet
= _equalSequence(
614 *static_cast<uno_Sequence
**>(pDest
), *static_cast<uno_Sequence
**>(pSource
),
615 reinterpret_cast<typelib_IndirectTypeDescription
*>(pDestTypeDescr
)->pType
,
616 queryInterface
, release
);
617 TYPELIB_DANGER_RELEASE( pDestTypeDescr
);
622 case typelib_TypeClass_INTERFACE
:
623 if (typelib_TypeClass_INTERFACE
== eSourceTypeClass
)
624 return _equalObject( *static_cast<void **>(pDest
), *static_cast<void **>(pSource
), queryInterface
, release
);
635 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */