2#ifndef __ASE_PARAMETER_HH__
3#define __ASE_PARAMETER_HH__
18using ParamInitialVal =
std::variant<bool,int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,int64_t,uint64_t,float,double,const char*,std::string>;
44 static inline const String STORAGE =
":r:w:S:";
45 static inline const String STANDARD =
":r:w:S:G:";
51 bool has (
const String &key)
const;
54 String ident ()
const {
return cident; }
55 String label ()
const {
return fetch (
"label"); }
57 String unit ()
const {
return fetch (
"unit"); }
58 String hints ()
const {
return fetch (
"hints"); }
59 String blurb ()
const {
return fetch (
"blurb"); }
60 String descr ()
const {
return fetch (
"descr"); }
61 String group ()
const {
return fetch (
"group"); }
62 Value initial ()
const {
return initial_; }
63 bool has_hint (
const String &hint)
const;
64 ChoiceS choices ()
const;
65 const StringS metadata ()
const {
return metadata_; }
67 bool is_numeric ()
const;
68 bool is_choice ()
const {
return has_hint (
"choice"); }
69 bool is_text ()
const {
return has_hint (
"text"); }
70 double normalize (
double val)
const;
71 double rescale (
double t)
const;
73 double dconstrain (
const Value &value)
const;
74 void initialsync (
const Value &v);
82 static String construct_hints (
const String &hints,
const String &more,
double pmin = 0,
double pmax = 0);
83 static size_t match_choice (
const ChoiceS &choices,
const String &text);
100 void operator= (
const Param&);
Compact, deduplicating string variant for constant strings.
The Anklang C++ API namespace.
String parameter_guess_nick(const String ¶meter_label)
Create a few letter nick name from a multi word parameter label.
std::variant< bool, int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, float, double, const char *, std::string > ParamInitialVal
Initial value for parameters.
Structured initializer for Parameter.
StringS metadata
Array of "key=value" pairs.
InitialVal initial
Initial value for float, int, choice types.
String label
Preferred user interface name.
String hints
Hints for parameter handling.
String unit
Units of the values within range.
String nick
Abbreviated user interface name, usually not more than 6 characters.
ExtraVals extras
Min, max, stepping for double ranges or array of choices to select from.
String ident
Identifier used for serialization (can be derived from untranslated label).
Helper for new Parameter creation from Param initializer.
Parameter list construction helper.
Entry operator[](uint32_t id)
Slot subscription for new Parameter creation.
String group
Group to be applied to all newly inserted Parameter objects.
Structure to provide information about properties or preferences.
MinMaxStep range() const
Min, max, stepping for double ranges.
Value type used to interface with various property types.