Base Module: FConditionalBoolSetter Struct Reference
Author: Steinberg

Base Module VST 3.8 SDK for developing VST plug-in

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
FConditionalBoolSetter Struct Reference

Class definition for objects that help setting boolean variables. More...

`#include <fcleanup.h>`

## Public Member Functions
| FConditionalBoolSetter (bool &_toSet, bool condition)
| Constructor.
| ~FConditionalBoolSetter ()
| Destructor. Resets the at construction time passed boolean to FALSE.

## Public Attributes
bool & | toSet
| Remembers the boolean that is to be reset during destruction.

## Detailed Description

Class definition for objects that help setting boolean variables.

A stack allocated object of this type automatically sets an at construction time passed boolean variable to TRUE if the given condition is met. At the end of its own scope the stack object will reset the same boolean variable to FALSE, if it wasn't set so already.
Intended usage:

bool theBoolean = false;
{
bool creativityFirst = true;
Steinberg::FConditionalBoolSetter theCBSetter (theBoolean, creativityFirst);
// Here the constructor of theCBSetter sets theBoolean to the value of creativityFirst.
// Do something.
} // Here the destructor of theCBSetter resets theBoolean to FALSE.
Steinberg::FConditionalBoolSetter
Class definition for objects that help setting boolean variables.
Definition fcleanup.h:191

## Constructor & Destructor Documentation

## ◆ FConditionalBoolSetter()

FConditionalBoolSetter | ( | bool & | _toSet,
|  | bool | condition )
| inline

Constructor.

_toSet is a reference to the boolean that is to be set. If the in the second parameter given condition is TRUE then also _toSet is set to TRUE immediately.

## ◆ ~FConditionalBoolSetter()

~FConditionalBoolSetter | ( |  | ) |
| inline

Destructor. Resets the at construction time passed boolean to FALSE.

## Member Data Documentation

## ◆ toSet

bool& toSet

Remembers the boolean that is to be reset during destruction.

Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.