Jamba C++ API  5.1.1
EnumParamConverter< Enum, MaxValue > Class Template Reference

A converter to deal with an enum (assumes that the enum is contiguous, starts at 0 and that MaxValue is the latest value in the enum). More...

#include <ParamConverters.h>

Inherits IParamConverter< Enum >.

Public Types

using ConstructorType = std::array< VstString16, MaxValue+1 > const &
 Defines the type for the constructor argument. More...
 
using IntType = std::underlying_type_t< Enum >
 
using ParamType = Enum
 
- Public Types inherited from IParamConverter< Enum >
using ParamType = Enum
 

Public Member Functions

ParamType denormalize (ParamValue iNormalizedValue) const override
 
 EnumParamConverter (IntType iToStringOffset=0)
 
 EnumParamConverter (VstString16 iFormat, IntType iToStringOffset=0)
 
 EnumParamConverter (ConstructorType iToStringValues)
 
int32 getStepCount () const override
 
ParamValue normalize (ParamType const &iDiscreteValue) const override
 
void toString (ParamType const &iValue, String128 oString, int32 iPrecision) const override
 
- Public Member Functions inherited from IParamConverter< Enum >
virtual std::string toString (ParamType const &iValue, int32 iPrecision) const
 

Private Attributes

DiscreteValueParamConverter< MaxValue, IntTypefConverter
 

Detailed Description

template<typename Enum, Enum MaxValue>
class pongasoft::VST::EnumParamConverter< Enum, MaxValue >

A converter to deal with an enum (assumes that the enum is contiguous, starts at 0 and that MaxValue is the latest value in the enum).

Note that you can also use DiscreteTypeParamConverter<Enum> instead in case your enum is not contiguous, you want to select only some values of the enum, or you want a simpler way to initialize it.

Member Typedef Documentation

◆ ConstructorType

using ConstructorType = std::array<VstString16, MaxValue + 1> const &

Defines the type for the constructor argument.

Example: { STR16("abc"), ... }

◆ IntType

using IntType = std::underlying_type_t<Enum>

◆ ParamType

using ParamType = Enum

Constructor & Destructor Documentation

◆ EnumParamConverter() [1/3]

EnumParamConverter ( IntType  iToStringOffset = 0)
inlineexplicit

◆ EnumParamConverter() [2/3]

EnumParamConverter ( VstString16  iFormat,
IntType  iToStringOffset = 0 
)
inlineexplicit

◆ EnumParamConverter() [3/3]

EnumParamConverter ( ConstructorType  iToStringValues)
inlineexplicit

Member Function Documentation

◆ denormalize()

ParamType denormalize ( ParamValue  iNormalizedValue) const
inlineoverridevirtual

◆ getStepCount()

int32 getStepCount ( ) const
inlineoverridevirtual

Reimplemented from IParamConverter< Enum >.

◆ normalize()

ParamValue normalize ( ParamType const &  iDiscreteValue) const
inlineoverridevirtual

◆ toString()

void toString ( ParamType const &  iValue,
String128  oString,
int32  iPrecision 
) const
inlineoverridevirtual

Reimplemented from IParamConverter< Enum >.

Member Data Documentation

◆ fConverter

DiscreteValueParamConverter<MaxValue, IntType> fConverter
private

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