Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / inc / FBaseStringHashCodeProvider.h
1 //
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file                FBaseStringHashCodeProvider.h
19  * @brief               This is the header file for the %StringHashCodeProvider class.
20  *
21  * This header file contains the declarations of the %StringHashCodeProvider class.
22  */
23 #ifndef _FBASE_STRING_HASH_CODE_PROVIDER_H_
24 #define _FBASE_STRING_HASH_CODE_PROVIDER_H_
25
26 #include <FBaseObject.h>
27 #include <FBaseColIHashCodeProvider.h>
28 #include <FBaseColIHashCodeProviderT.h>
29
30 namespace Tizen { namespace Base
31 {
32 /**
33  * @class       StringHashCodeProvider
34  * @brief       This class provides the hash code of an instance of type %String.
35  *
36  * @since       2.1
37  *
38  * The %StringHashCodeProvider class provides the hash code of an instance of type String.
39  *
40  * The following example demonstrates how to use the %StringHashCodeProvider class.
41  *
42  * @code
43  *
44  *      #include <FBase.h>
45  *
46  *      using namespace Tizen::Base;
47  *      using namespace Tizen::Base::Collection;
48  *
49  *      void
50  *      MyClass::StringHashCodeProviderSample(void)
51  *      {
52  *              HashMapT<String, int> map;
53  *
54  *              ComparerT<String> comparer;
55  *              StringHashCodeProvider strHashCodeProvider;
56  *
57  *              map.Construct(0, 0, strHashCodeProvider, comparer);
58  *
59  *              map.Add(String(L"Zero"), 0);
60  *              map.Add(String(L"One"), 1);
61  *              map.Add(String(L"Two"), 2);
62  *
63  *              ...
64  *      }
65  * @endcode
66  */
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
71 {
72 public:
73         using Object::GetHashCode;
74
75         /**
76          * This is the default constructor for this class.
77          *
78          * @since       2.1
79          */
80         StringHashCodeProvider(void);
81
82         /**
83          * This destructor overrides Tizen::Base::Object::~Object().
84          *
85          * @since       2.1
86          */
87         virtual ~StringHashCodeProvider(void);
88
89         /**
90          * Gets the hash code of an instance of type String.
91          *
92          * @since       2.1
93          *
94          * @return              The hash code of the instance of type String
95          * @param[in]   str             The String instance whose hash code is requested
96          * @remarks
97          *                              - The hash algorithm is usually specific to a type.
98          *                              - Two equal instances must return the same hash value.@n
99          *                              For better performance, the used hash function must generate a random distribution for all the inputs.
100          */
101         virtual int GetHashCode(const Tizen::Base::String& str) const;
102
103         /**
104          * Gets the hash code of the specified object.
105          *
106          * @since       2.1
107          *
108          * @return              The hash code of the specified object
109          * @param[in]   obj             The Object whose hash code is requested
110          * @remarks
111          *                              - The hash algorithm is usually specific to a type.
112          *                              - Two equal instances must return the same hash value. @n
113          *                              For better performance, the used hash function must generate a random distribution for all the inputs.
114          */
115         virtual int GetHashCode(const Tizen::Base::Object& obj) const;
116
117 private:
118         //
119         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
120         //
121         StringHashCodeProvider(const StringHashCodeProvider& rhs);
122
123         //
124         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
125         //
126         StringHashCodeProvider& operator =(const StringHashCodeProvider& rhs);
127
128 }; // StringHashCodeProvider
129
130 }} // Tizen::Base
131
132 #endif // _FBASE_STRING_HASH_CODE_PROVIDER_H_