sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FBaseColIComparer.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                FBaseColIComparer.h
20  * @brief               This is the header file for the %IComparer interface.
21  *
22  * This header file contains the declarations of the %IComparer interface.
23  */
24 #ifndef _FBASE_COL_ICOMPARER_H_
25 #define _FBASE_COL_ICOMPARER_H_
26
27 #include <FBaseTypes.h>
28 #include <FBaseObject.h>
29
30
31 namespace Tizen { namespace Base { namespace Collection
32 {
33 /**
34  * @interface IComparer
35  * @brief This interface allows a derived class to compare 2 objects of the same type.
36  *
37  * @since 2.0
38  *
39  * The %IComparer interface allows a derived class to compare 2 objects of the same type.
40  */
41 class _OSP_EXPORT_ IComparer
42 {
43 public:
44         /**
45          * This polymorphic destructor should be overridden if required. @n
46          * This way, the destructors of the derived classes are called when the destructor of this interface is called.
47          *
48          * @since 2.0
49          */
50         virtual ~IComparer(void) { }
51
52 public:
53         /**
54          * Compares two given instances of the same type.
55          *
56          * @since 2.0
57          *
58          * @return              An error code
59          * @param[in]   obj1    The first object to compare
60          * @param[in]   obj2    The second object to compare
61          * @param[out]  cmp             The result of comparison
62          * @exception   E_SUCCESS               The method is successful.
63          * @exception   E_INVALID_ARG   The specified object instances are not of the expected type.
64          * @remarks             The value of @c cmp can be:
65          *
66          * @code
67          * <  0  if the value of @c obj1 is less than the value of @c obj2
68          * == 0  if the value of @c obj1 is equal to the value of @c obj2
69          * >  0  if the value of @c obj1 is greater than the value of @c obj2
70          * @endcode
71          */
72         virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const = 0;
73
74 protected:
75         //
76         // This method is for internal use only. Using this method can cause behavioral, security-related,
77         // and consistency-related issues in the application.
78         // This method is reserved and may change its name at any time without prior notice.
79         //
80         // @since 2.0
81         //
82         virtual void IComparer_Reserved1(void) { }
83
84         //
85         // This method is for internal use only. Using this method can cause behavioral, security-related,
86         // and consistency-related issues in the application.
87         // This method is reserved and may change its name at any time without prior notice.
88         //
89         // @since 2.0
90         //
91         virtual void IComparer_Reserved2(void) { }
92
93 }; // IComparer
94 }}} // Tizen::Base::Collection
95
96 #endif // _FBASE_COL_ICOMPARER_H_