Applied reviewed header(DateTime to Uuid)
[platform/framework/native/appfw.git] / inc / FBaseStringComparer.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            FBaseStringComparer.h
19  * @brief               This is the header file for the %StringComparer class.
20  *
21  * This header file contains the declarations of the %StringComparer class.
22  *
23  * @see                 String
24  * @see         Tizen::Base::Collection::IComparer
25  */
26 #ifndef _FBASE_STRING_COMPARER_H_
27 #define _FBASE_STRING_COMPARER_H_
28
29 // includes
30 #include <FBaseTypes.h>
31 #include <FBaseObject.h>
32 #include <FBaseColIComparer.h>
33
34
35 namespace Tizen { namespace Base
36 {
37 /**
38  * @class       StringComparer
39  * @brief       This class checks for equivalence between two instances of the %String type.
40  *
41  * @since 2.0
42  *
43  * The %StringComparer class checks for equivalence between two instances of the String type.
44  *
45  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
46  *
47  * The following example demonstrates how to use the %StringComparer class.
48  *
49  * @code
50  *
51  *      #include <FBase.h>
52  *
53  *      using namespace Tizen::Base;
54  *
55  *      void
56  *      MyClass::StringComparerSample(void)
57  *      {
58  *              String s1(L"ABC");
59  *              String s2(L"abc");
60  *              StringComparer strComparer;
61  *
62  *              int cmp;
63  *              strComparer.Compare(s1, s2, cmp);
64  *              if (cmp < 0)
65  *              {
66  *                      // ...
67  *              }
68  *      }
69  * @endcode
70  */
71 class _OSP_EXPORT_ StringComparer
72         : public Object
73         , public virtual Tizen::Base::Collection::IComparer
74 {
75 public:
76         /**
77          * This is the default constructor for this class.
78          *
79          * @since 2.0
80          */
81         StringComparer(void);
82
83         /**
84          * This destructor overrides Tizen::Base::Object::~Object().
85          *
86          * @since 2.0
87          */
88         virtual ~StringComparer(void);
89
90         /**
91          * Compares two given instances of type String.
92          *
93          * @since 2.0
94          *
95          * @return              An error code
96          * @param[in]   obj1                    The object of String to compare
97          * @param[in]   obj2                    The object of String to compare
98          * @param[out]  cmp                             The result of the comparison
99          * @exception   E_SUCCESS               The method is successful.
100          * @exception   E_INVALID_ARG   The specified object instances are not of the expected type.
101          * @remarks             The value of @c cmp can be:
102          *
103          * @code        
104          * <  0  if the value of obj1 is less than the value of obj2
105          * == 0  if the value of obj1 is equal to the value of obj2
106          * >  0  if the value of obj1 is greater than the value of obj2
107          * @endcode
108          */
109         virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
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         StringComparer(const StringComparer& 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         StringComparer& operator =(const StringComparer& rhs);
121
122         friend class _StringComparerImpl;
123         class _StringComparerImpl * __pStringComparerImpl;
124
125 }; // StringComparer
126
127 }} // Tizen::Base
128
129 #endif // _FBASE_STRING_COMPARER_H_