8 #ifndef __VRV_OPTIONS_H__ 
    9 #define __VRV_OPTIONS_H__ 
   11 #ifdef CUSTOM_VEROVIO_OPTIONS 
   12 #include "custom_options.h" 
   21 #include "attalternates.h" 
   40 #define DEFAULT_SCALE 100 
   42 #define MAX_SCALE 1000 
   49 #define TEMP_LYRIC_LINE_SPACE 5.0 
   51 #define TEMP_KEYSIG_STEP 0.4 
   53 #define TEMP_KEYSIG_NATURAL_STEP 0.6 
   59 enum option_BREAKS { BREAKS_none = 0, BREAKS_auto, BREAKS_line, BREAKS_smart, BREAKS_encoded };
 
   61 enum option_CONDENSE { CONDENSE_none = 0, CONDENSE_auto, CONDENSE_all, CONDENSE_encoded };
 
   63 enum option_DURATION_EQ { DURATION_EQ_brevis = 0, DURATION_EQ_semibrevis, DURATION_EQ_minima };
 
   66     ELISION_regular = SMUFL_E551_lyricsElision,
 
   67     ELISION_narrow = SMUFL_E550_lyricsElisionNarrow,
 
   68     ELISION_wide = SMUFL_E552_lyricsElisionWide,
 
   69     ELISION_unicode = UNICODE_UNDERTIE
 
   72 enum option_FONT_FALLBACK { FONT_FALLBACK_Leipzig = 0, FONT_FALLBACK_Bravura };
 
   74 enum option_FOOTER { FOOTER_none = 0, FOOTER_auto, FOOTER_encoded, FOOTER_always };
 
   76 enum option_HEADER { HEADER_none = 0, HEADER_auto, HEADER_encoded };
 
   78 enum option_LIGATURE_OBL { LIGATURE_OBL_auto = 0, LIGATURE_OBL_straight, LIGATURE_OBL_curved };
 
   80 enum option_MULTIRESTSTYLE {
 
   81     MULTIRESTSTYLE_auto = 0,
 
   82     MULTIRESTSTYLE_default,
 
   84     MULTIRESTSTYLE_symbols
 
   87 enum option_SYSTEMDIVIDER { SYSTEMDIVIDER_none = 0, SYSTEMDIVIDER_auto, SYSTEMDIVIDER_left, SYSTEMDIVIDER_left_right };
 
   89 enum option_SMUFLTEXTFONT { SMUFLTEXTFONT_embedded = 0, SMUFLTEXTFONT_linked, SMUFLTEXTFONT_none };
 
   95 enum class OptionsCategory { None, Base, General, Json, Layout, Mensural, Margins, Midi, Selectors, Full };
 
  109     virtual void CopyTo(
Option *option) = 0;
 
  111     void SetKey(
const std::string &key) { m_key = key; }
 
  112     std::string GetKey()
 const { 
return m_key; }
 
  114     virtual bool SetValueBool(
bool value);
 
  115     virtual bool SetValueDbl(
double value);
 
  116     virtual bool SetValueArray(
const std::vector<std::string> &values);
 
  117     virtual bool SetValue(
const std::string &value);
 
  118     virtual std::string GetStrValue() 
const = 0;
 
  119     virtual std::string GetDefaultStrValue() 
const = 0;
 
  121     virtual void Reset() = 0;
 
  122     virtual bool IsSet() 
const = 0;
 
  124     void SetInfo(
const std::string &title, 
const std::string &description);
 
  125     std::string GetTitle()
 const { 
return m_title; }
 
  126     std::string GetDescription()
 const { 
return m_description; }
 
  128     void SetShortOption(
char shortOption, 
bool isCmdOnly);
 
  129     char GetShortOption()
 const { 
return m_shortOption; }
 
  130     bool IsCmdOnly()
 const { 
return m_isCmdOnly; }
 
  131     virtual bool IsArgumentRequired()
 const { 
return true; }
 
  147     static const std::map<int, std::string> s_condense;
 
  148     static const std::map<int, std::string> s_durationEq;
 
  149     static const std::map<int, std::string> s_elision;
 
  150     static const std::map<int, std::string> s_fontFallback;
 
  151     static const std::map<int, std::string> s_footer;
 
  152     static const std::map<int, std::string> s_header;
 
  153     static const std::map<int, std::string> s_ligatureOblique;
 
  154     static const std::map<int, std::string> s_multiRestStyle;
 
  155     static const std::map<int, std::string> s_pedalStyle;
 
  156     static const std::map<int, std::string> s_systemDivider;
 
  157     static const std::map<int, std::string> s_smuflTextFont;
 
  161     std::string m_description;
 
  183     void CopyTo(
Option *option) 
override;
 
  184     void Init(
bool defaultValue);
 
  186     bool SetValueBool(
bool value) 
override;
 
  187     bool SetValueDbl(
double value) 
override;
 
  188     bool SetValue(
const std::string &value) 
override;
 
  189     std::string GetStrValue() 
const override;
 
  190     std::string GetDefaultStrValue() 
const override;
 
  192     void Reset() 
override;
 
  193     bool IsSet() 
const override;
 
  195     bool GetValue()
 const { 
return m_value; }
 
  196     bool GetDefault()
 const { 
return m_defaultValue; }
 
  197     bool SetValue(
bool value);
 
  199     bool IsArgumentRequired()
 const override { 
return false; }
 
  222         m_defaultValue = 0.0;
 
  225         m_definitionFactor = 
false;
 
  228     void CopyTo(
Option *option) 
override;
 
  229     void Init(
double defaultValue, 
double minValue, 
double maxValue, 
bool definitionFactor = 
false);
 
  231     bool SetValueDbl(
double value) 
override;
 
  232     bool SetValue(
const std::string &value) 
override;
 
  233     std::string GetStrValue() 
const override;
 
  234     std::string GetDefaultStrValue() 
const override;
 
  236     void Reset() 
override;
 
  237     bool IsSet() 
const override;
 
  239     double GetValue() 
const;
 
  240     double GetUnfactoredValue() 
const;
 
  241     double GetDefault()
 const { 
return m_defaultValue; }
 
  242     double GetMin()
 const { 
return m_minValue; }
 
  243     double GetMax()
 const { 
return m_maxValue; }
 
  244     bool SetValue(
double value);
 
  252     double m_defaultValue;
 
  255     bool m_definitionFactor;
 
  273         m_definitionFactor = 
false;
 
  276     void CopyTo(
Option *option) 
override;
 
  277     void Init(
int defaultValue, 
int minValue, 
int maxValue, 
bool definitionFactor = 
false);
 
  279     bool SetValueDbl(
double value) 
override;
 
  280     bool SetValue(
const std::string &value) 
override;
 
  281     std::string GetStrValue() 
const override;
 
  282     std::string GetDefaultStrValue() 
const override;
 
  284     void Reset() 
override;
 
  285     bool IsSet() 
const override;
 
  287     int GetValue() 
const;
 
  288     int GetUnfactoredValue() 
const;
 
  289     int GetDefault()
 const { 
return m_defaultValue; }
 
  290     int GetMin()
 const { 
return m_minValue; }
 
  291     int GetMax()
 const { 
return m_maxValue; }
 
  292     bool SetValue(
int value);
 
  303     bool m_definitionFactor;
 
  318     void CopyTo(
Option *option) 
override;
 
  319     void Init(
const std::string &defaultValue);
 
  321     bool SetValue(
const std::string &value) 
override;
 
  322     std::string GetStrValue()
 const override { 
return m_value; }
 
  323     std::string GetDefaultStrValue()
 const override { 
return m_defaultValue; }
 
  325     std::string GetValue()
 const { 
return m_value; }
 
  326     std::string GetDefault()
 const { 
return m_defaultValue; }
 
  328     void Reset() 
override;
 
  329     bool IsSet() 
const override;
 
  337     std::string m_defaultValue;
 
  352     void CopyTo(
Option *option) 
override;
 
  355     bool SetValueArray(
const std::vector<std::string> &values) 
override;
 
  356     bool SetValue(
const std::string &value) 
override;
 
  357     std::string GetStrValue() 
const override;
 
  358     std::string GetDefaultStrValue() 
const override;
 
  360     std::vector<std::string> GetValue()
 const { 
return m_values; }
 
  361     std::vector<std::string> GetDefault()
 const { 
return m_defaultValues; }
 
  362     bool SetValue(std::vector<std::string> 
const &values);
 
  364     void Reset() 
override;
 
  365     bool IsSet() 
const override;
 
  368     std::string GetStr(
const std::vector<std::string> &values) 
const;
 
  373     std::vector<std::string> m_values;
 
  374     std::vector<std::string> m_defaultValues;
 
  389     void CopyTo(
Option *option) 
override;
 
  390     void Init(
int defaultValue, 
const std::map<int, std::string> *values);
 
  392     bool SetValue(
const std::string &value) 
override;
 
  393     std::string GetStrValue() 
const override;
 
  394     std::string GetDefaultStrValue() 
const override;
 
  396     int GetValue()
 const { 
return m_value; }
 
  397     int GetDefault()
 const { 
return m_defaultValue; }
 
  398     bool SetValue(
int value);
 
  400     std::vector<std::string> GetStrValues(
bool withoutDefault) 
const;
 
  401     std::string GetStrValuesAsStr(
bool withoutDefault) 
const;
 
  403     void Reset() 
override;
 
  404     bool IsSet() 
const override;
 
  411     const std::map<int, std::string> *m_values;
 
  428     void CopyTo(
Option *option) 
override;
 
  430     void Init(data_STAFFREL defaultValue);
 
  432     bool SetValue(
const std::string &value) 
override;
 
  433     std::string GetStrValue() 
const override;
 
  434     std::string GetDefaultStrValue() 
const override;
 
  436     void Reset() 
override;
 
  437     bool IsSet() 
const override;
 
  441     const data_STAFFREL *GetValueAlternate()
 const { 
return &m_value; }
 
  442     const data_STAFFREL *GetDefaultAlernate()
 const { 
return &m_defaultValue; }
 
  449     data_STAFFREL m_value;
 
  450     data_STAFFREL m_defaultValue;
 
  458 enum class JsonSource { String, FilePath };
 
  465     using JsonPath = std::vector<std::reference_wrapper<jsonxx::Value>>;
 
  474     void CopyTo(
Option *option) 
override;
 
  475     void Init(JsonSource source, 
const std::string &defaultValue);
 
  482     jsonxx::Object GetValue(
bool getDefault = 
false) 
const;
 
  489     std::string GetStrValue() 
const override;
 
  490     std::string GetDefaultStrValue() 
const override;
 
  492     void Reset() 
override;
 
  493     bool IsSet() 
const override;
 
  500     bool HasValue(
const std::vector<std::string> &jsonNodePath) 
const;
 
  501     int GetIntValue(
const std::vector<std::string> &jsonNodePath, 
bool getDefault = 
false) 
const;
 
  502     double GetDblValue(
const std::vector<std::string> &jsonNodePath, 
bool getDefault = 
false) 
const;
 
  503     std::string GetStrValue(
const std::vector<std::string> &jsonNodePath, 
bool getDefault = 
false) 
const;
 
  504     bool UpdateNodeValue(
const std::vector<std::string> &jsonNodePath, 
const std::string &value);
 
  512     std::set<std::string> GetKeysByNode(
const std::string &nodeName, std::list<std::string> &jsonNodePath) 
const;
 
  516     JsonPath StringPath2NodePath(
const jsonxx::Object &obj, 
const std::vector<std::string> &jsonNodePath) 
const;
 
  519     const jsonxx::Object *FindNodeByName(
 
  520         const jsonxx::Object &obj, 
const std::string &jsonNodeName, std::list<std::string> &jsonNodePath) 
const;
 
  523     bool ReadJson(jsonxx::Object &output, 
const std::string &input) 
const;
 
  526     JsonSource m_source = JsonSource::String;
 
  528     jsonxx::Object m_values;
 
  529     jsonxx::Object m_defaultValues;
 
  545     void SetLabel(
const std::string &label, 
const std::string &
id)
 
  550     std::string GetLabel()
 const { 
return m_label; }
 
  551     std::string GetId()
 const { 
return m_id; }
 
  553     void SetCategory(OptionsCategory category) { m_category = category; }
 
  554     OptionsCategory GetCategory()
 const { 
return m_category; }
 
  556     void AddOption(
Option *option) { m_options.push_back(option); }
 
  558     const std::vector<Option *> *GetOptions()
 const { 
return &m_options; }
 
  565     std::vector<Option *> m_options;
 
  566     OptionsCategory m_category = OptionsCategory::None;
 
  585     const MapOfStrOptions *GetItems()
 const { 
return &m_items; }
 
  587     const std::vector<OptionGrp *> *GetGrps()
 const { 
return &m_grps; }
 
  589     jsonxx::Object GetBaseOptGrp();
 
  591     const std::vector<Option *> *GetBaseOptions() 
const;
 
  871     MapOfStrOptions m_items;
 
  873     std::vector<OptionGrp *> m_grps;
 
This class is for array (string) styling params.
Definition: options.h:347
 
This class is for boolean styling params.
Definition: options.h:178
 
This class is for integer styling params.
Definition: options.h:217
 
This class is a base class of each styling parameter.
Definition: options.h:539
 
This class is a base class of each styling parameter.
Definition: options.h:100
 
static const std::map< int, std::string > s_breaks
Static maps used my OptionIntMap objects.
Definition: options.h:146
 
jsonxx::Object ToJson() const
Return a JSON object for the option.
 
This class is for integer styling params.
Definition: options.h:265
 
This class is for map break options.
Definition: options.h:384
 
This class is for Json input params.
Definition: options.h:464
 
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:423
 
This class is for string styling params.
Definition: options.h:313
 
This class contains the document styling parameters.
Definition: options.h:576
 
OptionGrp m_generalLayout
General layout.
Definition: options.h:683
 
OptionGrp m_baseOptions
Comments in implementation file options.cpp.
Definition: options.h:603
 
OptionGrp m_general
General.
Definition: options.h:623
 
OptionGrp m_midi
Midi.
Definition: options.h:840
 
OptionGrp m_elementMargins
Element margins.
Definition: options.h:785
 
OptionGrp m_deprecated
Deprecated options.
Definition: options.h:867
 
OptionGrp m_mensural
Mensural.
Definition: options.h:848
 
OptionGrp m_jsonCmdLineOptions
Additional options for passing method JSON options to the command-line.
Definition: options.h:860
 
OptionGrp m_selectors
Selectors.
Definition: options.h:769