2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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.
18 * @file FBaseStringHashCodeProvider.h
19 * @brief This is the header file for the %StringHashCodeProvider class.
21 * This header file contains the declarations of the %StringHashCodeProvider class.
23 #ifndef _FBASE_STRING_HASH_CODE_PROVIDER_H_
24 #define _FBASE_STRING_HASH_CODE_PROVIDER_H_
26 #include <FBaseObject.h>
27 #include <FBaseColIHashCodeProvider.h>
28 #include <FBaseColIHashCodeProviderT.h>
30 namespace Tizen { namespace Base
33 * @class StringHashCodeProvider
34 * @brief This class provides the hash code of an instance of type %String.
38 * The %StringHashCodeProvider class provides the hash code of an instance of type String.
40 * The following example demonstrates how to use the %StringHashCodeProvider class.
46 * using namespace Tizen::Base;
47 * using namespace Tizen::Base::Collection;
50 * MyClass::StringHashCodeProviderSample(void)
52 * HashMapT<String, int> map;
54 * ComparerT<String> comparer;
55 * StringHashCodeProvider strHashCodeProvider;
57 * map.Construct(0, 0, strHashCodeProvider, comparer);
59 * map.Add(String(L"Zero"), 0);
60 * map.Add(String(L"One"), 1);
61 * map.Add(String(L"Two"), 2);
67 class _OSP_EXPORT_ StringHashCodeProvider
68 : public virtual Tizen::Base::Collection::IHashCodeProvider
69 , public virtual Tizen::Base::Collection::IHashCodeProviderT <Tizen::Base::String>
70 , public Tizen::Base::Object
73 using Object::GetHashCode;
76 * This is the default constructor for this class.
80 StringHashCodeProvider(void);
83 * This destructor overrides Tizen::Base::Object::~Object().
87 virtual ~StringHashCodeProvider(void);
90 * Gets the hash code of an instance of type String.
94 * @return The hash code of an instance of type String
95 * @param[in] str The String instance whose hash code is requested
96 * @remarks The hash algorithm is usually specific to a type.
97 * Two equal instances must return the same hash value.
98 * For better performance, the used hash function must generate a random distribution for all inputs.
100 virtual int GetHashCode(const Tizen::Base::String& str) const;
103 * Gets the hash code of the specified object.
107 * @return The hash code of the specified object
108 * @param[in] obj The Object whose hash code is requested
109 * @remarks The hash algorithm is usually specific to a type.
110 * Two equal instances must return the same hash value.
111 * For better performance, the used hash function must generate a random distribution for all inputs.
113 virtual int GetHashCode(const Tizen::Base::Object& obj) const;
117 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
119 StringHashCodeProvider(const StringHashCodeProvider& rhs);
122 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
124 StringHashCodeProvider& operator =(const StringHashCodeProvider& rhs);
126 }; // StringHashCodeProvider
130 #endif // _FBASE_STRING_HASH_CODE_PROVIDER_H_