a593cd876d14b26a1e59755294e2d0fd7dca4c39
[platform/framework/native/appfw.git] / inc / FBaseIntegerComparer.h
1 //
2 // Copyright (c) 2012 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                FBaseIntegerComparer.h
19  * @brief               This is the header file for the %IntegerComparer class.
20  *
21  * This header file contains the declarations of the %IntegerComparer class.
22  *
23  * @see                 Integer
24  * @see                 Tizen::Base::Collection::IComparer
25  */
26 #ifndef _FBASE_INTEGER_COMPARER_H_
27 #define _FBASE_INTEGER_COMPARER_H_
28
29 #include <FBaseTypes.h>
30 #include <FBaseObject.h>
31 #include <FBaseColIComparer.h>
32
33 namespace Tizen { namespace Base
34 {
35 /**
36  *      @class  IntegerComparer
37  *      @brief  This class checks for equivalence between two instances of the %Integer type.
38  *
39  *      @since 2.0
40  *
41  *      The %IntegerComparer class checks for equivalence between two instances of the Integer type.
42  *
43  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
44  *
45  * The following example demonstrates how to use the %IntegerComparer class.
46  *
47  *      @code
48  *
49  *      #include <FBase.h>
50  *
51  *      using namespace Tizen::Base;
52  *
53  *      void
54  *      MyClass::IntegerComparerSample(void)
55  *      {
56  *              Integer i1(123);
57  *              Integer i2(124);
58  *              IntegerComparer comparer;
59  *
60  *              int cmp;
61  *              comparer.Compare(i1, i2, cmp);
62  *              if (cmp < 0)
63  *              {
64  *                      // ...
65  *              }
66  *      }
67  *      @endcode
68  */
69 class _OSP_EXPORT_ IntegerComparer
70         : public Object
71         , public virtual Tizen::Base::Collection::IComparer
72 {
73 public:
74         /**
75          *      This is the default constructor for this class.
76          *
77          *      @since 2.0
78          */
79         IntegerComparer(void);
80
81         /**
82          *      This destructor overrides Tizen::Base::Object::~Object().
83          *
84          *      @since 2.0
85          */
86         virtual ~IntegerComparer(void);
87
88         /**
89          * Compares two given instances of type Integer.
90          *
91          * @since 2.0
92          *
93          * @return              An error code
94          * @param[in]   obj1                    The first instance of type Integer
95          * @param[in]   obj2                    The second instance of type Integer
96          * @param[out]  cmp                             The result of the comparison
97          * @exception   E_SUCCESS               The method is successful.
98          * @exception   E_INVALID_ARG   The specified object instances are not of the expected type.
99          * @remarks     The value of @c cmp can be:
100          *
101          * @code
102          * <  0  if the value of obj1 is less than the value of obj2
103          * == 0  if the value of obj1 is equal to the value of obj2
104          * >  0  if the value of obj1 is greater than the value of obj2
105          * @endcode
106          */
107         virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
108
109
110 private:
111         /**
112          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
113          */
114         IntegerComparer(const IntegerComparer& obj);
115
116         /**
117          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
118          */
119         IntegerComparer& operator =(const IntegerComparer& rhs);
120
121         friend class _IntegerComparerImpl;
122         class _IntegerComparerImpl* __pIntegerComparerImpl;
123
124 }; // IntegerComparer
125
126 }} // Tizen::Base
127
128 #endif // _FBASE_INTEGER_COMPARER_H_