2
* Copyright 2006-2008 The FLWOR Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef ZORBA_HASHMAP_ZSTRING_NONSERIALIZABLE
18
#define ZORBA_HASHMAP_ZSTRING_NONSERIALIZABLE
20
#undef ZORBA_UTILS_HASHMAP_WITH_SERIALIZATION
21
#include "zorbautils/hashmap.h"
23
#include "zorbatypes/zstring.h"
25
#include "util/utf8_util.h"
31
/***************************************************************************//**
32
Class to privide the equality and hash functions for the HashMapZString
34
*******************************************************************************/
35
class HashMapZStringCmp
38
static uint32_t hash(const zstring& str)
40
return utf8::hash(str);
43
static bool equal(const zstring& s1, const zstring& s2)
50
/*******************************************************************************
51
A nonserializable hash-based map container mapping zstrings to values of
52
type V. Equality is based on the zstring == operator.
53
*******************************************************************************/
55
class HashMapZString : public HashMap<zstring, V, HashMapZStringCmp>
60
HashMap<zstring, V, HashMapZStringCmp>()
65
HashMapZString(ulong size, bool sync)
67
HashMap<zstring, V, HashMapZStringCmp>(size, sync)
71
virtual ~HashMapZString() { }