prefs_install.h 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* prefs_install.h
  2. *
  3. * Copyright (C) 2013,2015-2018 Paul Boersma
  4. *
  5. * This code 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 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the 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 work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* for C++ files; see prefs.h */
  19. #undef prefs_begin
  20. #undef prefs_add_int
  21. #undef prefs_add_int_with_data
  22. #undef prefs_override_int
  23. #undef prefs_add_integer
  24. #undef prefs_add_integer_with_data
  25. #undef prefs_override_integer
  26. #undef prefs_add_bool
  27. #undef prefs_add_bool_with_data
  28. #undef prefs_override_bool
  29. #undef prefs_add_double
  30. #undef prefs_add_double_with_data
  31. #undef prefs_override_double
  32. #undef prefs_add_enum
  33. #undef prefs_add_enum_with_data
  34. #undef prefs_override_enum
  35. #undef prefs_add_string
  36. #undef prefs_add_string_with_data
  37. #undef prefs_override_string
  38. #undef prefs_end
  39. #define prefs_begin(Klas) \
  40. void struct##Klas :: f_preferences () {
  41. #define prefs_add_int(Klas,name,version,default) \
  42. Preferences_addInt (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
  43. #define prefs_add_int_with_data(Klas,name,version,default) prefs_add_int (Klas, name, version, default)
  44. #define prefs_override_int(Klas,name,version,default) \
  45. Preferences_addInt (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
  46. #define prefs_add_integer(Klas,name,version,default) \
  47. Preferences_addInteger (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
  48. #define prefs_add_integer_with_data(Klas,name,version,default) prefs_add_integer (Klas, name, version, default)
  49. #define prefs_override_integer(Klas,name,version,default) \
  50. Preferences_addInteger (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atoi (sdefault_##name));
  51. #define prefs_add_bool(Klas,name,version,default) \
  52. Preferences_addBool (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, default);
  53. #define prefs_add_bool_with_data(Klas,name,version,default) prefs_add_bool (Klas, name, version, default)
  54. #define prefs_override_bool(Klas,name,version,default) \
  55. Preferences_addBool (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, default);
  56. #define prefs_add_double(Klas,name,version,default) \
  57. Preferences_addDouble (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atof (sdefault_##name));
  58. #define prefs_add_double_with_data(Klas,name,version,default) prefs_add_double (Klas, name, version, default)
  59. #define prefs_override_double(Klas,name,version,default) \
  60. Preferences_addDouble (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, Melder_atof (sdefault_##name));
  61. #define prefs_add_enum(Klas,name,version,enumerated,default) \
  62. Preferences_addEnum (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, enumerated, enumerated :: default);
  63. #define prefs_add_enum_with_data(Klas,name,version,enumerated,default) prefs_add_enum (Klas, name, version, enumerated, default)
  64. #define prefs_override_enum(Klas,name,version,enumerated,default) \
  65. Preferences_addEnum (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name, enumerated, enumerated :: default);
  66. #define prefs_add_string(Klas,name,version,default) \
  67. Preferences_addString (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name [0], default);
  68. #define prefs_add_string_with_data(Klas,name,version,default) prefs_add_string (Klas, name, version, default)
  69. #define prefs_override_string(Klas,name,version,default) \
  70. Preferences_addString (Melder_cat (U"" #Klas U"." #name, version >= 2 ? U"." #version : U""), & s_##name [0], default);
  71. #define prefs_end(Klas) \
  72. }
  73. /* End of file prefs_install.h */