Jamba C++ API 7.5.0
Loading...
Searching...
No Matches
GUIParamSerializers.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 pongasoft
3 *
4 * Licensed under the Apache License, Version 2.0 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19#pragma once
20
21#include <vstgui4/vstgui/lib/cstring.h>
22
24
25namespace pongasoft {
26namespace VST {
27namespace GUI {
28namespace Params {
29
30using namespace Steinberg;
31using namespace VSTGUI;
32
37template<int size = 128>
39{
40public:
41 // readFromStream
42 inline tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const override
43 {
44 char8 str[size];
45 iStreamer.readString8(str, size);
46 str[size - 1] = 0; // making sure it is null terminated....
47 oValue = UTF8String{str};
48 return kResultOk;
49 }
50
51 // writeToStream
52 inline tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const override
53 {
54 oStreamer.writeString8(iValue, true);
55 return kResultOk;
56 }
57
58 // writeToStream
59 void writeToStream(ParamType const &iValue, std::ostream &oStream) const override
60 {
61 oStream << iValue;
62 }
63};
64
65}
66}
67}
68}
A parameter backed by a UTF8String.
Definition GUIParamSerializers.h:39
void writeToStream(ParamType const &iValue, std::ostream &oStream) const override
Definition GUIParamSerializers.h:59
tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const override
This method should write iValue to the stream (aka serialization).
Definition GUIParamSerializers.h:52
tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const override
This method should read from the stream and populate oValue accordingly (aka deserialization).
Definition GUIParamSerializers.h:42
A vst parameter is represented by a ParamValue type which is a double in the range [0,...
Definition ParamSerializers.h:109
UTF8String ParamType
Definition ParamSerializers.h:111
Definition GUIState.h:38
Definition DrawContext.cpp:25
Definition Clock.h:24
Definition Clock.h:23