Modify smack rule to access the privilege description DB
[platform/framework/native/appfw.git] / inc / FBaseStringHashCodeProvider.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
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
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  * @file                FBaseStringHashCodeProvider.h
20  * @brief               This is the header file for the %StringHashCodeProvider class.
21  *
22  * This header file contains the declarations of the %StringHashCodeProvider class.
23  */
24 #ifndef _FBASE_STRING_HASH_CODE_PROVIDER_H_
25 #define _FBASE_STRING_HASH_CODE_PROVIDER_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseColIHashCodeProvider.h>
29 #include <FBaseColIHashCodeProviderT.h>
30
31 namespace Tizen { namespace Base
32 {
33 /**
34  * @class       StringHashCodeProvider
35  * @brief       This class provides the hash code of an instance of type String.
36  *
37  * @since       2.1
38  *
39  * The %StringHashCodeProvider class provides the hash code of an instance of type String.
40  *
41  * The following example demonstrates how to use the %StringHashCodeProvider class.
42  *
43  * @code
44  *
45  *      #include <FBase.h>
46  *
47  *      using namespace Tizen::Base;
48  *      using namespace Tizen::Base::Collection;
49  *
50  *      void
51  *      MyClass::StringHashCodeProviderSample(void)
52  *      {
53  *              HashMapT<String, int> map;
54  *
55  *              ComparerT<String> comparer;
56  *              StringHashCodeProvider strHashCodeProvider;
57  *
58  *              map.Construct(0, 0, strHashCodeProvider, comparer);
59  *
60  *              map.Add(String(L"Zero"), 0);
61  *              map.Add(String(L"One"), 1);
62  *              map.Add(String(L"Two"), 2);
63  *
64  *              ...
65  *      }
66  * @endcode
67  */
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
72 {
73 public:
74         using Object::GetHashCode;
75
76         /**
77          * This is the default constructor for this class.
78          *
79          * @since       2.1
80          */
81         StringHashCodeProvider(void);
82
83         /**
84          * This destructor overrides Tizen::Base::Object::~Object().
85          *
86          * @since       2.1
87          */
88         virtual ~StringHashCodeProvider(void);
89
90         /**
91          * Gets the hash code of an instance of type String.
92          *
93          * @since       2.1
94          *
95          * @return              The hash code of an instance of type String
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.
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             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.
113          */
114         virtual int GetHashCode(const Tizen::Base::Object& obj) const;
115
116 private:
117         //
118         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
119         //
120         StringHashCodeProvider(const StringHashCodeProvider& rhs);
121
122         //
123         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
124         //
125         StringHashCodeProvider& operator =(const StringHashCodeProvider& rhs);
126
127 }; // StringHashCodeProvider
128
129 }} // Tizen::Base
130
131 #endif // _FBASE_STRING_HASH_CODE_PROVIDER_H_