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 _XMLOFF_PROPERTYSETINFOHASH_HXX
20 #define _XMLOFF_PROPERTYSETINFOHASH_HXX
22 #include <xmloff/PropertySetInfoKey.hxx>
27 struct PropertySetInfoHash
29 inline size_t operator()( const PropertySetInfoKey
& r
) const;
30 inline bool operator()( const PropertySetInfoKey
& r1
,
31 const PropertySetInfoKey
& r2
) const;
34 inline size_t PropertySetInfoHash::operator()(
35 const PropertySetInfoKey
& r
) const
37 const sal_Int32
* pBytesAsInt32Array
=
38 (const sal_Int32
*)r
.aImplementationId
.getConstArray();
39 sal_Int32 nId32
= pBytesAsInt32Array
[0] ^
40 pBytesAsInt32Array
[1] ^
41 pBytesAsInt32Array
[2] ^
42 pBytesAsInt32Array
[3];
43 return (size_t)nId32
^ (size_t)r
.xPropInfo
.get();
46 inline bool PropertySetInfoHash::operator()(
47 const PropertySetInfoKey
& r1
,
48 const PropertySetInfoKey
& r2
) const
50 if( r1
.xPropInfo
!= r2
.xPropInfo
)
53 const sal_Int8
* pId1
= r1
.aImplementationId
.getConstArray();
54 const sal_Int8
* pId2
= r2
.aImplementationId
.getConstArray();
55 return memcmp( pId1
, pId2
, 16 * sizeof( sal_Int8
) ) == 0;
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */