Skip to content

Commit d67d70b

Browse files
committed
Add constructor
1 parent 653f3c3 commit d67d70b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

examples/xtd.forms.examples/games/minesweeper/src/high_scores_dialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ high_scores_dialog::high_scores_dialog() {
5858
reset_scores_button_.width(100);
5959
reset_scores_button_.text("&Reset Scores"_t);
6060
reset_scores_button_.click += [&] {
61-
properties::settings empty;
61+
auto empty = properties::settings {false};
6262
properties::settings::default_settings().beginner_high_scores_name(empty.beginner_high_scores_name());
6363
properties::settings::default_settings().beginner_high_scores_value(empty.beginner_high_scores_value());
6464
properties::settings::default_settings().intermediate_high_scores_name(empty.intermediate_high_scores_name());

scripts/cmake/xtd_commands.cmake

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,13 @@ macro(write_settings_file_header)
19081908
"\n"
19091909
" /// @{\n"
19101910
" /// @brief Initializes a new instance of the ${TARGET_DEFAULT_NAMESPACE}::properties::settings class.\n"
1911-
" settings() noexcept = default;\n"
1911+
" /// @remarks All properties are reloaded with the last saved value.\n"
1912+
" settings() noexcept : settings {true} {}\n"
1913+
" /// @brief Initializes a new instance of the ${TARGET_DEFAULT_NAMESPACE}::properties::settings class.\n"
1914+
" /// @param load If true all properties are reloaded with the last saved values; otherwise none.\n"
1915+
" explicit settings(bool load) noexcept {\n"
1916+
" if (load) reload();\n"
1917+
" }\n"
19121918
" /// @}\n"
19131919
"\n"
19141920
" /// @cond\n"
@@ -1981,7 +1987,7 @@ macro(write_settings_file_header)
19811987
" /// @remarks See [Settings](https://gammasoft71.github.io/xtd/docs/documentation/Guides/xtd.core/settings) for more informations.\n"
19821988
" void reset() noexcept {\n"
19831989
" settings_.reset();\n"
1984-
" *this = settings {};\n"
1990+
" *this = settings {false};\n"
19851991
" }\n"
19861992
"\n"
19871993
)
@@ -2009,11 +2015,9 @@ macro(write_settings_file_header)
20092015
" /// @{\n"
20102016
" /// @brief Gets the default instance of settings.\n"
20112017
" /// @return The default instance.\n"
2018+
" /// @remarks At the first call all properties are reloaded with the last saved values.\n"
20122019
" static settings& default_settings() noexcept {\n"
20132020
" static auto default_settings = settings {};\n"
2014-
" call_once_ {\n"
2015-
" default_settings.reload();\n"
2016-
" };\n"
20172021
" return default_settings;\n"
20182022
" }\n"
20192023
" /// @}\n"

0 commit comments

Comments
 (0)