Qx v0.5.8
Qt Extensions Library
|
The SetOnce template class acts as a container for a value that can only be set once. More...
#include <qx/core/qx-setonce.h>
Public Member Functions | |
SetOnce (T initial, const CompareEq &comp=CompareEq()) | |
bool | isSet () const |
SetOnce< T, CompareEq > & | operator= (const T &value) |
void | reset () |
const T & | value () const |
The optional CompareEq template parameter can be used to provide a custom compare-equal function object type.
|
inline |
Creates a SetOnce container that holds the initial value initial.
The container is initially unset and only holds this value until it is set.
Optionally, a custom compare-equal function can be provided through comp, which is used to determine whether or not an assigned value is different from the container's initial value.
|
inline |
Returns true
if the containers value has been set; otherwise returns false
.
|
inline |
Sets the value of the container to value, if it is different from its initial value.
Once the containers value has been set it cannot be changed again until it is reset.
|
inline |
Resets the container to its initial state.
The containers value will revert to the value specified in its constructor and will be considered unset.
|
inline |
Returns the current value of the container.