2 // Open Service Platform
3 // Copyright (c) 2012 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 FBaseComparerT.h
20 * @brief This is the header file for the %ComparerT class.
22 * This file contains declarations of the %ComparerT class.
24 #ifndef _FBASE_COMPARER_T_H_
25 #define _FBASE_COMPARER_T_H_
28 #include <FBaseTypes.h>
29 #include <FBaseColIComparerT.h>
32 namespace Tizen { namespace Base
37 * @brief This class checks for equivalence between 2 values of the same primitive type.
40 * The %ComparerT class checks for equivalence between 2 values of the same primitive type.
42 * The following example demonstrates how to use the %ComparerT class.
48 * using namespace Tizen::Base;
51 * MyClass::ComparerTSample(void)
55 * ComparerT<double> comparer;
57 * // Compares 2 instances of Double
59 * comparer.Compare(d1, d2, cmp);
69 : public virtual Tizen::Base::Collection::IComparerT <Type>
74 * This constructor initializes a new instance of the %ComparerT class.
82 * This destructor overrides Tizen::Base::Object::~Object().
86 virtual ~ComparerT(void) { }
89 * Compares two given instances of the same type.
93 * @return An error code
94 * @param[in] obj1 The first object to compare
95 * @param[in] obj2 The second object to compare
96 * @param[out] cmp The result of comparison
97 * @exception E_SUCCESS The method is successful.
98 * @exception E_INVALID_ARG The specified objects are not of the expected type.
99 * @remarks @c cmp can take one of the following values:
101 * < 0 if the value of @c obj1 is less than the value of @c obj2
102 * == 0 if the value of @c obj1 is equal to the value of @c obj2
103 * > 0 if the value of @c obj1 is greater than the value of @c obj2
106 virtual result Compare(const Type& obj1, const Type& obj2, int& cmp) const
112 else if (obj1 < obj2)
126 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
128 ComparerT(const ComparerT& obj);
131 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
133 ComparerT& operator =(const ComparerT& rhs);
138 class ComparerT <Tizen::Base::String>
139 : public virtual Tizen::Base::Collection::IComparerT <Tizen::Base::String>
144 * This constructor initializes a new instance of the %ComparerT class.
151 * This destructor overrides Tizen::Base::Object::~Object().
155 virtual ~ComparerT(void) { }
158 * Compare two String instances.
162 * @return Always returns E_SUCCESS
163 * @param[in] str1 The String instance to compare
164 * @param[in] str2 The String instance to compare
165 * @param[in] cmp An integer value for result
167 virtual result Compare(const Tizen::Base::String& str1, const Tizen::Base::String& str2, int& cmp) const
169 cmp = String::Compare(str1, str2);
174 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
176 ComparerT(const ComparerT& obj);
179 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
181 ComparerT& operator =(const ComparerT& rhs);
183 }; // ComparerT <Tizen::Base::String>
187 #endif // _FBASE_COMPARER_T_H_