Audacity 3.2.0
Public Types | Public Member Functions | Public Attributes | List of all members
LV2FeaturesListBase Class Referenceabstract

#include <LV2FeaturesList.h>

Inheritance diagram for LV2FeaturesListBase:
[legend]

Public Types

using FeaturePointers = std::vector< const LV2_Feature * >
 Get vector of pointers to features, whose .data() can be passed to lv2. More...
 

Public Member Functions

 LV2FeaturesListBase (const LilvPlugin &plug)
 
virtual ~LV2FeaturesListBase ()
 
 LV2FeaturesListBase (const LV2FeaturesListBase &)=delete
 
LV2FeaturesListBaseoperator= (const LV2FeaturesListBase &)=delete
 
virtual FeaturePointers GetFeaturePointers () const =0
 
bool ValidateFeatures (const LilvNode *subject)
 
bool CheckFeatures (const LilvNode *subject, bool required)
 

Public Attributes

const LilvPlugin & mPlug
 
bool mNoResize { false }
 

Detailed Description

Abstraction of a list of features, with a check for satisfaction of requirements of a given lv2 "subject"

Definition at line 33 of file LV2FeaturesList.h.

Member Typedef Documentation

◆ FeaturePointers

using LV2FeaturesListBase::FeaturePointers = std::vector<const LV2_Feature *>

Get vector of pointers to features, whose .data() can be passed to lv2.

Definition at line 42 of file LV2FeaturesList.h.

Constructor & Destructor Documentation

◆ LV2FeaturesListBase() [1/2]

LV2FeaturesListBase::LV2FeaturesListBase ( const LilvPlugin &  plug)
explicit

Definition at line 67 of file LV2FeaturesList.cpp.

67 : mPlug{ plug }
68{
69}
const LilvPlugin & mPlug

◆ ~LV2FeaturesListBase()

LV2FeaturesListBase::~LV2FeaturesListBase ( )
virtualdefault

◆ LV2FeaturesListBase() [2/2]

LV2FeaturesListBase::LV2FeaturesListBase ( const LV2FeaturesListBase )
delete

Member Function Documentation

◆ CheckFeatures()

bool LV2FeaturesListBase::CheckFeatures ( const LilvNode *  subject,
bool  required 
)
Parameters
subjectURI of the host or of the UI identifies a resource in lv2
requiredwhether to check required or optional features of subject
Returns
true only if !required or else all required features are supported

Definition at line 133 of file LV2FeaturesList.cpp.

134{
135 using namespace LV2Symbols;
136 bool supported = true;
137 auto predicate = required ? node_RequiredFeature : node_OptionalFeature;
138 if (LilvNodesPtr nodes{
139 lilv_world_find_nodes(gWorld, subject, predicate, nullptr) }
140 ){
141 LILV_FOREACH(nodes, i, nodes.get()) {
142 const auto node = lilv_nodes_get(nodes.get(), i);
143 const auto uri = lilv_node_as_string(node);
144 if ((strcmp(uri, LV2_UI__noUserResize) == 0) ||
145 (strcmp(uri, LV2_UI__fixedSize) == 0))
146 mNoResize = true;
147 else if (strcmp(uri, LV2_WORKER__schedule) == 0) {
148 /* Supported but handled in LV2Wrapper */
149 }
150 else if (required) {
151 auto features = GetFeaturePointers();
152 const auto end = features.end();
153 supported = (end != std::find_if(features.begin(), end,
154 [&](auto &pFeature){ return pFeature &&
155 strcmp(pFeature->URI, uri) == 0; }));
156 if (!supported) {
157 wxLogError(wxT("%s requires unsupported feature %s"),
158 lilv_node_as_string(lilv_plugin_get_uri(&mPlug)), uri);
159 break;
160 }
161 }
162 }
163 }
164 return supported;
165}
wxT("CloseDown"))
Lilv_ptr< LilvNodes, lilv_nodes_free > LilvNodesPtr
virtual FeaturePointers GetFeaturePointers() const =0
LilvWorld * gWorld
Definition: LV2Symbols.cpp:31
const char * end(const char *str) noexcept
Definition: StringUtils.h:106

References details::end(), GetFeaturePointers(), LV2Symbols::gWorld, mNoResize, mPlug, and wxT().

Referenced by ValidateFeatures().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFeaturePointers()

virtual FeaturePointers LV2FeaturesListBase::GetFeaturePointers ( ) const
pure virtual

Implemented in ExtendedLV2FeaturesList, and LV2FeaturesList.

Referenced by CheckFeatures(), and ExtendedLV2FeaturesList::GetFeaturePointers().

Here is the caller graph for this function:

◆ operator=()

LV2FeaturesListBase & LV2FeaturesListBase::operator= ( const LV2FeaturesListBase )
delete

◆ ValidateFeatures()

bool LV2FeaturesListBase::ValidateFeatures ( const LilvNode *  subject)
Parameters
subjectURI of the host or of the UI identifies a resource in lv2
Returns
whether all required features of subject are supported

Definition at line 128 of file LV2FeaturesList.cpp.

129{
130 return CheckFeatures(subject, true) && CheckFeatures(subject, false);
131}
bool CheckFeatures(const LilvNode *subject, bool required)

References CheckFeatures().

Referenced by LV2UIFeaturesList::InitializeFeatures().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mNoResize

bool LV2FeaturesListBase::mNoResize { false }

Definition at line 59 of file LV2FeaturesList.h.

Referenced by CheckFeatures(), and LV2Effect::ShowClientInterface().

◆ mPlug

const LilvPlugin& LV2FeaturesListBase::mPlug

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