2#ifndef __ASE_PROPERTIES_HH__
3#define __ASE_PROPERTIES_HH__
15 StringS get_metadata ()
const override {
return parameter_->metadata(); }
18 String label ()
const override {
return parameter_->label(); }
19 String nick ()
const override {
return parameter_->nick(); }
20 String unit ()
const override {
return parameter_->unit(); }
24 bool is_numeric ()
const override {
return parameter_->is_numeric(); }
25 ChoiceS
choices ()
const override {
return parameter_->choices(); }
34 ParameterC parameter ()
const {
return parameter_; }
35 Value initial ()
const {
return parameter_->initial(); }
36 MinMaxStep range ()
const {
return parameter_->range(); }
60 static void save_preferences ();
61 static void load_preferences (
bool autosave);
85 ChoiceS
choices ()
const override {
return lister_ ? lister_ (*
this) : parameter_->choices(); }
93 return [v] (
Value &val) {
94 if (EnumType::has_names())
96 const String &name = EnumType::get_name (*v);
112 return [v] (
const Value &val) {
114 if (val.index() == Value::STRING)
115 e = EnumType::get_value (val.as_string(), e);
116 else if (val.index() == Value::INT64)
117 e = Enum (val.as_int());
133 for (
const auto &evalue : EnumType::list_values())
135 Choice choice (evalue.second, evalue.second);
136 choices.push_back (choice);
Implementation type for classes with Event subscription.
Abstract base type for Property implementations with Parameter meta data.
double get_step() const override
Get the property value stepping, converted to double.
bool is_numeric() const override
Whether the property settings can be represented as a floating point number.
double get_min() const override
Get the minimum property value, converted to double.
String nick() const override
Abbreviated user interface name, usually not more than 6 characters.
String get_text() const override
Get the current property value, converted to a text String.
String unit() const override
Units of the values within range.
Value get_value() const override=0
Get the native property value.
String ident() const override
Unique name (per owner) of this Property.
bool set_value(const Value &v) override=0
Set the native property value.
bool set_normalized(double v) override
Set the normalized property value as double.
double get_normalized() const override
Get the normalized property value, converted to double.
bool set_text(String txt) override
Set the current property value as a text String.
double get_max() const override
Get the maximum property value, converted to double.
ChoiceS choices() const override
Enumerate choices for choosable properties.
String label() const override
Preferred user interface name.
void reset() override
Assign default as normalized property value.
Class for preference parameters (global settings)
Value get_value() const override
Get the native property value.
bool set_value(const Value &v) override
Set the native property value.
Property implementation for GadgetImpl, using lambdas as accessors.
ChoiceS choices() const override
Enumerate choices for choosable properties.
Value get_value() const override
Get the native property value.
bool set_value(const Value &v) override
Set the native property value.
A Property allows querying, setting and monitoring of an object property.
#define ASE_DEFINE_MAKE_SHARED(CLASS)
#define ASE_RETURN_UNLESS(cond,...)
Return silently if cond does not evaluate to true, with return value ...
The Anklang C++ API namespace.
uint64_t uint64
A 64-bit unsigned integer, use PRI*64 in format strings.
std::tuple< double, double, double > MinMaxStep
Min, max, stepping for double ranges.
ChoiceS enum_lister(const ParameterProperty &)
Helper to list Jsonipc::Enum<> type values as Choice.
int64_t int64
A 64-bit unsigned integer, use PRI*64 in format strings.
std::function< void(Value &)> make_enum_getter(Enum *v)
Value getter for enumeration types.
std::function< bool(const Value &)> make_enum_setter(Enum *v)
Value setter for enumeration types.
Representation of one possible choice for selection properties.
Structured initializer for Parameter.
Value type used to interface with various property types.
double as_double() const
Convert Value to double or return 0.
int64 as_int() const
Convert Value to int64 or return 0.
String as_string() const
Convert Value to a string, not very useful for RECORD or ARRAY.