NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
settings.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2014 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19
20#ifndef SETTINGS_HPP
21#define SETTINGS_HPP
22
23#include <string>
24#include <map>
25
26#ifndef RELEASE
27#include <cassert>
28#endif
29
30#include "ui/error.hpp"
32
33#define SETTING_B_DEVELOPERMODE "internal.developermode"
34#define SETTING_B_DEBUGGER "internal.debugger"
35#define SETTING_B_SYSTEMPRINTS "internal.usesystemprints"
36#define SETTING_B_DRAFTMODE "plotting.draftmode"
37#define SETTING_B_COMPACT "table.compact"
38#define SETTING_B_LOADEMPTYCOLS "table.loademptycols"
39#define SETTING_B_SHOWHINTS "ui.showhints"
40#define SETTING_B_USECUSTOMLANG "ui.usecustomlang"
41#define SETTING_B_EXTERNALDOCWINDOW "ui.externaldocwindow"
42#define SETTING_B_EXTENDEDFILEINFO "io.extendedfileinfo"
43#define SETTING_B_LOGFILE "io.logfile"
44#define SETTING_B_DEFCONTROL "io.defcontrol"
45#define SETTING_B_TABLEREFS "flowctrl.alwaysreferencetables"
46#define SETTING_B_USEESCINSCRIPTS "flowctrl.useescinscripts"
47#define SETTING_B_ENABLEEXECUTE "flowctrl.enableexecute"
48#define SETTING_B_MASKDEFAULT "flowctrl.maskdefault"
49#define SETTING_B_DECODEARGUMENTS "debugger.decodearguments"
50#define SETTING_B_GREETING "terminal.greeting"
51#define SETTING_V_PRECISION "terminal.precision"
52#define SETTING_V_WINDOW_X "terminal.windowsize.x"
53#define SETTING_V_WINDOW_Y "terminal.windowsize.y"
54#define SETTING_V_BUFFERSIZE "terminal.buffersize"
55#define SETTING_S_TERMINALFONT "terminal.font"
56#define SETTING_S_HISTORYFONT "history.font"
57#define SETTING_V_AUTOSAVE "table.autosave"
58#define SETTING_S_EXEPATH "path.exepath"
59#define SETTING_S_SAVEPATH "path.savepath"
60#define SETTING_S_LOADPATH "path.loadpath"
61#define SETTING_S_PLOTPATH "path.plotpath"
62#define SETTING_S_SCRIPTPATH "path.scriptpath"
63#define SETTING_S_PROCPATH "path.procpath"
64#define SETTING_S_WORKPATH "path.workpath"
65#define SETTING_S_PLOTFONT "plotting.plotfont"
66
67// Setting value definitions for the GUI
68#define SETTING_S_LATEXROOT "path.latexpath"
69#define SETTING_V_CARETBLINKTIME "ui.caretblinktime"
70#define SETTING_V_FOCUSEDLINE "debugger.focusedline"
71#define SETTING_B_LINESINSTACK "debugger.linenumbersinstacktrace"
72#define SETTING_B_MODULESINSTACK "debugger.modulesinstacktrace"
73#define SETTING_B_GLOBALVARS "debugger.showglobalvars"
74#define SETTING_B_PROCEDUREARGS "debugger.showarguments"
75#define SETTING_B_FLASHTASKBAR "debugger.flashtaskbar"
76#define SETTING_B_TOOLBARTEXT "ui.showtoolbartext"
77#define SETTING_B_PATHSONTABS "ui.showpathsontabs"
78#define SETTING_B_ICONSONTABS "ui.showiconsontabs"
79#define SETTING_V_POS_SASH_V "ui.position.verticalsash"
80#define SETTING_V_POS_SASH_H "ui.position.horizontalsash"
81#define SETTING_V_POS_SASH_T "ui.position.terminalsash"
82#define SETTING_S_WINDOWSIZE "ui.windowsize"
83#define SETTING_B_PRINTINCOLOR "print.usecolor"
84#define SETTING_B_PRINTLINENUMBERS "print.linenumbers"
85#define SETTING_B_SAVESESSION "save.session"
86#define SETTING_B_SAVEBOOKMARKS "save.bookmarks"
87#define SETTING_B_FORMATBEFORESAVING "save.format"
88#define SETTING_B_USEREVISIONS "save.revisions"
89#define SETTING_B_AUTOSAVEEXECUTION "save.beforeexecution"
90#define SETTING_B_SAVESASHS "save.sashs"
91#define SETTING_B_SAVEWINDOWSIZE "save.windowsize"
92#define SETTING_B_FOLDLOADEDFILE "editor.foldloadedfile"
93#define SETTING_B_HIGHLIGHTLOCALS "editor.highlightlocals"
94#define SETTING_B_USETABS "editor.usetabs"
95#define SETTING_B_LINELENGTH "editor.linelengthindicator"
96#define SETTING_B_HOMEENDCANCELS "editor.autocomp.homeendcancels"
97#define SETTING_B_BRACEAUTOCOMP "editor.autocomp.braces"
98#define SETTING_B_QUOTEAUTOCOMP "editor.autocomp.quotes"
99#define SETTING_B_BLOCKAUTOCOMP "editor.autocomp.blocks"
100#define SETTING_B_SMARTSENSE "editor.autocomp.smartsense"
101#define SETTING_S_EDITORFONT "editor.font"
102#define SETTING_B_AN_START "editor.analyzer._"
103#define SETTING_B_AN_USENOTES "editor.analyzer.usenotes"
104#define SETTING_B_AN_USEWARNINGS "editor.analyzer.usewarnings"
105#define SETTING_B_AN_USEERRORS "editor.analyzer.useerrors"
106#define SETTING_B_AN_MAGICNUMBERS "editor.analyzer.style.magicnumbers"
107#define SETTING_B_AN_UNDERSCOREARGS "editor.analyzer.style.underscoredarguments"
108#define SETTING_B_AN_THISFILE "editor.analyzer.namespace.thisfile"
109#define SETTING_B_AN_COMMENTDENS "editor.analyzer.metrics.commentdensity"
110#define SETTING_B_AN_LOC "editor.analyzer.metrics.linesofcode"
111#define SETTING_B_AN_COMPLEXITY "editor.analyzer.metrics.complexity"
112#define SETTING_B_AN_ALWAYSMETRICS "editor.analyzer.metrics.showalways"
113#define SETTING_B_AN_RESULTSUP "editor.analyzer.result.suppression"
114#define SETTING_B_AN_RESULTASS "editor.analyzer.result.assignment"
115#define SETTING_B_AN_TYPING "editor.analyzer.variables.typing"
116#define SETTING_B_AN_MISLEADINGTYPE "editor.analyzer.variables.misleadingtype"
117#define SETTING_B_AN_VARLENGTH "editor.analyzer.variables.length"
118#define SETTING_B_AN_UNUSEDVARS "editor.analyzer.variables.unused"
119#define SETTING_B_AN_GLOBALVARS "editor.analyzer.variables.globals"
120#define SETTING_B_AN_CONSTANTS "editor.analyzer.runtime.constants"
121#define SETTING_B_AN_INLINEIF "editor.analyzer.runtime.inlineif"
122#define SETTING_B_AN_PROCLENGTH "editor.analyzer.runtime.procedurelength"
123#define SETTING_B_AN_PROGRESS "editor.analyzer.runtime.progress"
124#define SETTING_B_AN_FALLTHROUGH "editor.analyzer.switch.fallthrough"
125#define SETTING_S_ST_START "editor.style._"
126#define SETTING_S_ST_STANDARD "editor.style.standard.editor"
127#define SETTING_S_ST_CONSOLESTD "editor.style.standard.terminal"
128#define SETTING_S_ST_COMMAND "editor.style.command.default"
129#define SETTING_S_ST_PROCCOMMAND "editor.style.command.procedure"
130#define SETTING_S_ST_COMMENT "editor.style.comment"
131#define SETTING_S_ST_DOCCOMMENT "editor.style.documentation.comment"
132#define SETTING_S_ST_DOCKEYWORD "editor.style.documentation.keyword"
133#define SETTING_S_ST_OPTION "editor.style.option"
134#define SETTING_S_ST_FUNCTION "editor.style.function.builtin"
135#define SETTING_S_ST_CUSTOMFUNC "editor.style.function.custom"
136#define SETTING_S_ST_CLUSTER "editor.style.cluster"
137#define SETTING_S_ST_CONSTANT "editor.style.constant"
138#define SETTING_S_ST_SPECIALVAL "editor.style.specialval"
139#define SETTING_S_ST_STRING "editor.style.string.literals"
140#define SETTING_S_ST_STRINGPARSER "editor.style.string.parser"
141#define SETTING_S_ST_INCLUDES "editor.style.includes"
142#define SETTING_S_ST_OPERATOR "editor.style.operator"
143#define SETTING_S_ST_PROCEDURE "editor.style.procedure"
144#define SETTING_S_ST_NUMBER "editor.style.number"
145#define SETTING_S_ST_METHODS "editor.style.methods"
146#define SETTING_S_ST_INSTALL "editor.style.install"
147#define SETTING_S_ST_DEFVARS "editor.style.defaultvariables"
148#define SETTING_S_ST_ACTIVELINE "editor.style.activeline"
149
150// Default color values
151#define DEFAULT_ST_STANDARD "0:0:0-255:255:255-0100"
152#define DEFAULT_ST_CONSOLESTD "0:0:100-255:255:255-0000"
153#define DEFAULT_ST_COMMAND "0:128:255-255:255:255-1011"
154#define DEFAULT_ST_PROCCOMMAND "128:0:0-255:255:255-1011"
155#define DEFAULT_ST_COMMENT "0:128:0-255:255:183-0000"
156#define DEFAULT_ST_DOCCOMMENT "0:128:192-255:255:183-1000"
157#define DEFAULT_ST_DOCKEYWORD "128:0:0-255:255:183-1000"
158#define DEFAULT_ST_OPTION "0:128:100-255:255:255-0001"
159#define DEFAULT_ST_FUNCTION "0:0:255-255:255:255-1001"
160#define DEFAULT_ST_CUSTOMFUNC "0:0:160-255:255:255-0001"
161#define DEFAULT_ST_CLUSTER "96:96:96-255:255:255-0001"
162#define DEFAULT_ST_CONSTANT "255:0:128-255:255:255-1001"
163#define DEFAULT_ST_SPECIALVAL "0:0:0-255:255:255-1001"
164#define DEFAULT_ST_STRING "128:128:255-255:255:255-0001"
165#define DEFAULT_ST_STRINGPARSER "0:128:192-255:255:255-1001"
166#define DEFAULT_ST_INCLUDES "128:0:0-255:255:255-1001"
167#define DEFAULT_ST_OPERATOR "255:0:0-255:255:255-0001"
168#define DEFAULT_ST_PROCEDURE "128:0:0-255:255:255-1001"
169#define DEFAULT_ST_NUMBER "176:150:0-255:255:255-0001"
170#define DEFAULT_ST_METHODS "0:180:50-255:255:255-1001"
171#define DEFAULT_ST_INSTALL "128:128:128-255:255:255-0001"
172#define DEFAULT_ST_DEFVARS "0:0:160-255:255:255-1101"
173#define DEFAULT_ST_ACTIVELINE "0:0:0-221:230:255-0000"
174
175
176
177/*
178 * Headerdatei zur Settings-Klasse
179 */
180
181
182
183
193{
194 public:
199 {
203 STRING
204 };
205
210 {
211 NONE = 0x0,
212 SAVE = 0x1,
213 HIDDEN = 0x2,
214 PATH = 0x4,
216 UIREFRESH = 0x10
217 };
218
219 private:
220 void* m_value;
223 size_t m_min;
224 size_t m_max;
225
234 void assign(bool value)
235 {
236 m_type = BOOL;
237 m_value = static_cast<void*>(new bool);
238 *(static_cast<bool*>(m_value)) = value;
239 }
240
249 void assign(size_t value)
250 {
251 m_type = UINT;
252 m_value = static_cast<void*>(new size_t);
253 *(static_cast<size_t*>(m_value)) = value;
254 }
255
264 void assign(const std::string& value)
265 {
266 m_type = STRING;
267 m_value = static_cast<void*>(new std::string);
268 *(static_cast<std::string*>(m_value)) = value;
269 }
270
278 void clear()
279 {
280 switch (m_type)
281 {
282 case BOOL:
283 delete (bool*)m_value;
284 break;
285 case UINT:
286 delete (size_t*)m_value;
287 break;
288 case STRING:
289 delete (std::string*)m_value;
290 break;
291 case TYPELESS:
292 break;
293 }
294
296 m_value = nullptr;
297 }
298
299 public:
305
313 explicit SettingsValue(bool value, int properties = SettingsValue::SAVE) : m_min(0), m_max(0)
314 {
315 m_valueProperties = properties;
316 assign(value);
317 }
318
330 SettingsValue(size_t value, size_t _min, size_t _max, int properties = SettingsValue::SAVE)
331 {
332 m_valueProperties = properties;
333 m_min = _min;
334 m_max = _max;
335 assign(value);
336 }
337
346 explicit SettingsValue(const char* value, int properties = SettingsValue::SAVE) : m_min(0), m_max(0)
347 {
348 m_valueProperties = properties;
349 assign(std::string(value));
350 }
351
360 SettingsValue(const std::string& value, int properties = SettingsValue::SAVE) : m_min(0), m_max(0)
361 {
362 m_valueProperties = properties;
363 assign(value);
364 }
365
371 {
372 clear();
373 }
374
384 {
385 m_valueProperties = value.m_valueProperties;
386 m_min = value.m_min;
387 m_max = value.m_max;
388
389 switch (value.m_type)
390 {
391 case BOOL:
392 assign(*(bool*)value.m_value);
393 break;
394 case UINT:
395 assign(*(size_t*)value.m_value);
396 break;
397 case STRING:
398 assign(*(std::string*)value.m_value);
399 break;
400 case TYPELESS:
401 break;
402 }
403 }
404
417 {
418 clear();
419 m_valueProperties = value.m_valueProperties;
420 m_min = value.m_min;
421 m_max = value.m_max;
422
423 switch (value.m_type)
424 {
425 case BOOL:
426 assign(*(bool*)value.m_value);
427 break;
428 case UINT:
429 assign(*(size_t*)value.m_value);
430 break;
431 case STRING:
432 assign(*(std::string*)value.m_value);
433 break;
434 case TYPELESS:
435 break;
436 }
437
438 return *this;
439 }
440
448 {
449 return m_type;
450 }
451
460 bool shallSave() const
461 {
462 return m_valueProperties & SAVE;
463 }
464
473 bool isHidden() const
474 {
475 return m_valueProperties & HIDDEN;
476 }
477
486 bool isPath() const
487 {
488#ifndef RELEASE
489 assert(m_type == STRING);
490#endif
491 return m_valueProperties & PATH;
492 }
493
501 bool isMutable() const
502 {
503 return !(m_valueProperties & (IMMUTABLE | HIDDEN));
504 }
505
514 bool isUiModifying() const
515 {
517 }
518
526 size_t min() const
527 {
528#ifndef RELEASE
529 assert(m_type == UINT);
530#endif
531 return m_min;
532 }
533
541 size_t max() const
542 {
543#ifndef RELEASE
544 assert(m_type == UINT);
545#endif
546 return m_max;
547 }
548
556 bool& active()
557 {
558#ifndef RELEASE
559 assert(m_type != TYPELESS);
560 assert(m_value != nullptr);
561 assert(m_type == BOOL);
562#endif
563 return *static_cast<bool*>(m_value);
564 }
565
573 size_t& value()
574 {
575#ifndef RELEASE
576 assert(m_type != TYPELESS);
577 assert(m_value != nullptr);
578 assert(m_type == UINT);
579#endif
580 return *static_cast<size_t*>(m_value);
581 }
582
590 std::string& stringval()
591 {
592#ifndef RELEASE
593 assert(m_type != TYPELESS);
594 assert(m_value != nullptr);
595 assert(m_type == STRING);
596#endif
597 return *static_cast<std::string*>(m_value);
598 }
599
607 bool active() const
608 {
609#ifndef RELEASE
610 assert(m_type != TYPELESS);
611 assert(m_value != nullptr);
612 assert(m_type == BOOL);
613#endif
614 return *static_cast<bool*>(m_value);
615 }
616
624 size_t value() const
625 {
626#ifndef RELEASE
627 assert(m_type != TYPELESS);
628 assert(m_value != nullptr);
629 assert(m_type == UINT);
630#endif
631 return *static_cast<size_t*>(m_value);
632 }
633
641 std::string stringval() const
642 {
643#ifndef RELEASE
644 assert(m_type != TYPELESS);
645 assert(m_value != nullptr);
646 assert(m_type == STRING);
647#endif
648 return *static_cast<std::string*>(m_value);
649 }
650
651};
652
653
654
655
656
663{
664 private:
665 std::string sSettings_ini;
666
667 // Imports of different configuration file versions
668 void import_v1x(const std::string& sSettings);
669 bool set(const std::string&);
670
671 // Helper
672 std::string replaceExePath(const std::string& _sPath);
673 void prepareFilePaths(const std::string& _sExePath);
674
675 protected:
676 std::map<std::string, SettingsValue> m_settings;
677
678 public:
679 Settings();
680 Settings(const Settings& _settings);
681
682 void copySettings(const Settings& _settings);
683
691 Settings& operator=(const Settings& _settings)
692 {
693 copySettings(_settings);
694 return *this;
695 }
696
697 // loading and saving configuration files
698 void save(const std::string& _sWhere, bool bMkBackUp = false);
699 void load(const std::string& _sWhere);
700
711 SettingsValue& getSetting(const std::string& value)
712 {
713 auto iter = m_settings.find(value);
714
715 if (iter != m_settings.end())
716 return iter->second;
717
719 }
720
731 const SettingsValue& getSetting(const std::string& value) const
732 {
733 auto iter = m_settings.find(value);
734
735 if (iter != m_settings.end())
736 return iter->second;
737
739 }
740
748 std::map<std::string, SettingsValue>& getSettings()
749 {
750 return m_settings;
751 }
752
760 const std::map<std::string, SettingsValue>& getSettings() const
761 {
762 return m_settings;
763 }
764
774 void enable(const std::string& option)
775 {
776 auto iter = m_settings.find(option);
777
778 if (iter != m_settings.end() && iter->second.getType() == SettingsValue::BOOL)
779 iter->second.active() = true;
780 }
781
791 void disable(const std::string& option)
792 {
793 auto iter = m_settings.find(option);
794
795 if (iter != m_settings.end() && iter->second.getType() == SettingsValue::BOOL)
796 iter->second.active() = false;
797 }
798
810 bool isEnabled(const std::string& option) const
811 {
812 auto iter = m_settings.find(option);
813
814 if (iter != m_settings.end() && iter->second.getType() == SettingsValue::BOOL)
815 return iter->second.active();
816
817 return false;
818 }
819
829 inline void enableSystemPrints(bool _bSystemPrints = true)
830 {
831 m_settings[SETTING_B_SYSTEMPRINTS].active() = _bSystemPrints;
832 }
833
843 inline void setDefaultPlotFont(const std::string& plotFont)
844 {
845 std::string _sPlotFont = plotFont;
846
847 if (_sPlotFont == "palatino")
848 _sPlotFont = "pagella";
849
850 if (_sPlotFont == "times")
851 _sPlotFont = "termes";
852
853 if (_sPlotFont == "bookman")
854 _sPlotFont = "bonum";
855
856 if (_sPlotFont == "avantgarde")
857 _sPlotFont = "adventor";
858
859 if (_sPlotFont == "chancery")
860 _sPlotFont = "chorus";
861
862 if (_sPlotFont == "courier")
863 _sPlotFont = "cursor";
864
865 if (_sPlotFont == "helvetica")
866 _sPlotFont = "heros";
867
868 if (_sPlotFont == "pagella"
869 || _sPlotFont == "adventor"
870 || _sPlotFont == "bonum"
871 || _sPlotFont == "chorus"
872 || _sPlotFont == "cursor"
873 || _sPlotFont == "heros"
874 || _sPlotFont == "heroscn"
875 || _sPlotFont == "schola"
876 || _sPlotFont == "termes"
877 )
878 {
879 m_settings[SETTING_S_PLOTFONT].stringval() = _sPlotFont;
880 }
881 }
882
883 // Getter wrappers
884 //
892 inline bool isDeveloperMode() const
893 {return m_settings.at(SETTING_B_DEVELOPERMODE).active();}
894
902 inline bool isDraftMode() const
903 {return m_settings.at(SETTING_B_DRAFTMODE).active();}
904
913 inline bool createCompactTables() const
914 {return m_settings.at(SETTING_B_COMPACT).active();}
915
924 inline bool showGreeting() const
925 {return m_settings.at(SETTING_B_GREETING).active();}
926
935 inline bool showHints() const
936 {return m_settings.at(SETTING_B_SHOWHINTS).active();}
937
945 inline bool useEscInScripts() const
946 {return m_settings.at(SETTING_B_USEESCINSCRIPTS).active();}
947
955 inline bool controlDefinitions() const
956 {return m_settings.at(SETTING_B_DEFCONTROL).active();}
957
966 inline bool showExtendedFileInfo() const
967 {return m_settings.at(SETTING_B_EXTENDEDFILEINFO).active();}
968
978 inline bool useLogFile() const
979 {return m_settings.at(SETTING_B_LOGFILE).active();}
980
988 inline bool loadEmptyCols() const
989 {return m_settings.at(SETTING_B_LOADEMPTYCOLS).active();}
990
1000 inline size_t getPrecision() const
1001 {return m_settings.at(SETTING_V_PRECISION).value();}
1002
1010 inline std::string getExePath() const
1011 {return m_settings.at(SETTING_S_EXEPATH).stringval();}
1012
1020 inline std::string getWorkPath() const
1021 {return m_settings.at(SETTING_S_WORKPATH).stringval();}
1022
1029 inline std::string getSavePath() const
1030 {return m_settings.at(SETTING_S_SAVEPATH).stringval();}
1031
1038 inline std::string getLoadPath() const
1039 {return m_settings.at(SETTING_S_LOADPATH).stringval();}
1040
1048 inline std::string getPlotPath() const
1049 {return m_settings.at(SETTING_S_PLOTPATH).stringval();}
1050
1058 inline std::string getScriptPath() const
1059 {return m_settings.at(SETTING_S_SCRIPTPATH).stringval();}
1060
1068 inline std::string getProcPath() const
1069 {return m_settings.at(SETTING_S_PROCPATH).stringval();}
1070
1078 inline size_t getAutoSaveInterval() const
1079 {return m_settings.at(SETTING_V_AUTOSAVE).value();}
1080
1088 inline size_t getBuffer() const
1089 {return m_settings.at(SETTING_V_BUFFERSIZE).value();}
1090
1101 inline size_t getWindow(int nWindow = 0) const
1102 {return nWindow ? m_settings.at(SETTING_V_WINDOW_Y).value()-1 : m_settings.at(SETTING_V_WINDOW_X).value()-1;}
1103
1111 inline std::string getDefaultPlotFont() const
1112 {return m_settings.at(SETTING_S_PLOTFONT).stringval();}
1113
1122 inline std::string getTokenPaths() const
1123 {
1124 return "<>="+m_settings.at(SETTING_S_EXEPATH).stringval()
1125 +";<wp>="+m_settings.at(SETTING_S_WORKPATH).stringval()
1126 +";<savepath>="+m_settings.at(SETTING_S_SAVEPATH).stringval()
1127 +";<loadpath>="+m_settings.at(SETTING_S_LOADPATH).stringval()
1128 +";<plotpath>="+m_settings.at(SETTING_S_PLOTPATH).stringval()
1129 +";<scriptpath>="+m_settings.at(SETTING_S_SCRIPTPATH).stringval()
1130 +";<procpath>="+m_settings.at(SETTING_S_PROCPATH).stringval()+";";
1131 }
1132
1140 inline bool systemPrints() const
1141 {return m_settings.at(SETTING_B_SYSTEMPRINTS).active();}
1142
1150 inline bool useDebugger() const
1151 {return m_settings.at(SETTING_B_DEBUGGER).active();}
1152
1161 inline bool useCustomLangFiles() const
1162 {return m_settings.at(SETTING_B_USECUSTOMLANG).active();}
1163
1171 inline bool useExternalDocWindow() const
1172 {return m_settings.at(SETTING_B_EXTERNALDOCWINDOW).active();}
1173
1181 inline bool executeEnabled() const
1182 {return m_settings.at(SETTING_B_ENABLEEXECUTE).active();}
1183
1192 inline bool useMaskDefault() const
1193 {return m_settings.at(SETTING_B_MASKDEFAULT).active();}
1194
1202 inline bool decodeArguments() const
1203 {return m_settings.at(SETTING_B_DECODEARGUMENTS).active();}
1204
1205};
1206
1207
1208#endif
1209
1210
This class handles the documentation index and provides lookup functionalities to obtain the correspo...
Definition: doc_helper.hpp:39
This class manages the setting values of the internal (kernel) settings of this application.
Definition: settings.hpp:663
std::string getDefaultPlotFont() const
Returns the current plotting font name.
Definition: settings.hpp:1111
std::map< std::string, SettingsValue > m_settings
Definition: settings.hpp:676
void disable(const std::string &option)
Disables a setting with boolean value type. If the setting does not have this type,...
Definition: settings.hpp:791
bool createCompactTables() const
Returns, whether tables shall be displayed in a more compact way (does nothing in the external table ...
Definition: settings.hpp:913
std::map< std::string, SettingsValue > & getSettings()
Returns a reference to the internal map of setting values.
Definition: settings.hpp:748
std::string getLoadPath() const
Returns the current loading path.
Definition: settings.hpp:1038
bool showGreeting() const
Returns, whether NumeRe shall greet the user with a funny message at application start-up.
Definition: settings.hpp:924
const std::map< std::string, SettingsValue > & getSettings() const
Returns a const reference to the internal map of setting values.
Definition: settings.hpp:760
bool useLogFile() const
Returns, whether the terminal inputs shall be protocoled in a dedicated logfile. This setting does no...
Definition: settings.hpp:978
size_t getAutoSaveInterval() const
Returns the timespan for the autosave interval in seconds.
Definition: settings.hpp:1078
bool decodeArguments() const
Returns, whether the debugger shall try to decode procedure arguments.
Definition: settings.hpp:1202
bool systemPrints() const
Returns, whether system messages shall be printed to the terminal.
Definition: settings.hpp:1140
bool executeEnabled() const
Returns, whether the user enabled the execute command.
Definition: settings.hpp:1181
void import_v1x(const std::string &sSettings)
Imports a setting value string from a v1.x configuration file.
Definition: settings.cpp:267
std::string getWorkPath() const
Returns the current working path (connected to the <wp> token).
Definition: settings.hpp:1020
bool controlDefinitions() const
Returns, whether NumeRe shall load and save custom functions automatically.
Definition: settings.hpp:955
bool useExternalDocWindow() const
Returns, whether documentations shall be displayed in external windows.
Definition: settings.hpp:1171
bool isDeveloperMode() const
Returns, whether the developer mode is currently enabled.
Definition: settings.hpp:892
std::string getSavePath() const
Returns the current saving path.
Definition: settings.hpp:1029
const SettingsValue & getSetting(const std::string &value) const
Returns a const reference to the setting value, which corresponds to the passed string....
Definition: settings.hpp:731
size_t getPrecision() const
Returns the precision for displaying floating numbers in the terminal. This value determines the numb...
Definition: settings.hpp:1000
std::string getTokenPaths() const
Returns a semicolon-separated list of the current defined path placeholders and their values.
Definition: settings.hpp:1122
std::string getProcPath() const
Returns the current procedure root import path.
Definition: settings.hpp:1068
bool showHints() const
Returns, whether the tip-of-the-day shall be displayed to the user at application start-up.
Definition: settings.hpp:935
std::string getPlotPath() const
Returns the current plotting path (plot storing location).
Definition: settings.hpp:1048
std::string sSettings_ini
Definition: settings.hpp:665
bool showExtendedFileInfo() const
Returns, whether the file tree or the terminal file explorer shall display extended file information ...
Definition: settings.hpp:966
std::string getExePath() const
Returns the current application root folder path.
Definition: settings.hpp:1010
Settings & operator=(const Settings &_settings)
Assignment operator overload.
Definition: settings.hpp:691
Settings()
Settings class default constructor. Creates and fills the internal setting value map with their defau...
Definition: settings.cpp:39
SettingsValue & getSetting(const std::string &value)
Returns a reference to the setting value, which corresponds to the passed string. Throws an exception...
Definition: settings.hpp:711
void enableSystemPrints(bool _bSystemPrints=true)
Enables or disables the system printing functionality. This is a convenience wrapper for the direct m...
Definition: settings.hpp:829
void prepareFilePaths(const std::string &_sExePath)
This member function is a helper, which will replace the <> path token in all default file paths with...
Definition: settings.cpp:574
bool set(const std::string &)
Imports a setting value from a v0.9x configuration file.
Definition: settings.cpp:306
size_t getWindow(int nWindow=0) const
Returns the current window size of the terminal.
Definition: settings.hpp:1101
void copySettings(const Settings &_settings)
This member function is an alias for the assignment operator overload.
Definition: settings.cpp:740
void setDefaultPlotFont(const std::string &plotFont)
Update the default plotting font. This member function evaluates first, whether the selected font act...
Definition: settings.hpp:843
bool isDraftMode() const
Returns, whether the plotting draft mode is enabled.
Definition: settings.hpp:902
bool useCustomLangFiles() const
Returns, whether user language files shall be used to override internal language strings.
Definition: settings.hpp:1161
bool useMaskDefault() const
Returns, whether loop flow control statements shall use the mask option automatically.
Definition: settings.hpp:1192
std::string getScriptPath() const
Returns the current script import folder path.
Definition: settings.hpp:1058
std::string replaceExePath(const std::string &_sPath)
This member function is a helper, which will replace the executable path part in the passed file path...
Definition: settings.cpp:552
bool loadEmptyCols() const
Returns, whether NumeRe shall keep empty columns when loading a file to memory.
Definition: settings.hpp:988
void enable(const std::string &option)
Enables a setting with boolean value type. If the setting does not have this type,...
Definition: settings.hpp:774
bool useDebugger() const
Returns, whether the debugger is currently active.
Definition: settings.hpp:1150
void load(const std::string &_sWhere)
Opens the configuration file, identifies its version and imports the setting values.
Definition: settings.cpp:607
size_t getBuffer() const
Returns the current terminal buffer size.
Definition: settings.hpp:1088
bool useEscInScripts() const
Returns, whether ESC key presses shall be handled, when scripts are being executed.
Definition: settings.hpp:945
bool isEnabled(const std::string &option) const
Returns true, if the setting with boolean value type is enabled, false otherwise. If the setting does...
Definition: settings.hpp:810
void save(const std::string &_sWhere, bool bMkBackUp=false)
Saves the setting values to the corresponding config file. Does only save the setting values,...
Definition: settings.cpp:187
This class represents a single abstract settings value implemented as void*. We're using asserts to a...
Definition: settings.hpp:193
void * m_value
Definition: settings.hpp:220
SettingsValue(size_t value, size_t _min, size_t _max, int properties=SettingsValue::SAVE)
Create a setting value from an unsigned integer and define its minimal and maximal possible values.
Definition: settings.hpp:330
size_t m_max
Definition: settings.hpp:224
size_t value() const
Returns the value of an unsigned int value type setting.
Definition: settings.hpp:624
bool shallSave() const
Returns, whether this is a setting value, which shall be saved to the configuration file.
Definition: settings.hpp:460
SettingsValue(const char *value, int properties=SettingsValue::SAVE)
Create a setting value from a const char*, represented as a std::string internally.
Definition: settings.hpp:346
bool active() const
Returns the value of a boolean value type setting.
Definition: settings.hpp:607
void clear()
Clear the internal memory (called by the destructor, for example).
Definition: settings.hpp:278
bool isHidden() const
Returns, whether this setting value is an internal-only setting and should not be presented to and mo...
Definition: settings.hpp:473
size_t max() const
Returns the maximal value of an unsigned int value type.
Definition: settings.hpp:541
SettingsValue & operator=(const SettingsValue &value)
Assignment operator overload. Clears the contents of the assignee and takes the value and the type of...
Definition: settings.hpp:416
bool isMutable() const
Returns, whether this setting value is mutable by the user in the terminal.
Definition: settings.hpp:501
void assign(bool value)
Assign a new boolean value to the internal memory.
Definition: settings.hpp:234
~SettingsValue()
Destructor. Will free the allocated memory.
Definition: settings.hpp:370
SettingsValueType m_type
Definition: settings.hpp:221
size_t m_min
Definition: settings.hpp:223
void assign(size_t value)
Assign a new unsigned int value to the internal memory.
Definition: settings.hpp:249
SettingsValue(const std::string &value, int properties=SettingsValue::SAVE)
Create a setting value from a std::string.
Definition: settings.hpp:360
std::string stringval() const
Returns the value of a std::string value type setting.
Definition: settings.hpp:641
bool & active()
Returns a reference to a boolean value type setting.
Definition: settings.hpp:556
SettingsValueType
The type of the setting value.
Definition: settings.hpp:199
SettingsValue(const SettingsValue &value)
Copy constructor. Creates a new instance and copies all contents. (Does not copy the pointers themsel...
Definition: settings.hpp:383
size_t & value()
Returns a reference to an unsigned int value type setting.
Definition: settings.hpp:573
bool isPath() const
Returns, whether this setting value represents a file path and a corresponding validation is necessar...
Definition: settings.hpp:486
int m_valueProperties
Definition: settings.hpp:222
SettingsValue(bool value, int properties=SettingsValue::SAVE)
Create a setting value from a boolean.
Definition: settings.hpp:313
std::string & stringval()
Returns a reference to a std::string value type setting.
Definition: settings.hpp:590
void assign(const std::string &value)
Assign a new std::string value to the internal memory.
Definition: settings.hpp:264
SettingsValue()
Default constructor. Creates an empty and typeless setting value.
Definition: settings.hpp:304
SettingsValueProperties
Additional setting value properties.
Definition: settings.hpp:210
size_t min() const
Returns the minimal value of an unsigned int value type.
Definition: settings.hpp:526
bool isUiModifying() const
Returns true, when a setting modifies the graphical user interface and therefore needs to refresh it.
Definition: settings.hpp:514
SettingsValueType getType() const
Get the internal value type.
Definition: settings.hpp:447
Common exception class for all exceptions thrown in NumeRe.
Definition: error.hpp:32
@ INVALID_SETTING
Definition: error.hpp:138
#define SETTING_V_PRECISION
Definition: settings.hpp:51
#define SETTING_B_GREETING
Definition: settings.hpp:50
#define SETTING_B_MASKDEFAULT
Definition: settings.hpp:48
#define SETTING_S_PLOTFONT
Definition: settings.hpp:65
#define SETTING_V_AUTOSAVE
Definition: settings.hpp:57
#define SETTING_S_PROCPATH
Definition: settings.hpp:63
#define SETTING_B_COMPACT
Definition: settings.hpp:37
#define SETTING_B_EXTERNALDOCWINDOW
Definition: settings.hpp:41
#define SETTING_B_LOADEMPTYCOLS
Definition: settings.hpp:38
#define SETTING_S_EXEPATH
Definition: settings.hpp:58
#define SETTING_V_WINDOW_X
Definition: settings.hpp:52
#define SETTING_B_DEVELOPERMODE
Definition: settings.hpp:33
#define SETTING_B_USECUSTOMLANG
Definition: settings.hpp:40
#define SETTING_S_LOADPATH
Definition: settings.hpp:60
#define SETTING_B_EXTENDEDFILEINFO
Definition: settings.hpp:42
#define SETTING_B_USEESCINSCRIPTS
Definition: settings.hpp:46
#define SETTING_V_BUFFERSIZE
Definition: settings.hpp:54
#define SETTING_B_DECODEARGUMENTS
Definition: settings.hpp:49
#define SETTING_V_WINDOW_Y
Definition: settings.hpp:53
#define SETTING_S_SAVEPATH
Definition: settings.hpp:59
#define SETTING_B_SYSTEMPRINTS
Definition: settings.hpp:35
#define SETTING_B_ENABLEEXECUTE
Definition: settings.hpp:47
#define SETTING_B_DRAFTMODE
Definition: settings.hpp:36
#define SETTING_B_DEFCONTROL
Definition: settings.hpp:44
#define SETTING_S_WORKPATH
Definition: settings.hpp:64
#define SETTING_B_DEBUGGER
Definition: settings.hpp:34
#define SETTING_S_PLOTPATH
Definition: settings.hpp:61
#define SETTING_B_SHOWHINTS
Definition: settings.hpp:39
#define SETTING_S_SCRIPTPATH
Definition: settings.hpp:62
#define SETTING_B_LOGFILE
Definition: settings.hpp:43