BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsltf::ArgumentType< N > Class Template Reference

#include <bsltf_argumenttype.h>

Inheritance diagram for bsltf::ArgumentType< N >:
bsltf::ArgumentTypeByValue< N >

Public Member Functions

 ArgumentType (ArgumentTypeDefault=ArgumentTypeDefault())
 
 ArgumentType (int value)
 
 ArgumentType (ArgumentType &original)
 
 ArgumentType (ArgumentType const &original)
 
 ArgumentType (bslmf::MovableRef< ArgumentType > original)
 
 ~ArgumentType ()
 Destroy this object.
 
ArgumentTypeoperator= (ArgumentType &rhs)
 
ArgumentTypeoperator= (ArgumentType const &rhs)
 
ArgumentTypeoperator= (bslmf::MovableRef< ArgumentType > rhs)
 
ArgumentTypeoperator= (int rhs)
 
void reset ()
 
void set (int value, CopyMoveState::Enum state)
 Set this object to the default-constructed state.
 
 operator int () const
 Return the value of this object.
 
CopyMoveState::Enum copyMoveState () const
 Return the copy/move state of this object.
 
MoveState::Enum movedFrom () const
 
MoveState::Enum movedInto () const
 

Friends

CopyMoveState::Enum copyMoveState (const ArgumentType &obj)
 

Detailed Description

template<int N>
class bsltf::ArgumentType< N >

This class template wraps an integer value and provides implicit conversion to, and explicit conversion from, int, while keeping track of copy and move operations. Its main purpose is for following an argument through a forwarding interface in test drivers. Each value of the template parameter N yields a unique type, enabling a test driver to distingusih them when calling through a function template interface, thereby avoiding ambiguities or accidental switching of arguments in the implementation of test-class methods and constructors or in calls to methods and constructors of a class template under test. When an object of this type is copied or moved (via construction or assignment), the value returned by the copyMoveState accessor (the copy/move state), is updated for the target object and, in the case of a move, for the source object as well.

See bsltf_argumenttype

Constructor & Destructor Documentation

◆ ArgumentType() [1/5]

template<int N>
bsltf::ArgumentType< N >::ArgumentType ( ArgumentTypeDefault  = ArgumentTypeDefault())
inline

Create an ArgumentType object having the default attribute value -1. Upon return from this constructor, the copyMoveState accessor will return e_ORIGINAL, indicating that this object holds an original value, not moved or copied from another object.

◆ ArgumentType() [2/5]

template<int N>
bsltf::ArgumentType< N >::ArgumentType ( int  value)
inlineexplicit

Create an ArgumentType object having the specified value. Upon return from this constructor, the copyMoveState accessor will return e_ORIGINAL, indicating that this object holds an original value, not moved or copied from another object. The behavior is undefined unless value is non-negative.

◆ ArgumentType() [3/5]

template<int N>
bsltf::ArgumentType< N >::ArgumentType ( ArgumentType< N > &  original)
inline

◆ ArgumentType() [4/5]

template<int N>
bsltf::ArgumentType< N >::ArgumentType ( ArgumentType< N > const &  original)
inline

Create an ArgumentType object having the same value as the specified original. Upon return from this constructor, the copyMoveState accessor will return either e_COPIED_FROM_NONCONST or e_COPIED_FROM_CONST reflecting the constness of original. The object referred to by original is unchanged regardless of its constness.

◆ ArgumentType() [5/5]

template<int N>
bsltf::ArgumentType< N >::ArgumentType ( bslmf::MovableRef< ArgumentType< N > >  original)
inline

Create an ArgumentType object having the same value as the specified original. Upon return from this constructor, the integral value of original will be unspecified, the value of this->copyMoveState() will be e_MOVED_INTO, and the value of original->copyMoveState() will have its e_MOVED_FROM bit set (unless it started as 'e_UNKNOWN).

◆ ~ArgumentType()

template<int N>
bsltf::ArgumentType< N >::~ArgumentType ( )
inline

Member Function Documentation

◆ copyMoveState()

template<int N>
CopyMoveState::Enum bsltf::ArgumentType< N >::copyMoveState ( ) const
inline

◆ movedFrom()

template<int N>
MoveState::Enum bsltf::ArgumentType< N >::movedFrom ( ) const
inline
Deprecated:
Use CopyMoveState::isMovedFrom instead. Return MoveState::e_MOVED if this object was the source of a move construction or move-assignment operation, MoveState::e_NOT_MOVED if it was not the source of a move operation, and MoveState::e_UNKNOWN if its copy/move state is not known. Note that converting the result to bool will yield true if this object was moved from and false otherwise. Note also that the value returned by this accessor may change if this object is subsequently the target of an assignment.

◆ movedInto()

template<int N>
MoveState::Enum bsltf::ArgumentType< N >::movedInto ( ) const
inline
Deprecated:
Use CopyMoveState::isMovedInto instead. Return MoveState::e_MOVED if this object was the target of a move construction or move-assignment operation, MoveState::e_NOT_MOVED if it was not the target of a move operation, and MoveState::e_UNKNOWN if its copy/move state is not known. Note that converting the result to bool will yield true if this object was moved into and false otherwise. Note that the value returned by this accessor may change if this object is subsequently the source of a move operation or the target of an assignment.

◆ operator int()

template<int N>
bsltf::ArgumentType< N >::operator int ( ) const
inline

◆ operator=() [1/4]

template<int N>
ArgumentType< N > & bsltf::ArgumentType< N >::operator= ( ArgumentType< N > &  rhs)
inline

Assign to this object the value of the specified rhs object and return a reference providing modifiable access to this object. After the assignment, the copyMoveState accessor will return either e_COPIED_FROM_NONCONST or e_COPIED_FROM_CONST reflecting the constness of original. The object referred to by rhs is unchanged regardless of its constness.

◆ operator=() [2/4]

template<int N>
ArgumentType< N > & bsltf::ArgumentType< N >::operator= ( ArgumentType< N > const &  rhs)
inline

◆ operator=() [3/4]

template<int N>
ArgumentType & bsltf::ArgumentType< N >::operator= ( bslmf::MovableRef< ArgumentType< N > >  rhs)

Assign to this object the value of the specified rhs object and return a reference providing modifiable access to this object. After the assignment, the integral value of rhs will be unspecified, the value of this->copyMoveState() will be e_MOVED_INTO, and the value of rhs->copyMoveState() will have its e_MOVED_FROM bit set (unless it started as 'e_UNKNOWN).

◆ operator=() [4/4]

template<int N>
ArgumentType< N > & bsltf::ArgumentType< N >::operator= ( int  rhs)
inline

Assign to this object the specified rhs and return a reference providing modifiable access to this object. After the assignment, the copyMoveState accessor will return e_ORIGINAL, indicating that this object holds an original value, not moved or copied from another object. The behavior is undefined unless value is non-negative.

◆ reset()

template<int N>
void bsltf::ArgumentType< N >::reset ( )
inline

◆ set()

template<int N>
void bsltf::ArgumentType< N >::set ( int  value,
CopyMoveState::Enum  state 
)
inline

Friends And Related Symbol Documentation

◆ copyMoveState

template<int N>
CopyMoveState::Enum copyMoveState ( const ArgumentType< N > &  obj)
friend

Return the copy/move state of the specified obj. This function is an ADL customization point used by CopyMoveState::get(obj).


The documentation for this class was generated from the following file: