//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
#ifndef _FBASE_COMPARER_T_H_
#define _FBASE_COMPARER_T_H_
-// Includes
#include <FBaseTypes.h>
#include <FBaseColIComparerT.h>
-
namespace Tizen { namespace Base
{
/**
* @class ComparerT
*
- * @brief This class checks for equivalence between 2 values of the same primitive type.
+ * @brief This class checks for equivalence between two values of the same primitive type.
* @since 2.0
*
- * The %ComparerT class checks for equivalence between 2 values of the same primitive type.
+ * The %ComparerT class checks for equivalence between two values of the same primitive type.
*
* The following example demonstrates how to use the %ComparerT class.
*
- * @code
+ * @code
*
* #include <FBase.h>
*
* // ...
* }
* }
- * @endcode
+ * @endcode
*/
-template<class Type>
+template< class Type >
class ComparerT
- : public virtual Tizen::Base::Collection::IComparerT <Type>
+ : public virtual Tizen::Base::Collection::IComparerT< Type >
, public Object
{
public:
*
* @since 2.0
*/
- ComparerT(void) {}
+ ComparerT(void) { }
/**
* @since 2.0
*
* @return An error code
- * @param[in] obj1 The first object to compare
- * @param[in] obj2 The second object to compare
- * @param[out] cmp The result of comparison
+ * @param[in] obj1 The first object to compare
+ * @param[in] obj2 The second object to compare
+ * @param[out] cmp The result of the comparison
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG The specified objects are not of the expected type.
* @remarks @c cmp can take one of the following values:
* @code
- * < 0 if the value of @c obj1 is less than the value of @c obj2
- * == 0 if the value of @c obj1 is equal to the value of @c obj2
- * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * < 0 if the value of obj1 is less than the value of obj2
+ * == 0 if the value of obj1 is equal to the value of obj2
+ * > 0 if the value of obj1 is greater than the value of obj2
* @endcode
*/
virtual result Compare(const Type& obj1, const Type& obj2, int& cmp) const
}
private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ ComparerT(const ComparerT& obj);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ ComparerT& operator =(const ComparerT& rhs);
+
+}; // ComparerT
+
+template< >
+class ComparerT< Tizen::Base::String >
+ : public virtual Tizen::Base::Collection::IComparerT< Tizen::Base::String >
+ , public Object
+{
+public:
/**
- * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ * This constructor initializes a new instance of the %ComparerT class.
+ *
+ * @since 2.1
*/
- ComparerT(const ComparerT& obj);
+ ComparerT(void) { }
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ */
+ virtual ~ComparerT(void) { }
/**
- * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ * Compares two String instances.
+ *
+ * @since 2.1
+ *
+ * @return Always returns @c E_SUCCESS
+ * @param[in] str1 The String instance to compare
+ * @param[in] str2 The String instance to compare
+ * @param[in] cmp The integer value for the result
*/
+ virtual result Compare(const Tizen::Base::String& str1, const Tizen::Base::String& str2, int& cmp) const
+ {
+ cmp = String::Compare(str1, str2);
+ return E_SUCCESS;
+ }
+private:
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ ComparerT(const ComparerT& obj);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
ComparerT& operator =(const ComparerT& rhs);
-}; // ComparerT
+}; // ComparerT <Tizen::Base::String>
}} // Tizen::Base