Move system-server under server/system.
[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  * @see                 String and Tizen::Base::Collection::IComparer
22  *
23  * This header file contains the declarations of the %StringComparer class.
24  */
25 #ifndef _FBASE_STRING_COMPARER_H_
26 #define _FBASE_STRING_COMPARER_H_
27
28 // includes
29 #include <FBaseTypes.h>
30 #include <FBaseObject.h>
31 #include <FBaseColIComparer.h>
32
33
34 namespace Tizen { namespace Base
35 {
36 /**
37  * @class       StringComparer
38  * @brief       This class checks for equivalence between 2 instances of the %String type.
39  *
40  * @since 2.0
41  *
42  * The %StringComparer class checks for equivalence between 2 instances of the String type.
43  *
44  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
45  *
46  * The following example demonstrates how to use the %StringComparer class.
47  *
48  * @code
49  *
50  *      #include <FBase.h>
51  *
52  *      using namespace Tizen::Base;
53  *
54  *      void
55  *      MyClass::StringComparerSample(void)
56  *      {
57  *              String s1(L"ABC");
58  *              String s2(L"abc");
59  *              StringComparer strComparer;
60  *
61  *              int cmp;
62  *              strComparer.Compare(s1, s2, cmp);
63  *              if (cmp < 0)
64  *              {
65  *                      // ...
66  *              }
67  *      }
68  * @endcode
69  */
70 class _OSP_EXPORT_ StringComparer
71         : public Object
72         , public virtual Tizen::Base::Collection::IComparer
73 {
74 public:
75         /**
76          * This is the default constructor for this class.
77          *
78          * @since 2.0
79          */
80         StringComparer(void);
81
82         /**
83          * This destructor overrides Tizen::Base::Object::~Object().
84          *
85          * @since 2.0
86          */
87         virtual ~StringComparer(void);
88
89         /**
90          * Compares two given instances of type String.
91          *
92          * @since 2.0
93          *
94          * @return              An error code
95          * @param[in]   obj1                    An object of String to compare
96          * @param[in]   obj2                    An object of String to compare
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 private:
111         /**
112          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
113          */
114         StringComparer(const StringComparer& 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         StringComparer& operator =(const StringComparer& rhs);
120
121         friend class _StringComparerImpl;
122         class _StringComparerImpl * __pStringComparerImpl;
123
124 }; // StringComparer
125
126 }} // Tizen::Base
127
128 #endif // _FBASE_STRING_COMPARER_H_