Audacity 3.2.0
Classes | Typedefs | Functions
LV2Utils.h File Reference

RAII for lv2 resources. More...

#include <memory>
#include <wx/string.h>
#include "lilv/lilv.h"
Include dependency graph for LV2Utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Lilv_deleter< Type, f >
 Generate deleter classes for smart pointers to lv2 resources. More...
 

Typedefs

template<typename Type , void(*)(Type *) f>
using Lilv_ptr = std::unique_ptr< Type, Lilv_deleter< Type, f > >
 Generate classes of smart pointers to lv2 resources. More...
 
using LilvCharsPtr = Lilv_ptr< char, free_chars >
 
using LilvNodePtr = Lilv_ptr< LilvNode, lilv_node_free >
 

Functions

static void free_chars (char *p)
 
wxString LilvString (const LilvNode *node)
 
wxString LilvStringMove (LilvNode *node)
 

Detailed Description

RAII for lv2 resources.


Audacity: A Digital Audio Editor

Paul Licameli split from LV2Symbols.h

Definition in file LV2Utils.h.

Typedef Documentation

◆ Lilv_ptr

template<typename Type , void(*)(Type *) f>
using Lilv_ptr = std::unique_ptr<Type, Lilv_deleter<Type, f> >

Generate classes of smart pointers to lv2 resources.

Definition at line 26 of file LV2Utils.h.

◆ LilvCharsPtr

Definition at line 29 of file LV2Utils.h.

◆ LilvNodePtr

using LilvNodePtr = Lilv_ptr<LilvNode, lilv_node_free>

A smart pointer to LilvNode, which is essentially a variant type much used in the lv2 API

Definition at line 33 of file LV2Utils.h.

Function Documentation

◆ free_chars()

static void free_chars ( char *  p)
inlinestatic

Definition at line 28 of file LV2Utils.h.

28{ lilv_free(p); }

◆ LilvString()

wxString LilvString ( const LilvNode *  node)
inline

Use when lilv.h comments "must not be freed" or we use the node elsewhere, or the node pointer is from iterating a LilvNodes collection

Definition at line 37 of file LV2Utils.h.

38{
39 return wxString::FromUTF8(lilv_node_as_string(node));
40};

Referenced by LV2EffectsModule::FindModulePaths(), LV2EffectBase::GetFactoryPresets(), LV2EffectBase::GetPath(), LilvStringMove(), and LV2Ports::LV2Ports().

Here is the caller graph for this function:

◆ LilvStringMove()

wxString LilvStringMove ( LilvNode *  node)
inline

Use when lilv.h comments "Returned value must be freed by the caller." We free it in this function. Name suggests C++ move semantics applied to node, but only C types used

Definition at line 45 of file LV2Utils.h.

46{
47 LilvNodePtr temp{ node };
48 wxString str = LilvString(node);
49 return str;
50};
#define str(a)
wxString LilvString(const LilvNode *node)
Definition: LV2Utils.h:37
Lilv_ptr< LilvNode, lilv_node_free > LilvNodePtr
Definition: LV2Utils.h:33

References LilvString(), and str.

Referenced by LV2FeaturesList::GetPluginSymbol(), LV2EffectBase::GetVendor(), and LV2Ports::LV2Ports().

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