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