Debian Codegraph @

sys/Preferences.h

raw symbols SCIP
1 #cxx . . $ `<file>/sys/Preferences.h`/ifndef _Preferences_h_
2 #define _Preferences_h_cxx . . $ `sys/Preferences.h:2:9`!
3 /* Preferences.h
4 *
5 * Copyright (C) 1996-2008,2011,2013,2015-2018,2022,2023,2026 Paul Boersma
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "melder.h"cxx . . $ `<file>/melder/melder.h`/
22
23 /*
24 All strings added with Preferences_addString should have the following buffer size,
25 which conveniently equals the size of the path buffer in MelderFile so that
26 file paths can be used as preferences.
27 */
28 #define Preferences_STRING_BUFFER_SIZEcxx . . $ `sys/Preferences.h:28:9`! 1+kMelder_MAXPATHcxx . . $ `melder/melder_files.h:30:9`!
29 using PrefsStringcxx . . $ PrefsString# = char32cxx . . $ char32# [Preferences_STRING_BUFFER_SIZEcxx . . $ `sys/Preferences.h:28:9`!];
30
31 void Preferences_addBytecxx . . $ Preferences_addByte(58d51ef13e0db13f). (conststring32cxx . . $ conststring32# string /* cattable */, signed char *value, signed char defaultValue);
32 void Preferences_addShortcxx . . $ Preferences_addShort(2360a2f429c4b00a). (conststring32cxx . . $ conststring32# string /* cattable */, short *value, short defaultValue);
33 void Preferences_addInt16cxx . . $ Preferences_addInt16(13680d370ad339b6). (conststring32cxx . . $ conststring32# string /* cattable */, int *value, int defaultValue);
34 void Preferences_addIntcxx . . $ Preferences_addInt(13680d370ad339b6). (conststring32cxx . . $ conststring32# string /* cattable */, int *value, int defaultValue);
35 void Preferences_addIntegercxx . . $ Preferences_addInteger(dd1501ba114a3e1c). (conststring32cxx . . $ conststring32# string /* cattable */, integercxx . . $ integer# *value, integercxx . . $ integer# defaultValue);
36 void Preferences_addUbytecxx . . $ Preferences_addUbyte(e615ba4059b6121f). (conststring32cxx . . $ conststring32# string /* cattable */, unsigned char *value, unsigned char defaultValue);
37 void Preferences_addUshortcxx . . $ Preferences_addUshort(bd0341a59737ca26). (conststring32cxx . . $ conststring32# string /* cattable */, unsigned short *value, unsigned short defaultValue);
38 void Preferences_addUintcxx . . $ Preferences_addUint(218f6575f22f80be). (conststring32cxx . . $ conststring32# string /* cattable */, unsigned int *value, unsigned int defaultValue);
39 void Preferences_addUintegercxx . . $ Preferences_addUinteger(7753ab4786252e2c). (conststring32cxx . . $ conststring32# string /* cattable */, uintegercxx . . $ uinteger# *value, uintegercxx . . $ uinteger# defaultValue);
40 void Preferences_addBoolcxx . . $ Preferences_addBool(c6ee9ad8f2803b57). (conststring32cxx . . $ conststring32# string /* cattable */, bool *value, bool defaultValue);
41 void Preferences_addDoublecxx . . $ Preferences_addDouble(bd3f288232783655). (conststring32cxx . . $ conststring32# string /* cattable */, double *value, double defaultValue);
42 void Preferences_addStringcxx . . $ Preferences_addString(ff8f0bc01bc68d7b). (conststring32cxx . . $ conststring32# string /* cattable */, char32cxx . . $ char32# *value, conststring32cxx . . $ conststring32# defaultValue);
43 void _Preferences_addEnumcxx . . $ _Preferences_addEnum(209a93335b6bcbd4). (conststring32cxx . . $ conststring32# string /* cattable */, int *value, int min, int max,
44 conststring32cxx . . $ conststring32# (*getText) (int value), int (*getValue) (conststring32cxx . . $ conststring32# text), int defaultValue);
45 #define Preferences_addEnumcxx . . $ `sys/Preferences.h:45:9`!(string, value, enumerated, defaultValue) \
46 _Preferences_addEnum (string, (int *) value, (int) enumerated::MIN, (int) enumerated::MAX, \
47 (conststring32 (*) (int)) enumerated##_getText, (enum_generic_getValue) enumerated##_getValue, (int) defaultValue)
48
49 void Preferences_read_icxx . . $ Preferences_read_i(1145552d769d7b5d). (MelderFilecxx . . $ MelderFile# file); // "_i" means: ignore errors (such as that the file doesn't exist)
50 void Preferences_write_icxx . . $ Preferences_write_i(1145552d769d7b5d). (MelderFilecxx . . $ MelderFile# file); // "_i" means: ignore errors (such as that the file cannot be written)
51
52 void Preferences_exit_optimizeByLeakingcxx . . $ Preferences_exit_optimizeByLeaking(49f6e7a06ebc5aa8). ();
53
54 /*
55 Macros for preferences that are included in Things.
56 */
57
58 #define Prefs_begincxx . . $ `sys/Preferences.h:58:9`!(Klas) \
59 public: static void f_preferences (); \
60 void v1_copyPreferencesToInstance () override;
61
62 #define Prefs_addAny_default_cxx . . $ `sys/Preferences.h:62:9`!(DefaultType,name) \
63 private: \
64 static DefaultType _classDefault_##name; \
65 virtual DefaultType _v_default_##name() const { return our _classDefault_##name; } \
66 public: \
67 DefaultType default_##name() const { return our _v_default_##name(); }
68 #define Prefs_overrideAny_default_cxx . . $ `sys/Preferences.h:68:9`!(DefaultType,name) \
69 private: \
70 static DefaultType _classDefault_##name; \
71 DefaultType _v_default_##name () const override { return our _classDefault_##name; }
72
73 #define Pref_copyPlaincxx . . $ `sys/Preferences.h:73:9`!(from,to) \
74 to = from
75 inline void Pref_copyStringcxx . . $ Pref_copyString(6c508d93c435be80). (conststring32cxx . . $ conststring32# from, mutablestring32cxx . . $ mutablestring32# to) {
76 str32ncpycxx . . $ str32ncpy(a0fb29e7f5bbd1dc). (to, from, Preferences_STRING_BUFFER_SIZEcxx . . $ `sys/Preferences.h:28:9`! - 1); \
77 to [Preferences_STRING_BUFFER_SIZEcxx . . $ `sys/Preferences.h:28:9`! - 1] = U'\0';
78 }
79
80 /*
81 The use of one _classPref_##name both for classes and for instances prevents the following two declarations in a single class:
82 ClassPrefs_addDouble (foo)
83 InstancePrefs_addDouble (foo)
84 The differential use of _v_classPref1_##name for classes and _v_classPref2_##name for instances prevents the use of
85 ClassPrefs_addDouble (foo)
86 in a base class and
87 InstancePrefs_overrideDouble (foo)
88 in a derived class (or the reverse).
89 */
90
91 #define ClassPrefs_addAny_cxx . . $ `sys/Preferences.h:91:9`!(StorageType,ArgumentType,DefaultType,name,CopyMethod) \
92 Prefs_addAny_default_ (DefaultType, name) \
93 private: \
94 static StorageType _classPref_##name; \
95 virtual StorageType & _v_classPref1_##name() const { return our _classPref_##name; } \
96 public: \
97 ArgumentType classPref_##name() const { return our _v_classPref1_##name(); } \
98 void setClassPref_##name (ArgumentType newValue) { \
99 Pref_copy##CopyMethod (newValue, our _v_classPref1_##name()); \
100 }
101 #define ClassPrefs_overrideAny_cxx . . $ `sys/Preferences.h:101:9`!(StorageType,ArgumentType,DefaultType,name) \
102 Prefs_overrideAny_default_ (DefaultType, name) \
103 private: \
104 static StorageType _classPref_##name; \
105 StorageType & _v_classPref1_##name () const override { return our _classPref_##name; }
106 #define InstancePrefs_addAny_cxx . . $ `sys/Preferences.h:106:9`!(StorageType,ArgumentType,DefaultType,name,CopyMethod) \
107 Prefs_addAny_default_ (DefaultType, name) \
108 private: \
109 static StorageType _classPref_##name; \
110 virtual StorageType & _v_classPref2_##name () const { return our _classPref_##name; } \
111 StorageType _instancePref_##name; \
112 public: \
113 ArgumentType instancePref_##name () const { return our _instancePref_##name; } \
114 void setInstancePref_##name (ArgumentType newValue) { \
115 Pref_copy##CopyMethod (newValue, our _v_classPref2_##name()); \
116 Pref_copy##CopyMethod (newValue, our _instancePref_##name); \
117 }
118 #define InstancePrefs_overrideAny_cxx . . $ `sys/Preferences.h:118:9`!(StorageType,ArgumentType,DefaultType,name) \
119 Prefs_overrideAny_default_ (DefaultType, name) \
120 private: \
121 static StorageType _classPref_##name; \
122 StorageType & _v_classPref2_##name () const override { return our _classPref_##name; }
123
124 #define ClassPrefs_addIntcxx . . $ `sys/Preferences.h:124:9`!(Klas,name,version,default) ClassPrefs_addAny_ (int, int, conststring32, name, Plain)
125 #define ClassPrefs_overrideIntcxx . . $ `sys/Preferences.h:125:9`!(Klas,name,version,default) ClassPrefs_overrideAny_ (int, int, conststring32, name)
126 #define InstancePrefs_addIntcxx . . $ `sys/Preferences.h:126:9`!(Klas,name,version,default) InstancePrefs_addAny_ (int, int, conststring32, name, Plain)
127 #define InstancePrefs_overrideIntcxx . . $ `sys/Preferences.h:127:9`!(Klas,name,version,default) InstancePrefs_overrideAny_ (int, int, conststring32, name)
128
129 #define ClassPrefs_addIntegercxx . . $ `sys/Preferences.h:129:9`!(Klas,name,version,default) ClassPrefs_addAny_ (integer, integer, conststring32, name, Plain)
130 #define ClassPrefs_overrideIntegercxx . . $ `sys/Preferences.h:130:9`!(Klas,name,version,default) ClassPrefs_overrideAny_ (integer, integer, conststring32, name)
131 #define InstancePrefs_addIntegercxx . . $ `sys/Preferences.h:131:9`!(Klas,name,version,default) InstancePrefs_addAny_ (integer, integer, conststring32, name, Plain)
132 #define InstancePrefs_overrideIntegercxx . . $ `sys/Preferences.h:132:9`!(Klas,name,version,default) InstancePrefs_overrideAny_ (integer, integer, conststring32, name)
133
134 #define ClassPrefs_addDoublecxx . . $ `sys/Preferences.h:134:9`!(Klas,name,version,default) ClassPrefs_addAny_ (double, double, conststring32, name, Plain)
135 #define ClassPrefs_overrideDoublecxx . . $ `sys/Preferences.h:135:9`!(Klas,name,version,default) ClassPrefs_overrideAny_ (double, double, conststring32, name)
136 #define InstancePrefs_addDoublecxx . . $ `sys/Preferences.h:136:9`!(Klas,name,version,default) InstancePrefs_addAny_ (double, double, conststring32, name, Plain)
137 #define InstancePrefs_overrideDoublecxx . . $ `sys/Preferences.h:137:9`!(Klas,name,version,default) InstancePrefs_overrideAny_ (double, double, conststring32, name)
138
139 #define ClassPrefs_addBoolcxx . . $ `sys/Preferences.h:139:9`!(Klas,name,version,default) ClassPrefs_addAny_ (bool, bool, bool, name, Plain)
140 #define ClassPrefs_overrideBoolcxx . . $ `sys/Preferences.h:140:9`!(Klas,name,version,default) ClassPrefs_overrideAny_ (bool, bool, bool, name)
141 #define InstancePrefs_addBoolcxx . . $ `sys/Preferences.h:141:9`!(Klas,name,version,default) InstancePrefs_addAny_ (bool, bool, bool, name, Plain)
142 #define InstancePrefs_overrideBoolcxx . . $ `sys/Preferences.h:142:9`!(Klas,name,version,default) InstancePrefs_overrideAny_ (bool, bool, bool, name)
143
144 #define ClassPrefs_addEnumcxx . . $ `sys/Preferences.h:144:9`!(Klas,name,version,kEnumerated,default) ClassPrefs_addAny_ (enum kEnumerated, enum kEnumerated, enum kEnumerated, name, Plain)
145 #define ClassPrefs_overrideEnumcxx . . $ `sys/Preferences.h:145:9`!(Klas,name,version,kEnumerated,default) ClassPrefs_overrideAny_ (enum kEnumerated, enum kEnumerated, enum kEnumerated, name)
146 #define InstancePrefs_addEnumcxx . . $ `sys/Preferences.h:146:9`!(Klas,name,version,kEnumerated,default) InstancePrefs_addAny_ (enum kEnumerated, enum kEnumerated, enum kEnumerated, name, Plain)
147 #define InstancePrefs_overrideEnumcxx . . $ `sys/Preferences.h:147:9`!(Klas,name,version,kEnumerated,default) InstancePrefs_overrideAny_ (enum kEnumerated, enum kEnumerated, enum kEnumerated, name)
148
149 #define ClassPrefs_addStringcxx . . $ `sys/Preferences.h:149:9`!(Klas,name,version,default) ClassPrefs_addAny_ (PrefsString, conststring32, conststring32, name, String)
150 #define ClassPrefs_overrideStringcxx . . $ `sys/Preferences.h:150:9`!(Klas,name,version,default) ClassPrefs_overrideAny_ (PrefsString, conststring32, conststring32, name)
151 #define InstancePrefs_addStringcxx . . $ `sys/Preferences.h:151:9`!(Klas,name,version,default) InstancePrefs_addAny_ (PrefsString, conststring32, conststring32, name, String)
152 #define InstancePrefs_overrideStringcxx . . $ `sys/Preferences.h:152:9`!(Klas,name,version,default) InstancePrefs_overrideAny_ (PrefsString, conststring32, conststring32, name)
153
154 #define Prefs_endcxx . . $ `sys/Preferences.h:154:9`!(Klas) \
155 public:
156
157 /* End of file Preferences.h */
158 #endif