X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=inc%2FFBaseColIteratorT.h;h=67ad607fcd565dec9dc76c540c37d849875b8867;hb=72749ddd32dd1e3e2833ada50fad8fceefbdcddc;hp=4fe967aa6aa45215e7f4f0fe8981d9eed79af71b;hpb=4e67e622cd41698f604d01049d0e0e08d0cdb585;p=platform%2Fframework%2Fnative%2Fappfw.git diff --git a/inc/FBaseColIteratorT.h b/inc/FBaseColIteratorT.h index 4fe967a..67ad607 100644 --- a/inc/FBaseColIteratorT.h +++ b/inc/FBaseColIteratorT.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_ITERATOR_T_H_ #define _FBASE_COL_ITERATOR_T_H_ -#include // std::swap (Before C++11) +#include // std::swap (Before C++11) #include #include #include @@ -36,27 +35,30 @@ namespace Tizen { namespace Base { namespace Collection { /** * @class IteratorT - * @brief This class provides an iterator that is used to convert IList to STL containers. - * StlConverter provides static methods to get this iterator from IList. + * @brief This class provides an iterator that is used to convert %IList to STL containers. @n + * %StlConverter provides static methods to get this iterator from %IList. * * @since 2.1 * - * @remarks This class satisfies only requirements of C++ standard library InputIterator concept due to limitations of Tizen Collection. + * @remarks The %IteratorT 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. + * + * The %IteratorT class provides an iterator that is used to convert IList to STL containers. + * StlConverter provides static methods to get this iterator from IList. */ -template < typename T > +template< typename T > class IteratorT : public std::iterator< std::input_iterator_tag, T > { public: /** - * Initializes this instance of %IteratorT class. + * Initializes an instance of %IteratorT class. * * @since 2.1 * * @param[in] list A reference to the IList instance to convert - * @param[in] isPostEnd A boolean value to check the end + * @param[in] isPostEnd A boolean value to check the end of a list */ explicit IteratorT(const IList& list, bool isPostEnd = false) : __pList(&list) @@ -86,7 +88,7 @@ public: } /** - * This is copy constructor of %IteratorT class. + * This is the copy constructor of the %IteratorT class. * * @since 2.1 * @@ -113,14 +115,14 @@ public: } /** - * This is assignment operator of %IteratorT class. + * This is an assignment operator of the %IteratorT class. * * @since 2.1 * * @return A reference to the %IteratorT instance * @param[in] rhs A reference to the %IteratorT instance on the right-hand side of the operator */ - IteratorT< T >& operator=(const IteratorT< T >& rhs) + IteratorT< T >& operator =(const IteratorT< T >& rhs) { IteratorT< T > tmp(rhs); tmp.swap(*this); @@ -128,43 +130,43 @@ public: } /** - * This is the indirection operator for %IteratorT class. + * This is the indirection operator for the %IteratorT class. * * @since 2.1 * * @return A T type reference */ - T& operator*(void) const + T& operator *(void) const { AppAssertf(!__isPostEnd && __index >= 0, "It is out of range."); return const_cast< T& >(__currentObj); } /** - * This is the structure dereference operator for %IteratorT class. + * This is a structure dereference operator for the %IteratorT class. * * @since 2.1 * - * @return A T type pointer equivalent to the pointer address + * @return A T type pointer that is equivalent to the pointer address */ - T* operator->(void) const + T* operator ->(void) const { - return &(operator*()); + return &(operator *()); } /** - * Moves to the next element of the collection. + * Moves to the next element in the collection. * * @since 2.1 * * @return A reference to the %IteratorT type instance * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_RANGE The iterator is outside the bounds of the list. - * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation + * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or * the collection is modified after the enumerator is created. * @remarks The specific error code can be accessed using GetLastResult() method. */ - IteratorT< T >& operator++(void) + IteratorT< T >& operator ++(void) { const int PRE_BEGIN_IDX = -1; TryCatchResult(__index >= PRE_BEGIN_IDX, , E_OUT_OF_RANGE, "[%s] It is out of range.", GetErrorMessage(E_OUT_OF_RANGE)); @@ -172,12 +174,13 @@ public: if (__index != PRE_BEGIN_IDX) { result r = __pEnum->MoveNext(); - TryCatchResult(r == E_SUCCESS, __isPostEnd = true; __currentObj = null, r, "[%s] It already reached the end.", GetErrorMessage(r)); + TryCatchResult(r == E_SUCCESS, __isPostEnd = true; + __currentObj = null, r, "[%s] It already reached the end.", GetErrorMessage(r)); } __currentObj = static_cast< T >(__pEnum->GetCurrent()); - CATCH: +CATCH: ++__index; return *this; } @@ -187,18 +190,17 @@ public: * * @since 2.1 * - * @return An IteratorT instance + * @return An %IteratorT instance * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_RANGE The iterator is outside the bounds of the list. - * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation or + * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or * the collection is modified after the enumerator is created. - * @remarks It takes O(n) time to get current Enumerate point to return. So use this operator as little as possible. * @remarks The specific error code can be accessed using GetLastResult() method. */ - IteratorT< T > operator++(int) + IteratorT< T > operator ++(int) { IteratorT< T > tempIter = *this; - operator++(); + operator ++(); return tempIter; } @@ -210,11 +212,11 @@ public: * @return A reference to the %IteratorT type instance * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_RANGE The iterator is outside the bounds of the list. - * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation or + * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or * the collection is modified after the enumerator is created. * @remarks The specific error code can be accessed using GetLastResult() method. */ - IteratorT< T >& operator--(void) + IteratorT< T >& operator --(void) { TryCatchResult(__index <= __pList->GetCount(), , E_OUT_OF_RANGE, "[%s] It is out of range.", GetErrorMessage(E_OUT_OF_RANGE)); @@ -240,23 +242,22 @@ CATCH: * * @since 2.1 * - * @return An IteratorT instance + * @return An %IteratorT instance * @exception E_SUCCESS The method is successful. * @exception E_OUT_OF_RANGE The iterator is outside the bounds of the list. - * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation or + * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified operation, or * the collection is modified after the enumerator is created. - * @remarks It takes O(n) time to get current Enumerate point to return. So use this operator as little as possible. * @remarks The specific error code can be accessed using GetLastResult() method. */ - IteratorT< T > operator--(int) + IteratorT< T > operator --(int) { IteratorT< T > tempIter = *this; - operator--(); + operator --(); return tempIter; } /** - * Checks the two %IteratorT instances for equality + * Checks the two %IteratorT instances for equality. * * @since 2.1 * @@ -264,7 +265,7 @@ CATCH: * else @c false * @param[in] rhs A reference to the %IteratorT instance on the right-hand side of the operator */ - bool operator==(const IteratorT< T >& rhs) const + bool operator ==(const IteratorT< T >& rhs) const { if (__pList != rhs.__pList) { @@ -295,21 +296,21 @@ CATCH: * * @since 2.1 * - * @return @c true if every member of the specified %IteratorT instance is not equal to the calling instance's members, @n + * @return @c true if any member of the specified %IteratorT instance is not equal to the calling instance's members, @n * else @c false * @param[in] rhs A reference to the %IteratorT instance on the right-hand side of the operator */ - bool operator!=(const IteratorT< T >& rhs) const + bool operator !=(const IteratorT< T >& rhs) const { - return !operator==(rhs); + return !operator ==(rhs); } /** - * Exchanges values of the two %IteratorT instances + * Swaps values of two %IteratorT instances. * * @since 2.1 * - * @param[in] rhs A reference to the %IteratorT instance to swap + * @param[in] rhs A reference to a %IteratorT instance to swap */ void swap(IteratorT< T >& rhs) {