//
-// Open Service Platform
// Copyright (c) 2013 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
#ifndef _FBASE_COL_PAIR_ITERATOR_T_H_
#define _FBASE_COL_PAIR_ITERATOR_T_H_
-#include <algorithm> // std::swap (Before C++11)
+#include <algorithm> // std::swap (Before C++11)
#include <iterator>
#include <utility>
#include <unique_ptr.h>
{
/**
* @class PairIteratorT
- * @brief This class provides an iterator that is used to convert IMap or IMultiMap to STL containers.
- * StlConverter provides static methods to get this iterator from IMap or IMultiMap.
+ * @brief This class provides an iterator that is used to convert %IMap or %IMultiMap to STL containers. @n
+ * %StlConverter provides static methods to get this iterator from %IMap or %IMultiMap.
*
* @since 2.1
*
- * @remarks The %PairIteratorT 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 %PairIteratorT class satisfies only 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 %PairIteratorT class provides an iterator that is used to convert IMap or IMultiMap to STL containers.
+ * StlConverter provides static methods to get this iterator from IMap or IMultiMap.
*/
-template < typename K, typename V >
+template< typename K, typename V >
class PairIteratorT
: public std::iterator< std::input_iterator_tag, std::pair< K, V > >
{
public:
/**
- * Initializes this instance of %PairIteratorT class.
+ * Initializes this instance of the %PairIteratorT class.
*
* @since 2.1
*
* @param[in] map A reference to the IMap instance to convert
- * @param[in] isPostEnd A boolean value to check the end
+ * @param[in] isPostEnd The boolean value to check the end of the @c map
*/
explicit PairIteratorT(const IMap& map, bool isPostEnd = false)
: __pMap(&map)
}
/**
- * Initializes this instance of %PairIteratorT class.
+ * Initializes this instance of the %PairIteratorT class.
*
* @since 2.1
*
* @param[in] multiMap A reference to the IMultiMap instance to convert
- * @param[in] isPostEnd A boolean value to check the end
+ * @param[in] isPostEnd The boolean value to check the end of the @c multiMap
*/
PairIteratorT(const IMultiMap& multiMap, bool isPostEnd = false)
: __pMap(null)
* @param[in] rhs A reference to the %PairIteratorT instance
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG Both @c __pMap and @c __pMultiMap are @c null.
- * @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.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The collection is modified after the enumerator is created.
* @remarks The specific error code can be accessed using GetLastResult() method.
*/
PairIteratorT(const PairIteratorT< K, V >& rhs)
}
/**
- * This is assignment operator of the %PairIteratorT class.
+ * This is the assignment operator of the %PairIteratorT class.
*
* @since 2.1
*
* @param[in] rhs A reference to the %PairIteratorT instance on the right-hand side of the operator
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_ARG Both @c __pMap and @c __pMultiMap are @c null.
- * @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.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The collection is modified after the enumerator is created.
* @remarks The specific error code can be accessed using GetLastResult() method.
*/
- PairIteratorT< K, V >& operator=(const PairIteratorT< K, V >& rhs)
+ PairIteratorT< K, V >& operator =(const PairIteratorT< K, V >& rhs)
{
PairIteratorT< K, V > tmp(rhs);
tmp.swap(*this);
*
* @since 2.1
*
- * @return A std::pair type reference with K and V type
+ * @return A std::pair type reference with K and V types
*/
- std::pair< K, V >& operator*(void) const
+ std::pair< K, V >& operator *(void) const
{
AppAssertf(!__isPostEnd, "It is out of range.");
return const_cast< std::pair< K, V >& >(__currentObj);
}
/**
- * This is the const version structure dereference operator for the %PairIteratorT class.
+ * This is the constant version structure dereference operator for the %PairIteratorT class.
*
* @since 2.1
*
* @return A std::pair type pointer equivalent to the pointer address
*/
- std::pair< K, V >* operator->(void) const
+ std::pair< K, V >* operator ->(void) const
{
- return &(operator*());
+ return &(operator *());
}
/**
* @return A reference to the %PairIteratorT instance
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_RANGE The enumerator has passed the end of the collection.
- * @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.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The collection is modified after the enumerator is created.
* @remarks The specific error code can be accessed using GetLastResult() method.
*/
- PairIteratorT< K, V >& operator++(void)
+ PairIteratorT< K, V >& operator ++(void)
{
TryReturnResult(!__isPostEnd, *this, E_OUT_OF_RANGE, "[%s] It already reached the end.", GetErrorMessage(E_OUT_OF_RANGE));
result r = __pEnum->MoveNext();
- TryCatchResult(r == E_SUCCESS, __isPostEnd = true; __currentObj.first = null; __currentObj.second = null,
+ TryCatchResult(r == E_SUCCESS, __isPostEnd = true;
+ __currentObj.first = null;
+ __currentObj.second = null,
r, "[%s] It already reached the end.", GetErrorMessage(r));
__currentObj.first = static_cast< K >(__pEnum->GetKey());
* @return A %PairIteratorT instance
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_RANGE The enumerator has passed the end of the collection.
- * @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.
+ * @exception E_INVALID_OPERATION Either of the following conditions has occurred:
+ * - The current state of the instance prohibits the execution of the specified operation.
+ * - The collection is modified after the enumerator is created.
* @remarks The specific error code can be accessed using GetLastResult() method.
*/
- PairIteratorT< K, V > operator++(int)
+ PairIteratorT< K, V > operator ++(int)
{
PairIteratorT< K, V > tempIter = *this;
- operator++();
+ operator ++();
return tempIter;
}
* else @c false
* @param[in] rhs A reference to the %PairIteratorT instance on the right-hand side of the operator
*/
- bool operator==(const PairIteratorT< K, V >& rhs) const
+ bool operator ==(const PairIteratorT< K, V >& rhs) const
{
if (__pMap != rhs.__pMap)
{
* else @c false
* @param[in] rhs A reference to the %PairIteratorT instance on the right-hand side of the operator
*/
- bool operator!=(const PairIteratorT< K, V >& rhs) const
+ bool operator !=(const PairIteratorT< K, V >& rhs) const
{
- return !operator==(rhs);
+ return !operator ==(rhs);
}
/**
int __index;
std::unique_ptr< IMapEnumerator > __pEnum;
std::pair< K, V > __currentObj;
-}; // PairIteratorT
+}; // PairIteratorT
}}} // Tizen::Base::Collection