#ifndef _FBASE_COL_RANDOM_ITERATOR_T_H_
#define _FBASE_COL_RANDOM_ITERATOR_T_H_
-#include <algorithm> // std::swap (Before C++11)
+#include <algorithm> // std::swap (Before C++11)
#include <iterator>
#include <FBaseColIList.h>
#include <FBaseLog.h>
* 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 >
{
*
* @since 2.1
*
- * @param[in] list A reference to the IList instance to convert
+ * @param[in] list A reference to the IList instance to convert
* @param[in] index A start index
- * @remarks %RandomIteratorT only supports random accessible collection for performance.
- * @see Tizen::Base::Collection::IList::IsRandomAccessible()
+ * @remarks %RandomIteratorT only supports random accessible collection for performance.
+ * @see Tizen::Base::Collection::IList::IsRandomAccessible()
*/
explicit RandomIteratorT(const IList& list, int index = 0)
: __pList(&list)
* @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);
*
* @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);
*
* @return A T type pointer equivalent to the pointer address
*/
- T* operator->(void) const
+ T* operator ->(void) const
{
- return &(operator*());
+ return &(operator *());
}
/**
* or the specified index is either equal to or greater than the number of elements in the list or less than 0.
* @remarks The specific error code can be accessed using GetLastResult() method.
*/
- RandomIteratorT< T >& operator++(void)
+ RandomIteratorT< T >& operator ++(void)
{
++__index;
* or the specified index is either equal to or greater than the number of elements in the list or less than 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;
}
* or the specified index is either equal to or greater than the number of elements in the list or less than 0.
* @remarks The specific error code can be accessed using GetLastResult() method.
*/
- RandomIteratorT< T >& operator--(void)
+ RandomIteratorT< T >& operator --(void)
{
--__index;
* or the specified index is either equal to or greater than the number of elements in the list or less than 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;
}
* 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));
}
* 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 l-value is less than r-value.
*
* @since 2.1
*
* 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;
}
* 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;
}
* @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.
* @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;
* @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.
* @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;
return tempIter;
}
- int operator-(const RandomIteratorT< T >& rhs)
+ int operator -(const RandomIteratorT< T >& rhs)
{
return __index - rhs.__index;
}
* @since 2.1
*
* @return A reference to the T type instance
- * @param[in] index An index to reach
+ * @param[in] index An 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.
* @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)));