|
From: <bl...@us...> - 2003-04-28 22:18:09
|
Update of /cvsroot/cpptool/rfta/include/xtl
In directory sc8-pr-cvs1:/tmp/cvs-serv17089/include/xtl
Modified Files:
GetAtEnumerator.h
Log Message:
* added test for GetAtEnumerator
Index: GetAtEnumerator.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/xtl/GetAtEnumerator.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** GetAtEnumerator.h 28 Apr 2003 08:53:20 -0000 1.1
--- GetAtEnumerator.h 28 Apr 2003 22:17:59 -0000 1.2
***************
*** 4,10 ****
#include <xtl/Enumerator.h>
#include <xtl/EnumAdaptor.h>
- #include <xtl/Int2Type.h>
#include <xtl/Type.h>
- #include <boost/type_traits.hpp>
namespace Xtl {
--- 4,8 ----
***************
*** 18,33 ****
{
public:
! typedef GetAtEnumeratorImpl<ObjectType,EnumeratedType,Adaptor> ThisType;
! typedef ReturnType (ObjectType::*GetAtMethod)(int index) const
!
! enum {
! isIdentityAdaptor = ::boost::is_convertible<IdendityEnumAdpator<EnumeratedType>
! ,Adaptor>::value
! };
! StlEnumeratorImpl( const ObjectType &object,
! GetAtMethod getAtMethod,
! int currentIndex,
! int elementCount )
: object_( object )
, getAtMethod_( getAtMethod )
--- 16,26 ----
{
public:
! typedef GetAtEnumeratorImpl<ObjectType,EnumeratedType,ReturnType,Adaptor> ThisType;
! typedef ReturnType (ObjectType::*GetAtMethod)(int index) const;
! GetAtEnumeratorImpl( const ObjectType &object,
! GetAtMethod getAtMethod,
! int currentIndex,
! int elementCount )
: object_( object )
, getAtMethod_( getAtMethod )
***************
*** 36,44 ****
{
}
! StlEnumeratorImpl( const ObjectType &object,
! GetAtMethod getAtMethod,
! int currentIndex,
! int elementCount,
! Adaptor adaptor )
: object_( object )
, getAtMethod_( getAtMethod )
--- 29,37 ----
{
}
! GetAtEnumeratorImpl( const ObjectType &object,
! GetAtMethod getAtMethod,
! int currentIndex,
! int elementCount,
! Adaptor adaptor )
: object_( object )
, getAtMethod_( getAtMethod )
***************
*** 52,59 ****
EnumeratedType getNext()
{
! if ( currentIndex >= count_ )
throw EnumeratorError();
! return doGetNext( Int2Type<isIdentityAdaptor>() );
}
--- 45,52 ----
EnumeratedType getNext()
{
! if ( current_ >= count_ )
throw EnumeratorError();
! return adaptor_( (object_.*getAtMethod_)( current_++ ) );
}
***************
*** 65,80 ****
Ptr clone() const
{
! return Ptr( new ThisType( object_, getAtMethod_, currentIndex, elementCount, adaptor_ ) );
! }
!
! private:
! inline EnumeratedType doGetNext( Int2Type<true> )
! {
! return (object_->*getAtMethod)( current_++ );
! }
!
! inline EnumeratedType doGetNext( Int2Type<false> )
! {
! return adaptor_( (object_->*getAtMethod)( current_++ ) );
}
--- 58,62 ----
Ptr clone() const
{
! return Ptr( new ThisType( object_, getAtMethod_, current_, count_, adaptor_ ) );
}
***************
*** 92,96 ****
Enumerator<EnumeratedType>
enumGetAt( const ObjectType &object,
! EnumeratedType (ObjectType::getAtMethod)(int index) const,
int startIndex,
int elementCount )
--- 74,78 ----
Enumerator<EnumeratedType>
enumGetAt( const ObjectType &object,
! EnumeratedType (ObjectType::*getAtMethod)(int index) const,
int startIndex,
int elementCount )
***************
*** 98,102 ****
return Enumerator<EnumeratedType>(
new GetAtEnumeratorImpl<ObjectType, EnumeratedType>(
! object, getAtMethod, startIndex, count ) );
}
--- 80,84 ----
return Enumerator<EnumeratedType>(
new GetAtEnumeratorImpl<ObjectType, EnumeratedType>(
! object, getAtMethod, startIndex, elementCount ) );
}
***************
*** 107,111 ****
Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType>
enumGetAtAdapt( const ObjectType &object,
! ReturnType (ObjectType::getAtMethod)(int index) const,
int startIndex,
int elementCount,
--- 89,93 ----
Enumerator<BOOST_DEDUCED_TYPENAME Adaptor::EnumeratedType>
enumGetAtAdapt( const ObjectType &object,
! ReturnType (ObjectType::*getAtMethod)(int index) const,
int startIndex,
int elementCount,
***************
*** 115,119 ****
return Enumerator<EnumeratedType>(
new GetAtEnumeratorImpl<ObjectType, EnumeratedType, ReturnType, Adaptor>(
! object, getAtMethod, startIndex, count, adaptor ) );
}
--- 97,101 ----
return Enumerator<EnumeratedType>(
new GetAtEnumeratorImpl<ObjectType, EnumeratedType, ReturnType, Adaptor>(
! object, getAtMethod, startIndex, elementCount, adaptor ) );
}
***************
*** 124,128 ****
Enumerator<EnumeratedType>
enumGetAt( const ObjectType &object,
! ReturnType (ObjectType::getAtMethod)(int index) const,
int startIndex,
int elementCount,
--- 106,110 ----
Enumerator<EnumeratedType>
enumGetAt( const ObjectType &object,
! ReturnType (ObjectType::*getAtMethod)(int index) const,
int startIndex,
int elementCount,
|