Jamba C++ API 8.0.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
26
27using namespace Steinberg;
28using namespace VSTGUI;
29
34template<int size = 128>
36{
37public:
38 // readFromStream
39 tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const override
40 {
41 char8 str[size];
42 iStreamer.readString8(str, size);
43 str[size - 1] = 0; // making sure it is null terminated...
44 oValue = UTF8String{str};
45 return kResultOk;
46 }
47
48 // writeToStream
49 tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const override
50 {
51 oStreamer.writeString8(iValue, true);
52 return kResultOk;
53 }
54
55 // writeToStream
56 void writeToStream(ParamType const &iValue, std::ostream &oStream) const override
57 {
58 oStream << iValue;
59 }
60};
61
62}
A parameter backed by a UTF8String.
Definition GUIParamSerializers.h:36
void writeToStream(ParamType const &iValue, std::ostream &oStream) const override
Definition GUIParamSerializers.h:56
tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const override
This method should write iValue to the stream (aka serialization).
Definition GUIParamSerializers.h:49
tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const override
This method should read from the stream and populate oValue accordingly (aka deserialization).
Definition GUIParamSerializers.h:39
A vst parameter is represented by a ParamValue type which is a double in the range [0,...
Definition ParamSerializers.h:111
UTF8String ParamType
Definition ParamSerializers.h:113
Definition GUIState.h:40