X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=inc%2FFBaseColRandomIteratorT.h;h=ad9b7253f1f2d3f22d96e0bc7cf1025c069eb669;hb=9646d95c0666d24d94fdefeedf94c951b9d6c812;hp=6024733c4e07d23054c905d4322197b3685a5763;hpb=bcf8611628bb06fd14f2fe8e019ab52334953ae4;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/inc/FBaseColRandomIteratorT.h b/inc/FBaseColRandomIteratorT.h index 6024733..ad9b725 100644 --- a/inc/FBaseColRandomIteratorT.h +++ b/inc/FBaseColRandomIteratorT.h @@ -1,5 +1,4 @@ // -// Open Service Platform // Copyright (c) 2013 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); @@ -25,7 +24,7 @@ #ifndef _FBASE_COL_RANDOM_ITERATOR_T_H_ #define _FBASE_COL_RANDOM_ITERATOR_T_H_ -#include // std::swap (Before C++11) +#include // std::swap (Before C++11) #include #include #include @@ -35,16 +34,19 @@ namespace Tizen { namespace Base { namespace Collection { /** * @class RandomIteratorT - * @brief This class provides an random iterator that is used to convert IList to STL containers. - * StlConverter provides static methods to get this random iterator from IList. + * @brief This class provides a random iterator that is used to convert %IList to STL containers. @n + * %StlConverter provides static methods to get this random iterator from IList. * * @since 2.1 * - * @remarks The %RandomIteratorT class satisfies only requirements of C++ standard library InputIterator concept due to limitations of Tizen Collection. - * So, this class can be used with C++ standard library algorithms which requires only InputIterator concept for their arguments. + * @remarks The %RandomIteratorT class satisfies only the requirements of the C++ standard library InputIterator concept due to the limitations of the %Tizen collection. @n + * This class can be used with the C++ standard library algorithms which require only the InputIterator concept for their arguments. + * + * The %RandomIteratorT class provides a random iterator that is used to convert IList to STL containers. + * StlConverter provides static methods to get this random iterator from IList. */ -template < typename T > +template< typename T > class RandomIteratorT : public std::iterator< std::input_iterator_tag, T > { @@ -54,10 +56,10 @@ public: * * @since 2.1 * - * @param[in] list A reference to the IList instance to convert - * @param[in] position A start position - * @remarks %RandomIteratorT only supports random accessible collection for performance. - * @see Tizen::Base::Collection::IList::IsRandomAccessible() + * @param[in] list A reference to the IList instance to convert + * @param[in] index The starting index + * @remarks %RandomIteratorT only supports random accessible collection for its performance. + * @see Tizen::Base::Collection::IList::IsRandomAccessible() */ explicit RandomIteratorT(const IList& list, int index = 0) : __pList(&list) @@ -89,7 +91,7 @@ public: * @return A reference to the %RandomIteratorT instance * @param[in] rhs A reference to the %RandomIteratorT instance on the right-hand side of the operator */ - RandomIteratorT< T >& operator=(const RandomIteratorT< T >& rhs) + RandomIteratorT< T >& operator =(const RandomIteratorT< T >& rhs) { RandomIteratorT< T > tmp(rhs); tmp.swap(*this); @@ -103,7 +105,7 @@ public: * * @return A T type reference */ - T& operator*(void) const + T& operator *(void) const { AppAssertf(__index >= 0 && __index < __pList->GetCount(), "It is out of range."); return const_cast< T& >(__currentObj); @@ -116,9 +118,9 @@ public: * * @return A T type pointer equivalent to the pointer address */ - T* operator->(void) const + T* operator ->(void) const { - return &(operator*()); + return &(operator *()); } /** @@ -128,11 +130,13 @@ public: * * @return A reference to the %RandomIteratorT instance * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, - * or the specified index is either equal to or greater than the number of elements in the list or less than 0. + * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: + * - The specified @c index is outside the bounds of the data structure. + * - The specified @c index is either greater than or equal to the number of elements in the list. + * - The specified @c index is less than @c 0. * @remarks The specific error code can be accessed using GetLastResult() method. */ - RandomIteratorT< T >& operator++(void) + RandomIteratorT< T >& operator ++(void) { ++__index; @@ -149,29 +153,33 @@ public: * * @return A %RandomIteratorT instance * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, - * or the specified index is either equal to or greater than the number of elements in the list or less than 0. + * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: + * - The specified @c index is outside the bounds of the data structure. + * - The specified @c index is either greater than or equal to the number of elements in the list. + * - The specified @c index is less than @c 0. * @remarks The specific error code can be accessed using GetLastResult() method. */ - RandomIteratorT< T > operator++(int) + RandomIteratorT< T > operator ++(int) { RandomIteratorT< T > tempIter = *this; - operator++(); + operator ++(); return tempIter; } /** - * Decrease __index by 1. + * Decreases __index by 1. * * @since 2.1 * * @return A reference to the %RandomIteratorT instance * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, - * or the specified index is either equal to or greater than the number of elements in the list or less than 0. + * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: + * - The specified @c index is outside the bounds of the data structure. + * - The specified @c index is either greater than or equal to the number of elements in the list. + * - The specified @c index is less than @c 0. * @remarks The specific error code can be accessed using GetLastResult() method. */ - RandomIteratorT< T >& operator--(void) + RandomIteratorT< T >& operator --(void) { --__index; @@ -182,20 +190,22 @@ public: } /** - * Decrease __index by 1 and returns the previous state. + * Decreases __index by 1 and returns the previous state. * * @since 2.1 * * @return A %RandomIteratorT instance * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, - * or the specified index is either equal to or greater than the number of elements in the list or less than 0. + * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: + * - The specified @c index is outside the bounds of the data structure. + * - The specified @c index is either greater than or equal to the number of elements in the list. + * - The specified @c index is less than @c 0. * @remarks The specific error code can be accessed using GetLastResult() method. */ - RandomIteratorT< T > operator--(int) + RandomIteratorT< T > operator --(int) { RandomIteratorT< T > tempIter = *this; - operator--(); + operator --(); return tempIter; } @@ -208,7 +218,7 @@ public: * else @c false * @param[in] rhs A reference to the %RandomIteratorT instance on the right-hand side of the operator */ - bool operator==(const RandomIteratorT< T >& rhs) const + bool operator ==(const RandomIteratorT< T >& rhs) const { return ((__pList == rhs.__pList) && (__index == rhs.__index) && (__currentObj == rhs.__currentObj)); } @@ -222,52 +232,54 @@ public: * else @c false * @param[in] rhs A reference to the %RandomIteratorT instance on the right-hand side of the operator */ - bool operator!=(const RandomIteratorT< T >& rhs) const + bool operator !=(const RandomIteratorT< T >& rhs) const { - return !operator==(rhs); + return !operator ==(rhs); } /** - * Checks l-value is less than r-value. + * Checks whether the l-value is less than the r-value. * * @since 2.1 * - * @return @c true if l-value of the specified %RandomIteratorT instance is less than the calling instance's members, @n + * @return @c true if the l-value of the specified %RandomIteratorT instance is less than the calling instance's members, @n * else @c false * @param[in] rhs A reference to the %RandomIteratorT instance on the right-hand side of the operator */ - bool operator<(const RandomIteratorT< T >& rhs) const + bool operator <(const RandomIteratorT< T >& rhs) const { return __index < rhs.__index; } /** - * Checks whether l-value is greater than r-value. + * Checks whether the l-value is greater than the r-value. * * @since 2.1 * - * @return @c true if l-value of the specified %RandomIteratorT instance is greater than the calling instance's members, @n + * @return @c true if the l-value of the specified %RandomIteratorT instance is greater than the calling instance's members, @n * else @c false * @param[in] rhs A reference to the %RandomIteratorT instance on the right-hand side of the operator */ - bool operator>(const RandomIteratorT< T >& rhs) const + bool operator >(const RandomIteratorT< T >& rhs) const { return __index > rhs.__index; } /** - * Increases __index as specified by the diff parameter. + * Increases __index as specified by the @c diff parameter. * * @since 2.1 * * @return A %RandomIteratorT instance - * @param[in] diff The length to move forward + * @param[in] diff The length to move forward * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, - * or the specified index is either equal to or greater than the number of elements in the list or less than 0. + * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: + * - The specified @c index is outside the bounds of the data structure. + * - The specified @c index is either greater than or equal to the number of elements in the list. + * - The specified @c index is less than @c 0. * @remarks The specific error code can be accessed using GetLastResult() method. */ - RandomIteratorT< T > operator+(int diff) + RandomIteratorT< T > operator +(int diff) { RandomIteratorT< T > tempIter = *this; tempIter.__index += diff; @@ -279,18 +291,20 @@ public: } /** - * Decrease __index as specified by the diff parameter. + * Decreases __index as specified by the @c diff parameter. * * @since 2.1 * * @return A %RandomIteratorT instance - * @param[in] diff The length to move backward + * @param[in] diff The length to move backward * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, - * or the specified index is either equal to or greater than the number of elements in the list or less than 0. + * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: + * - The specified @c index is outside the bounds of the data structure. + * - The specified @c index is either greater than or equal to the number of elements in the list. + * - The specified @c index is less than @c 0. * @remarks The specific error code can be accessed using GetLastResult() method. */ - RandomIteratorT< T > operator-(int diff) + RandomIteratorT< T > operator -(int diff) { RandomIteratorT< T > tempIter = *this; tempIter.__index -= diff; @@ -301,7 +315,7 @@ public: return tempIter; } - int operator-(const RandomIteratorT< T >& rhs) + int operator -(const RandomIteratorT< T >& rhs) { return __index - rhs.__index; } @@ -312,13 +326,15 @@ public: * @since 2.1 * * @return A reference to the T type instance - * @param[in] index An index to reach + * @param[in] index The index to reach * @exception E_SUCCESS The method is successful. - * @exception E_OUT_OF_RANGE The specified index is outside the bounds of the data structure, - * or the specified index is either equal to or greater than the number of elements in the list or less than 0. + * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: + * - The specified @c index is outside the bounds of the data structure. + * - The specified @c index is either greater than or equal to the number of elements in the list. + * - The specified @c index is less than @c 0. * @remarks The specific error code can be accessed using GetLastResult() method. */ - T& operator[](int index) const + T& operator [](int index) const { // GetAt() will return null if __index is out of range. const T& tempObj = static_cast< T >(const_cast< Object* >(__pList->GetAt(index))); @@ -327,7 +343,7 @@ public: } /** - * Swaps values of the two %RandomIteratorT instances. + * Swaps the values of the two %RandomIteratorT instances. * * @since 2.1 *