JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | List of all members
juce::FromVar Class Reference

Allows converting a var to an object of arbitrary type. More...

#include "juce_JSONSerialisation.h"

Static Public Member Functions

template<typename T >
static std::optional< T > convert (const var &v)
 Attempts to convert a var to an instance of type T.
 

Detailed Description

Allows converting a var to an object of arbitrary type.

To use this, you must first ensure that the type passed to convert is set up for serialisation. For details of what this entails, see the docs for SerialisationTraits.

In short, the constant 'marshallingVersion', and either the single function 'serialise()', or the function pair 'load()' and 'save()' must be defined for the type. These may be defined as public members of the type T itself, or as public members of juce::SerialisationTraits<T>, which is a specialisation of the SerialisationTraits template struct for the type T.

See also
ToVar

@tags{Core}

Definition at line 259 of file juce_JSONSerialisation.h.

Member Function Documentation

◆ convert()

template<typename T >
static std::optional< T > juce::FromVar::convert ( const var v)
static

Attempts to convert a var to an instance of type T.

This will return a non-null optional if conversion succeeds, or nullopt if conversion fails.

Definition at line 267 of file juce_JSONSerialisation.h.


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