8 #ifndef __VRV_OPTIONS_H__
9 #define __VRV_OPTIONS_H__
11 #ifdef CUSTOM_VEROVIO_OPTIONS
12 #include "custom_options.h"
21 #include "attalternates.h"
24 #include "toolkitdef.h"
41 #define DEFAULT_SCALE 100
43 #define MAX_SCALE 1000
50 #define TEMP_LYRIC_LINE_SPACE 5.0
52 #define TEMP_KEYSIG_STEP 0.4
54 #define TEMP_KEYSIG_NATURAL_STEP 0.6
60 enum option_BREAKS { BREAKS_none = 0, BREAKS_auto, BREAKS_line, BREAKS_smart, BREAKS_encoded };
62 enum option_CONDENSE { CONDENSE_none = 0, CONDENSE_auto, CONDENSE_all, CONDENSE_encoded };
64 enum option_DURATION_EQ { DURATION_EQ_brevis = 0, DURATION_EQ_semibrevis, DURATION_EQ_minima };
67 ELISION_regular = SMUFL_E551_lyricsElision,
68 ELISION_narrow = SMUFL_E550_lyricsElisionNarrow,
69 ELISION_wide = SMUFL_E552_lyricsElisionWide,
70 ELISION_unicode = UNICODE_UNDERTIE
73 enum option_FONT_FALLBACK { FONT_FALLBACK_Leipzig = 0, FONT_FALLBACK_Bravura };
75 enum option_FOOTER { FOOTER_none = 0, FOOTER_auto, FOOTER_encoded, FOOTER_always };
77 enum option_HEADER { HEADER_none = 0, HEADER_auto, HEADER_encoded };
79 enum option_LIGATURE_OBL { LIGATURE_OBL_auto = 0, LIGATURE_OBL_straight, LIGATURE_OBL_curved };
81 enum option_MENSURAL_RESP { MENSURAL_RESP_none = 0, MENSURAL_RESP_auto, MENSURAL_RESP_selection };
83 enum option_MULTIRESTSTYLE {
84 MULTIRESTSTYLE_auto = 0,
85 MULTIRESTSTYLE_default,
87 MULTIRESTSTYLE_symbols
90 enum option_SYSTEMDIVIDER { SYSTEMDIVIDER_none = 0, SYSTEMDIVIDER_auto, SYSTEMDIVIDER_left, SYSTEMDIVIDER_left_right };
92 enum option_SMUFLTEXTFONT { SMUFLTEXTFONT_embedded = 0, SMUFLTEXTFONT_linked, SMUFLTEXTFONT_none };
98 enum class OptionsCategory { None, Base, General, Json, Layout, Mensural, Margins, Midi, Selectors, Full };
112 virtual void CopyTo(
Option *option) = 0;
114 void SetKey(
const std::string &key) { m_key = key; }
115 std::string GetKey()
const {
return m_key; }
117 virtual bool SetValueBool(
bool value);
118 virtual bool SetValueDbl(
double value);
119 virtual bool SetValueArray(
const std::vector<std::string> &values);
120 virtual bool SetValue(
const std::string &value);
121 virtual std::string GetStrValue()
const = 0;
122 virtual std::string GetDefaultStrValue()
const = 0;
124 virtual void Reset() = 0;
125 virtual bool IsSet()
const = 0;
127 void SetInfo(
const std::string &title,
const std::string &description);
128 std::string GetTitle()
const {
return m_title; }
129 std::string GetDescription()
const {
return m_description; }
131 void SetShortOption(
char shortOption,
bool isCmdOnly);
132 char GetShortOption()
const {
return m_shortOption; }
133 bool IsCmdOnly()
const {
return m_isCmdOnly; }
134 virtual bool IsArgumentRequired()
const {
return true; }
150 static const std::map<int, std::string> s_condense;
151 static const std::map<int, std::string> s_durationEq;
152 static const std::map<int, std::string> s_elision;
153 static const std::map<int, std::string> s_fontFallback;
154 static const std::map<int, std::string> s_footer;
155 static const std::map<int, std::string> s_header;
156 static const std::map<int, std::string> s_ligatureOblique;
157 static const std::map<int, std::string> s_mensuralResponsiveness;
158 static const std::map<int, std::string> s_multiRestStyle;
159 static const std::map<int, std::string> s_pedalStyle;
160 static const std::map<int, std::string> s_systemDivider;
161 static const std::map<int, std::string> s_smuflTextFont;
165 std::string m_description;
187 void CopyTo(
Option *option)
override;
188 void Init(
bool defaultValue);
190 bool SetValueBool(
bool value)
override;
191 bool SetValueDbl(
double value)
override;
192 bool SetValue(
const std::string &value)
override;
193 std::string GetStrValue()
const override;
194 std::string GetDefaultStrValue()
const override;
196 void Reset()
override;
197 bool IsSet()
const override;
199 bool GetValue()
const {
return m_value; }
200 bool GetDefault()
const {
return m_defaultValue; }
201 bool SetValue(
bool value);
203 bool IsArgumentRequired()
const override {
return false; }
226 m_defaultValue = 0.0;
229 m_definitionFactor =
false;
232 void CopyTo(
Option *option)
override;
233 void Init(
double defaultValue,
double minValue,
double maxValue,
bool definitionFactor =
false);
235 bool SetValueDbl(
double value)
override;
236 bool SetValue(
const std::string &value)
override;
237 std::string GetStrValue()
const override;
238 std::string GetDefaultStrValue()
const override;
240 void Reset()
override;
241 bool IsSet()
const override;
243 double GetValue()
const;
244 double GetUnfactoredValue()
const;
245 double GetDefault()
const {
return m_defaultValue; }
246 double GetMin()
const {
return m_minValue; }
247 double GetMax()
const {
return m_maxValue; }
248 bool SetValue(
double value);
256 double m_defaultValue;
259 bool m_definitionFactor;
277 m_definitionFactor =
false;
280 void CopyTo(
Option *option)
override;
281 void Init(
int defaultValue,
int minValue,
int maxValue,
bool definitionFactor =
false);
283 bool SetValueDbl(
double value)
override;
284 bool SetValue(
const std::string &value)
override;
285 std::string GetStrValue()
const override;
286 std::string GetDefaultStrValue()
const override;
288 void Reset()
override;
289 bool IsSet()
const override;
291 int GetValue()
const;
292 int GetUnfactoredValue()
const;
293 int GetDefault()
const {
return m_defaultValue; }
294 int GetMin()
const {
return m_minValue; }
295 int GetMax()
const {
return m_maxValue; }
296 bool SetValue(
int value);
307 bool m_definitionFactor;
322 void CopyTo(
Option *option)
override;
323 void Init(
const std::string &defaultValue);
325 bool SetValue(
const std::string &value)
override;
326 std::string GetStrValue()
const override {
return m_value; }
327 std::string GetDefaultStrValue()
const override {
return m_defaultValue; }
329 std::string GetValue()
const {
return m_value; }
330 std::string GetDefault()
const {
return m_defaultValue; }
332 void Reset()
override;
333 bool IsSet()
const override;
341 std::string m_defaultValue;
356 void CopyTo(
Option *option)
override;
359 bool SetValueArray(
const std::vector<std::string> &values)
override;
360 bool SetValue(
const std::string &value)
override;
361 std::string GetStrValue()
const override;
362 std::string GetDefaultStrValue()
const override;
364 std::vector<std::string> GetValue()
const {
return m_values; }
365 std::vector<std::string> GetDefault()
const {
return m_defaultValues; }
366 bool SetValue(std::vector<std::string>
const &values);
368 void Reset()
override;
369 bool IsSet()
const override;
372 std::string GetStr(
const std::vector<std::string> &values)
const;
377 std::vector<std::string> m_values;
378 std::vector<std::string> m_defaultValues;
393 void CopyTo(
Option *option)
override;
394 void Init(
int defaultValue,
const std::map<int, std::string> *values);
396 bool SetValue(
const std::string &value)
override;
397 std::string GetStrValue()
const override;
398 std::string GetDefaultStrValue()
const override;
400 int GetValue()
const {
return m_value; }
401 int GetDefault()
const {
return m_defaultValue; }
402 bool SetValue(
int value);
404 std::vector<std::string> GetStrValues(
bool withoutDefault)
const;
405 std::string GetStrValuesAsStr(
bool withoutDefault)
const;
407 void Reset()
override;
408 bool IsSet()
const override;
415 const std::map<int, std::string> *m_values;
432 void CopyTo(
Option *option)
override;
434 void Init(data_STAFFREL defaultValue);
436 bool SetValue(
const std::string &value)
override;
437 std::string GetStrValue()
const override;
438 std::string GetDefaultStrValue()
const override;
440 void Reset()
override;
441 bool IsSet()
const override;
445 const data_STAFFREL *GetValueAlternate()
const {
return &m_value; }
446 const data_STAFFREL *GetDefaultAlernate()
const {
return &m_defaultValue; }
453 data_STAFFREL m_value;
454 data_STAFFREL m_defaultValue;
462 enum class JsonSource { String, FilePath };
469 using JsonPath = std::vector<std::reference_wrapper<jsonxx::Value>>;
478 void CopyTo(
Option *option)
override;
479 void Init(JsonSource source,
const std::string &defaultValue);
486 jsonxx::Object GetValue(
bool getDefault =
false)
const;
493 std::string GetStrValue()
const override;
494 std::string GetDefaultStrValue()
const override;
496 void Reset()
override;
497 bool IsSet()
const override;
504 bool HasValue(
const std::vector<std::string> &jsonNodePath)
const;
505 int GetIntValue(
const std::vector<std::string> &jsonNodePath,
bool getDefault =
false)
const;
506 double GetDblValue(
const std::vector<std::string> &jsonNodePath,
bool getDefault =
false)
const;
507 std::string GetStrValue(
const std::vector<std::string> &jsonNodePath,
bool getDefault =
false)
const;
508 bool UpdateNodeValue(
const std::vector<std::string> &jsonNodePath,
const std::string &value);
516 std::set<std::string> GetKeysByNode(
const std::string &nodeName, std::list<std::string> &jsonNodePath)
const;
520 JsonPath StringPath2NodePath(
const jsonxx::Object &obj,
const std::vector<std::string> &jsonNodePath)
const;
523 const jsonxx::Object *FindNodeByName(
524 const jsonxx::Object &obj,
const std::string &jsonNodeName, std::list<std::string> &jsonNodePath)
const;
527 bool ReadJson(jsonxx::Object &output,
const std::string &input)
const;
530 JsonSource m_source = JsonSource::String;
532 jsonxx::Object m_values;
533 jsonxx::Object m_defaultValues;
549 void SetLabel(
const std::string &label,
const std::string &
id)
554 std::string GetLabel()
const {
return m_label; }
555 std::string GetId()
const {
return m_id; }
557 void SetCategory(OptionsCategory category) { m_category = category; }
558 OptionsCategory GetCategory()
const {
return m_category; }
560 void AddOption(
Option *option) { m_options.push_back(option); }
562 const std::vector<Option *> *GetOptions()
const {
return &m_options; }
569 std::vector<Option *> m_options;
570 OptionsCategory m_category = OptionsCategory::None;
589 bool SetInputFrom(std::string
const &inputFrom);
590 bool SetOutputTo(std::string
const &outputTo);
591 FileFormat GetInputFrom()
const {
return m_inputFromFormat; }
592 FileFormat GetOutputTo()
const {
return m_outputToFormat; }
594 const MapOfStrOptions *GetItems()
const {
return &m_items; }
596 const std::vector<OptionGrp *> *GetGrps()
const {
return &m_grps; }
598 jsonxx::Object GetBaseOptGrp();
600 const std::vector<Option *> *GetBaseOptions()
const;
629 FileFormat m_inputFromFormat;
630 FileFormat m_outputToFormat;
890 MapOfStrOptions m_items;
892 std::vector<OptionGrp *> m_grps;
This class is for array (string) styling params.
Definition: options.h:351
This class is for boolean styling params.
Definition: options.h:182
This class is for integer styling params.
Definition: options.h:221
This class is a base class of each styling parameter.
Definition: options.h:543
This class is a base class of each styling parameter.
Definition: options.h:103
static const std::map< int, std::string > s_breaks
Static maps used my OptionIntMap objects.
Definition: options.h:149
jsonxx::Object ToJson() const
Return a JSON object for the option.
This class is for integer styling params.
Definition: options.h:269
This class is for map break options.
Definition: options.h:388
This class is for Json input params.
Definition: options.h:468
std::set< std::string > GetKeys() const
Accessing all keys.
bool ReadJson(jsonxx::Object &output, const std::string &input) const
Read json from string or file.
JsonSource GetSource() const
Member access.
bool HasValue(const std::vector< std::string > &jsonNodePath) const
Accessing values as json node path.
bool SetValue(const std::string &value) override
Interface methods: accessing values as string.
This class is for map styling params.
Definition: options.h:427
This class is for string styling params.
Definition: options.h:317
This class contains the document styling parameters.
Definition: options.h:580
OptionGrp m_generalLayout
General layout.
Definition: options.h:695
OptionGrp m_baseOptions
Comments in implementation file options.cpp.
Definition: options.h:612
OptionGrp m_general
General.
Definition: options.h:635
OptionGrp m_midi
Midi.
Definition: options.h:858
OptionGrp m_elementMargins
Element margins.
Definition: options.h:803
OptionGrp m_deprecated
Deprecated options.
Definition: options.h:886
OptionGrp m_mensural
Mensural.
Definition: options.h:867
OptionGrp m_jsonCmdLineOptions
Additional options for passing method JSON options to the command-line.
Definition: options.h:879
OptionGrp m_selectors
Selectors.
Definition: options.h:783