2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FBaseStringHashCodeProvider.h
20 * @brief This is the header file for the %StringHashCodeProvider class.
22 * This file contains declarations of the %StringHashCodeProvider class.
24 #ifndef _FBASE_STRING_HASH_CODE_PROVIDER_H_
25 #define _FBASE_STRING_HASH_CODE_PROVIDER_H_
27 #include <FBaseObject.h>
28 #include <FBaseColIHashCodeProvider.h>
29 #include <FBaseColIHashCodeProviderT.h>
31 namespace Tizen { namespace Base
34 * @class StringHashCodeProvider
35 * @brief This is the header file for the %StringHashCodeProvider class.
39 * The %StringHashCodeProvider class provides the hash code of instance of the String type.
41 * The following example demonstrates how to use the %StringHashCodeProvider class.
47 * using namespace Tizen::Base;
48 * using namespace Tizen::Base::Collection;
51 * MyClass::StringHashCodeProviderSample(void)
53 * HashMapT<String, int> map;
55 * ComparerT<String> comparer;
56 * StringHashCodeProvider strHashCodeProvider;
58 * map.Construct(0, 0, strHashCodeProvider, comparer);
60 * map.Add(String(L"Zero"), 0);
61 * map.Add(String(L"One"), 1);
62 * map.Add(String(L"Two"), 2);
68 class _OSP_EXPORT_ StringHashCodeProvider
69 : public virtual Tizen::Base::Collection::IHashCodeProvider
70 , public virtual Tizen::Base::Collection::IHashCodeProviderT <Tizen::Base::String>
71 , public Tizen::Base::Object
74 using Object::GetHashCode;
77 * This is the default constructor for this class.
81 StringHashCodeProvider(void);
84 * This destructor overrides Tizen::Base::Object::~Object()
88 virtual ~StringHashCodeProvider(void);
91 * Gets the hash code of instance of the String type.
95 * @return The hash code of instance of the String type
96 * @param[in] str The String instance whose hash code is requested
97 * @remarks The hash algorithm is usually specific to a type.
98 * Two equal instances must return the same hash value.
99 * For better performance, the used hash function must generate a random distribution for all inputs.
101 virtual int GetHashCode(const Tizen::Base::String& str) const;
104 * Gets the hash code of the specified object.
108 * @return The hash code of the specified object
109 * @param[in] obj The Object whose hash code is requested
110 * @remarks The hash algorithm is usually specific to a type.
111 * Two equal instances must return the same hash value.
112 * For better performance, the used hash function must generate a random distribution for all inputs.
114 virtual int GetHashCode(const Tizen::Base::Object& obj) const;
118 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
120 StringHashCodeProvider(const StringHashCodeProvider& rhs);
123 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
125 StringHashCodeProvider& operator =(const StringHashCodeProvider& rhs);
127 }; // StringHashCodeProvider
131 #endif // _FBASE_STRING_HASH_CODE_PROVIDER_H_