Base Module VST 3.7 SDK for developing VST plug-in

Macros
fstdmethods.h File Reference

Convenient macros to create setter and getter methods. More...

## Macros
#define | DEFINE_VARIABLE(type, varName, methodName) DATA_MEMBER(type,varName,methodName)
#define | DEFINE_POINTER(type, varName, methodName) POINTER_MEMBER(type,varName,methodName)
#define | DEFINE_MEMBER(type, varName, methodName) CLASS_MEMBER(type,varName,methodName)
#define | COMPARE_BY_MEMBER_METHODS(className, memberName)
#define | COMPARE_BY_MEMORY_METHODS(className)
#define | COMPARE_BY_COMPARE_METHOD(className, methodName)
Methods for flags.
Macros to create setter and getter methods for flags. Usage example with DEFINE_STATE: class MyClass { public: MyClass () : flags (0) {} DEFINE_FLAG (flags, isFlagged, 1<<0) DEFINE_FLAG (flags, isMine, 1<<1) private: uint32 flags; }; void someFunction () { MyClass c; if (c.isFlagged ()) // check the flag c.isFlagged (false); // set the flag } DEFINE_FLAG #define DEFINE_FLAG(flagVar, methodName, value) Create Methods. Definition: fstdmethods.h:82
#define | DEFINE_STATE(flagVar, methodName, value)
| Create Methods with `get` and `set` prefix. More...
#define | DEFINE_GETSTATE(flagVar, methodName, value) bool get##methodName ()const { return (flagVar & (value)) != 0; }
| Create Methods with `get` prefix. More...
#define | DEFINE_FLAG(flagVar, methodName, value)
| Create Methods. More...
#define | DEFINE_GETFLAG(flagVar, methodName, value) bool methodName ()const { return (flagVar & (value)) != 0; }
| Create Methods. More...
#define | DEFINE_FLAG_STATIC(flagVar, methodName, value)
| Create `static` Methods. More...
Methods for data members.
Macros to create setter and getter methods for class members. Examples: class MyClass { public: DATA_MEMBER (double, distance, Distance) STRING_MEMBER (Steinberg::String, name, Name) SHARED_MEMBER (FUnknown, userData, UserData) CLASS_MEMBER (Steinberg::Buffer, bufferData, BufferData) POINTER_MEMBER (Steinberg::FObject, refOnly, RefOnly) }; Steinberg::Buffer Buffer. Definition: fbuffer.h:56 Steinberg::FObject Implements FUnknown and IDependent. Definition: fobject.h:84 Steinberg::String String. Definition: fstring.h:318 STRING_MEMBER #define STRING_MEMBER(type, varName, methodName) Build-in member (pass by value). Definition: fstdmethods.h:150 DATA_MEMBER #define DATA_MEMBER(type, varName, methodName) Build-in member (pass by value). Definition: fstdmethods.h:120 POINTER_MEMBER #define POINTER_MEMBER(type, varName, methodName) Build-in member (pass by value). Definition: fstdmethods.h:132 CLASS_MEMBER #define CLASS_MEMBER(type, varName, methodName) Build-in member (pass by value). Definition: fstdmethods.h:126 SHARED_MEMBER #define SHARED_MEMBER(type, varName, methodName) Build-in member (pass by value). Definition: fstdmethods.h:138
#define | DATA_MEMBER(type, varName, methodName)
| Build-in member (pass by value). More...
#define | CLASS_MEMBER(type, varName, methodName)
| Build-in member (pass by value). More...
#define | POINTER_MEMBER(type, varName, methodName)
| Build-in member (pass by value). More...
#define | SHARED_MEMBER(type, varName, methodName)
| Build-in member (pass by value). More...
#define | OWNED_MEMBER(type, varName, methodName)
| Build-in member (pass by value). More...
#define | STRING_MEMBER(type, varName, methodName)
| Build-in member (pass by value). More...
#define | STRING8_MEMBER(type, varName, methodName)
| Build-in member (pass by value). More...
#define | STRING_MEMBER_STD(varName, methodName) STRING_MEMBER(Steinberg::String,varName,methodName)
| Build-in member (pass by value). More...
#define | STRING8_MEMBER_STD(varName, methodName) STRING8_MEMBER(Steinberg::String,varName,methodName)
| Build-in member (pass by value). More...

## Detailed Description

Convenient macros to create setter and getter methods.

## Macro Definition Documentation

## ◆ DEFINE_STATE

#define DEFINE_STATE | ( |  | flagVar,
|  |  | methodName,
|  |  | value
| ) |  |

Value:
void set##methodName (bool state) { if (state) flagVar |= (value); else flagVar &= ~(value); }\
bool get##methodName ()const { return (flagVar & (value)) != 0; }

Create Methods with `get` and `set` prefix.

## ◆ DEFINE_GETSTATE

#define DEFINE_GETSTATE | ( |  | flagVar,
|  |  | methodName,
|  |  | value
| ) |  | bool get##methodName ()const { return (flagVar & (value)) != 0; }

Create Methods with `get` prefix.

There is only a 'get' method.

## ◆ DEFINE_FLAG

#define DEFINE_FLAG | ( |  | flagVar,
|  |  | methodName,
|  |  | value
| ) |  |

Value:
void methodName (bool state) { if (state) flagVar |= (value); else flagVar &= ~(value); }\
bool methodName ()const { return (flagVar & (value)) != 0; }

Create Methods.

Same name for the getter and setter.

## ◆ DEFINE_GETFLAG

#define DEFINE_GETFLAG | ( |  | flagVar,
|  |  | methodName,
|  |  | value
| ) |  | bool methodName ()const { return (flagVar & (value)) != 0; }

Create Methods.

There is only a 'get' method.

