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