JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::ScopedValueSetter< ValueType > Class Template Reference

Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value. More...

#include "juce_ScopedValueSetter.h"

Public Member Functions

 ScopedValueSetter (ValueType &valueToSet, ValueType newValue)
 Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to its original value when this object is deleted.
 
 ScopedValueSetter (ValueType &valueToSet, ValueType newValue, ValueType valueWhenDeleted)
 Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to be valueWhenDeleted when this object is deleted.
 

Detailed Description

template<typename ValueType>
class juce::ScopedValueSetter< ValueType >

Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value.

E.g.

int x = 1;
{
// x is now 2
}
// x is now 1 again
{
// x is now 3
}
// x is now 4
Helper class providing an RAII-based mechanism for temporarily setting and then re-setting a value.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88

@tags{Core}

Definition at line 54 of file juce_ScopedValueSetter.h.

Constructor & Destructor Documentation

◆ ScopedValueSetter() [1/2]

template<typename ValueType >
juce::ScopedValueSetter< ValueType >::ScopedValueSetter ( ValueType &  valueToSet,
ValueType  newValue 
)

Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to its original value when this object is deleted.

Definition at line 60 of file juce_ScopedValueSetter.h.

◆ ScopedValueSetter() [2/2]

template<typename ValueType >
juce::ScopedValueSetter< ValueType >::ScopedValueSetter ( ValueType &  valueToSet,
ValueType  newValue,
ValueType  valueWhenDeleted 
)

Creates a ScopedValueSetter that will immediately change the specified value to the given new value, and will then reset it to be valueWhenDeleted when this object is deleted.

Definition at line 71 of file juce_ScopedValueSetter.h.

◆ ~ScopedValueSetter()

template<typename ValueType >
juce::ScopedValueSetter< ValueType >::~ScopedValueSetter ( )

Definition at line 80 of file juce_ScopedValueSetter.h.


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