## ◆ DEFINE_FLAG_STATIC

#define DEFINE_FLAG_STATIC | ( |  | flagVar,
|  |  | methodName,
|  |  | value
| ) |  |

Value:
static void methodName (bool __state) { if (__state) flagVar |= (value); else flagVar &= ~(value); }\
static bool methodName () { return (flagVar & (value)) != 0; }

Create `static` Methods.

Same name for the getter and setter.

## ◆ DATA_MEMBER

#define DATA_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  |

Value:
public:void set##methodName (type v) { varName = v;}\
type get##methodName ()const { return varName; }\
protected: type varName; public:

Build-in member (pass by value).

## ◆ CLASS_MEMBER

#define CLASS_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  |

Value:
public:void set##methodName (const type& v){ varName = v;}\
const type& get##methodName () const { return varName; }\
protected: type varName; public:

Build-in member (pass by value).

## ◆ POINTER_MEMBER

#define POINTER_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  |

Value:
public:void set##methodName (type* ptr){ varName = ptr;}\
type* get##methodName ()const { return varName; }\
private: type* varName; public:

Build-in member (pass by value).

## ◆ SHARED_MEMBER

#define SHARED_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  |

Value:
public:void set##methodName (type* v){ varName = v;}\
type* get##methodName ()const { return varName; }\
private: IPtr<type> varName; public:

Build-in member (pass by value).

## ◆ OWNED_MEMBER

#define OWNED_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  |

Value:
public:void set##methodName (type* v){ varName = v;}\
type* get##methodName ()const { return varName; }\
private: OPtr<type> varName; public:

Build-in member (pass by value).

## ◆ STRING_MEMBER

#define STRING_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  |

Value:
public:void set##methodName (const tchar* v){ varName = v;}\
const type& get##methodName () const { return varName; }\
protected: type varName; public:

Build-in member (pass by value).

## ◆ STRING8_MEMBER

#define STRING8_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  |

Value:
public:void set##methodName (const char8* v){ varName = v;}\
const type& get##methodName () const { return varName; }\
protected: type varName; public:

Build-in member (pass by value).

## ◆ STRING_MEMBER_STD

#define STRING_MEMBER_STD | ( |  | varName,
|  |  | methodName
| ) |  | STRING_MEMBER(Steinberg::String,varName,methodName)

Build-in member (pass by value).

## ◆ STRING8_MEMBER_STD

#define STRING8_MEMBER_STD | ( |  | varName,
|  |  | methodName
| ) |  | STRING8_MEMBER(Steinberg::String,varName,methodName)

Build-in member (pass by value).

## ◆ DEFINE_VARIABLE

#define DEFINE_VARIABLE | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  | DATA_MEMBER(type,varName,methodName)

## ◆ DEFINE_POINTER

#define DEFINE_POINTER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  | POINTER_MEMBER(type,varName,methodName)

## ◆ DEFINE_MEMBER

#define DEFINE_MEMBER | ( |  | type,
|  |  | varName,
|  |  | methodName
| ) |  | CLASS_MEMBER(type,varName,methodName)

## ◆ COMPARE_BY_MEMBER_METHODS

#define COMPARE_BY_MEMBER_METHODS | ( |  | className,
|  |  | memberName
| ) |  |

Value:
bool operator == (const className& other) const {return (memberName == other.memberName);} \
bool operator != (const className& other) const {return (memberName != other.memberName);} \
bool operator < (const className& other) const {return (memberName < other.memberName);} \
bool operator > (const className& other) const {return (memberName > other.memberName);} \
bool operator <= (const className& other) const {return (memberName <= other.memberName);} \
bool operator >= (const className& other) const {return (memberName >= other.memberName);}
Steinberg::operator>=
bool operator>=(const ConstString &s1, const ConstString &s2)
Definition: fstring.h:694
Steinberg::operator!=
bool operator!=(const ConstString &s1, const ConstString &s2)
Definition: fstring.h:696
Steinberg::operator>
bool operator>(const ConstString &s1, const ConstString &s2)
Definition: fstring.h:693
Steinberg::operator<
bool operator<(const ConstString &s1, const ConstString &s2)
Definition: fstring.h:691
Steinberg::operator==
bool operator==(const ConstString &s1, const ConstString &s2)
Definition: fstring.h:695
Steinberg::operator<=
bool operator<=(const ConstString &s1, const ConstString &s2)
Definition: fstring.h:692

## ◆ COMPARE_BY_MEMORY_METHODS

#define COMPARE_BY_MEMORY_METHODS | ( |  | className | ) |

Value:
bool operator == (const className& other) const {return memcmp (this, &other, sizeof (className)) == 0;} \
bool operator != (const className& other) const {return memcmp (this, &other, sizeof (className)) != 0;} \
bool operator < (const className& other) const {return memcmp (this, &other, sizeof (className)) < 0;} \
bool operator > (const className& other) const {return memcmp (this, &other, sizeof (className)) > 0;} \
bool operator <= (const className& other) const {return memcmp (this, &other, sizeof (className)) <= 0;} \
bool operator >= (const className& other) const {return memcmp (this, &other, sizeof (className)) >= 0;}

## ◆ COMPARE_BY_COMPARE_METHOD

#define COMPARE_BY_COMPARE_METHOD | ( |  | className,
|  |  | methodName
| ) |  |

Value:
bool operator == (const className& other) const {return methodName (other) == 0;} \
bool operator != (const className& other) const {return methodName (other) != 0;} \
bool operator < (const className& other) const {return methodName (other) < 0;} \
bool operator > (const className& other) const {return methodName (other) > 0;} \
bool operator <= (const className& other) const {return methodName (other) <= 0; } \
bool operator >= (const className& other) const {return methodName (other) >= 0; }
Empty

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