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