BDE 4.14.0 Production release
|
#include <bsltf_argumenttype.h>
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. | |
ArgumentType & | operator= (ArgumentType &rhs) |
ArgumentType & | operator= (ArgumentType const &rhs) |
ArgumentType & | operator= (bslmf::MovableRef< ArgumentType > rhs) |
ArgumentType & | operator= (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) |
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.
|
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.
|
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.
|
inline |
|
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.
|
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).
|
inline |
|
inline |
|
inline |
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.
|
inline |
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.
|
inline |
|
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.
|
inline |
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).
|
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.
|
inline |
|
inline |
|
friend |
Return the copy/move state of the specified obj
. This function is an ADL customization point used by CopyMoveState::get(obj)
.