|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
19 * contributor license agreements. See the NOTICE file distributed with |
|
20 * this work for additional information regarding copyright ownership. |
|
21 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
22 * (the "License"); you may not use this file except in compliance with |
|
23 * the License. You may obtain a copy of the License at |
|
24 * |
|
25 * http://www.apache.org/licenses/LICENSE-2.0 |
|
26 * |
|
27 * Unless required by applicable law or agreed to in writing, software |
|
28 * distributed under the License is distributed on an "AS IS" BASIS, |
|
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
30 * See the License for the specific language governing permissions and |
|
31 * limitations under the License. |
|
32 */ |
|
33 |
|
34 /* |
|
35 * $Id: HashCMStateSet.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|
36 */ |
|
37 |
|
38 #if !defined(HASH_CMSTATESET_HPP) |
|
39 #define HASH_CMSTATESET_HPP |
|
40 |
|
41 #include <xercesc/util/HashBase.hpp> |
|
42 #include <xercesc/validators/common/CMStateSet.hpp> |
|
43 |
|
44 XERCES_CPP_NAMESPACE_BEGIN |
|
45 |
|
46 /** |
|
47 * The <code>HashCMStateSet</code> class inherits from <code>HashBase</code>. |
|
48 * This is a CMStateSet specific hasher class designed to hash the values |
|
49 * of CMStateSet. |
|
50 * |
|
51 * See <code>HashBase</code> for more information. |
|
52 */ |
|
53 |
|
54 class XMLUTIL_EXPORT HashCMStateSet : public HashBase |
|
55 { |
|
56 public: |
|
57 HashCMStateSet(); |
|
58 virtual ~HashCMStateSet(); |
|
59 virtual unsigned int getHashVal(const void *const key, unsigned int mod |
|
60 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
|
61 virtual bool equals(const void *const key1, const void *const key2); |
|
62 private: |
|
63 // ----------------------------------------------------------------------- |
|
64 // Unimplemented constructors and operators |
|
65 // ----------------------------------------------------------------------- |
|
66 HashCMStateSet(const HashCMStateSet&); |
|
67 HashCMStateSet& operator=(const HashCMStateSet&); |
|
68 }; |
|
69 |
|
70 inline HashCMStateSet::HashCMStateSet() |
|
71 { |
|
72 } |
|
73 |
|
74 inline HashCMStateSet::~HashCMStateSet() |
|
75 { |
|
76 } |
|
77 |
|
78 inline unsigned int HashCMStateSet::getHashVal(const void *const key, unsigned int mod |
|
79 , MemoryManager* const) |
|
80 { |
|
81 const CMStateSet* const pkey = (const CMStateSet* const) key; |
|
82 return ((pkey->hashCode()) % mod); |
|
83 } |
|
84 |
|
85 inline bool HashCMStateSet::equals(const void *const key1, const void *const key2) |
|
86 { |
|
87 const CMStateSet* const pkey1 = (const CMStateSet* const) key1; |
|
88 const CMStateSet* const pkey2 = (const CMStateSet* const) key2; |
|
89 |
|
90 return (*pkey1==*pkey2); |
|
91 } |
|
92 |
|
93 XERCES_CPP_NAMESPACE_END |
|
94 |
|
95 #endif |