Audacity 3.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AudacityHostAttributeList Class Reference
Inheritance diagram for AudacityHostAttributeList:
[legend]
Collaboration diagram for AudacityHostAttributeList:
[legend]

Public Member Functions

 AudacityHostAttributeList ()
 
virtual ~AudacityHostAttributeList ()
 
tresult PLUGIN_API setInt (AttrID aid, int64 value) SMTG_OVERRIDE
 
tresult PLUGIN_API getInt (AttrID aid, int64 &value) SMTG_OVERRIDE
 
tresult PLUGIN_API setFloat (AttrID aid, double value) SMTG_OVERRIDE
 
tresult PLUGIN_API getFloat (AttrID aid, double &value) SMTG_OVERRIDE
 
tresult PLUGIN_API setString (AttrID aid, const TChar *string) SMTG_OVERRIDE
 
tresult PLUGIN_API getString (AttrID aid, TChar *string, uint32 sizeInBytes) SMTG_OVERRIDE
 
tresult PLUGIN_API setBinary (AttrID aid, const void *data, uint32 sizeInBytes) SMTG_OVERRIDE
 
tresult PLUGIN_API getBinary (AttrID aid, const void *&data, uint32 &sizeInBytes) SMTG_OVERRIDE
 

Protected Member Functions

void removeAttrID (AttrID aid)
 

Protected Attributes

std::map< std::string, std::unique_ptr< AudacityHostAttribute > > list
 

Detailed Description

Definition at line 103 of file AudacityVst3HostApplication.cpp.

Constructor & Destructor Documentation

◆ AudacityHostAttributeList()

AudacityHostAttributeList::AudacityHostAttributeList ( )
inline

Definition at line 106 of file AudacityVst3HostApplication.cpp.

107 {
108 FUNKNOWN_CTOR
109 }

◆ ~AudacityHostAttributeList()

virtual AudacityHostAttributeList::~AudacityHostAttributeList ( )
inlinevirtual

Definition at line 111 of file AudacityVst3HostApplication.cpp.

111{ FUNKNOWN_DTOR }

Member Function Documentation

◆ getBinary()

tresult PLUGIN_API AudacityHostAttributeList::getBinary ( AttrID  aid,
const void *&  data,
uint32 &  sizeInBytes 
)
inline

Definition at line 199 of file AudacityVst3HostApplication.cpp.

200 {
201 if (!aid)
202 return kInvalidArgument;
203 auto it = list.find(aid);
204 if (it != list.end() && it->second)
205 {
206 data = it->second->binaryValue(sizeInBytes);
207 return kResultTrue;
208 }
209 sizeInBytes = 0;
210 return kResultFalse;
211 }
std::map< std::string, std::unique_ptr< AudacityHostAttribute > > list

References list.

◆ getFloat()

tresult PLUGIN_API AudacityHostAttributeList::getFloat ( AttrID  aid,
double &  value 
)
inline

Definition at line 144 of file AudacityVst3HostApplication.cpp.

145 {
146 if (!aid)
147 return kInvalidArgument;
148 auto it = list.find(aid);
149 if (it != list.end() && it->second)
150 {
151 value = it->second->floatValue();
152 return kResultTrue;
153 }
154 return kResultFalse;
155 }

References list.

◆ getInt()

tresult PLUGIN_API AudacityHostAttributeList::getInt ( AttrID  aid,
int64 &  value 
)
inline

Definition at line 122 of file AudacityVst3HostApplication.cpp.

123 {
124 if (!aid)
125 return kInvalidArgument;
126 auto it = list.find(aid);
127 if (it != list.end() && it->second)
128 {
129 value = it->second->intValue();
130 return kResultTrue;
131 }
132 return kResultFalse;
133 }

References list.

◆ getString()

tresult PLUGIN_API AudacityHostAttributeList::getString ( AttrID  aid,
TChar *  string,
uint32  sizeInBytes 
)
inline

Definition at line 168 of file AudacityVst3HostApplication.cpp.

170 {
171 if (!aid)
172 return kInvalidArgument;
173
174 auto it = list.find(aid);
175 if (it != list.end() && it->second)
176 {
177 uint32 sizeInCodeUnit = 0;
178 const TChar* _string = it->second->stringValue(sizeInCodeUnit);
179 memcpy(
180 string, _string,
181 std::min<uint32>(sizeInCodeUnit * sizeof(TChar), sizeInBytes));
182 return kResultTrue;
183 }
184
185 return kResultFalse;
186 }

References list.

◆ removeAttrID()

void AudacityHostAttributeList::removeAttrID ( AttrID  aid)
inlineprotected

Definition at line 215 of file AudacityVst3HostApplication.cpp.

216 {
217 if (!aid)
218 return;
219
220 auto it = list.find(aid);
221 if (it != list.end())
222 list.erase(it);
223 }

References list.

Referenced by setBinary(), setFloat(), setInt(), and setString().

Here is the caller graph for this function:

◆ setBinary()

tresult PLUGIN_API AudacityHostAttributeList::setBinary ( AttrID  aid,
const void *  data,
uint32  sizeInBytes 
)
inline

Definition at line 189 of file AudacityVst3HostApplication.cpp.

190 {
191 if (!aid)
192 return kInvalidArgument;
193 removeAttrID(aid);
194 list[aid] = std::make_unique<AudacityHostAttribute>(data, sizeInBytes);
195 return kResultTrue;
196 }

References list, and removeAttrID().

Here is the call graph for this function:

◆ setFloat()

tresult PLUGIN_API AudacityHostAttributeList::setFloat ( AttrID  aid,
double  value 
)
inline

Definition at line 135 of file AudacityVst3HostApplication.cpp.

136 {
137 if (!aid)
138 return kInvalidArgument;
139 removeAttrID(aid);
140 list[aid] = std::make_unique<AudacityHostAttribute>(value);
141 return kResultTrue;
142 }

References list, and removeAttrID().

Here is the call graph for this function:

◆ setInt()

tresult PLUGIN_API AudacityHostAttributeList::setInt ( AttrID  aid,
int64  value 
)
inline

Definition at line 113 of file AudacityVst3HostApplication.cpp.

114 {
115 if (!aid)
116 return kInvalidArgument;
117 removeAttrID(aid);
118 list[aid] = std::make_unique<AudacityHostAttribute>(value);
119 return kResultTrue;
120 }

References list, and removeAttrID().

Here is the call graph for this function:

◆ setString()

tresult PLUGIN_API AudacityHostAttributeList::setString ( AttrID  aid,
const TChar *  string 
)
inline

Definition at line 157 of file AudacityVst3HostApplication.cpp.

158 {
159 if (!aid)
160 return kInvalidArgument;
161 removeAttrID(aid);
162 // + 1 for the null-terminate
163 auto length = tstrlen(string);
164 list[aid] = std::make_unique<AudacityHostAttribute>(string, length + 1);
165 return kResultTrue;
166 }

References list, and removeAttrID().

Here is the call graph for this function:

Member Data Documentation

◆ list

std::map<std::string, std::unique_ptr<AudacityHostAttribute> > AudacityHostAttributeList::list
protected

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