|
KiCad PCB EDA Suite
|
RAII class that sets an value at construction and resets it to the original value at destruction. More...
#include <scoped_set_reset.h>
Public Member Functions | |
| SCOPED_SET_RESET (VAL_TYPE &target, VAL_TYPE value) | |
| Construct the class, set the target to the specified value, and remember the original value. | |
| SCOPED_SET_RESET (VAL_TYPE &target) | |
| Construct the class and remember the original value of the target, but without changing it immediately. | |
| ~SCOPED_SET_RESET () | |
| Destruct the class, and return the target to its original value. | |
| SCOPED_SET_RESET (SCOPED_SET_RESET const &)=delete | |
| SCOPED_SET_RESET & | operator= (SCOPED_SET_RESET const &)=delete |
Private Attributes | |
| VAL_TYPE | m_original |
| VAL_TYPE & | m_target |
RAII class that sets an value at construction and resets it to the original value at destruction.
<int>: int target = 0; SCOPED_SET_RESET targetResetter( target, 42 );
Definition at line 35 of file scoped_set_reset.h.
|
inline |
Construct the class, set the target to the specified value, and remember the original value.
Whatever the caller does with the target, it will be restored to its original value upon destruction.
Definition at line 45 of file scoped_set_reset.h.
|
inline |
Construct the class and remember the original value of the target, but without changing it immediately.
In any case, the original value will be restored upon destruction.
Definition at line 58 of file scoped_set_reset.h.
|
inline |
Destruct the class, and return the target to its original value.
Definition at line 67 of file scoped_set_reset.h.
|
delete |
|
delete |
|
private |
Definition at line 76 of file scoped_set_reset.h.
|
private |
Definition at line 77 of file scoped_set_reset.h.