summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/settings.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/common/settings.h b/src/common/settings.h
index 51f9a179b..f54705a96 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -81,7 +81,7 @@ public:
81 * 81 *
82 * @returns A reference to the setting 82 * @returns A reference to the setting
83 */ 83 */
84 [[nodiscard]] const Type& GetValue() const { 84 [[nodiscard]] virtual const Type& GetValue() const {
85 return global; 85 return global;
86 } 86 }
87 87
@@ -90,7 +90,7 @@ public:
90 * 90 *
91 * @param value The desired value 91 * @param value The desired value
92 */ 92 */
93 void SetValue(const Type& value) { 93 virtual void SetValue(const Type& value) {
94 Type temp{value}; 94 Type temp{value};
95 std::swap(global, temp); 95 std::swap(global, temp);
96 } 96 }
@@ -120,7 +120,7 @@ public:
120 * 120 *
121 * @returns A reference to the setting 121 * @returns A reference to the setting
122 */ 122 */
123 const Type& operator=(const Type& value) { 123 virtual const Type& operator=(const Type& value) {
124 Type temp{value}; 124 Type temp{value};
125 std::swap(global, temp); 125 std::swap(global, temp);
126 return global; 126 return global;
@@ -131,7 +131,7 @@ public:
131 * 131 *
132 * @returns A reference to the setting 132 * @returns A reference to the setting
133 */ 133 */
134 explicit operator const Type&() const { 134 explicit virtual operator const Type&() const {
135 return global; 135 return global;
136 } 136 }
137 137
@@ -167,7 +167,7 @@ public:
167 * 167 *
168 * @param value The desired value 168 * @param value The desired value
169 */ 169 */
170 void SetValue(const Type& value) { 170 void SetValue(const Type& value) override {
171 Type temp; 171 Type temp;
172 if (value < minimum) { 172 if (value < minimum) {
173 temp = std::move(minimum); 173 temp = std::move(minimum);
@@ -185,7 +185,7 @@ public:
185 * @param value The desired value 185 * @param value The desired value
186 * @returns A reference to the setting's value 186 * @returns A reference to the setting's value
187 */ 187 */
188 const Type& operator=(const Type& value) { 188 const Type& operator=(const Type& value) override {
189 Type temp; 189 Type temp;
190 if (value < minimum) { 190 if (value < minimum) {
191 temp = std::move(minimum); 191 temp = std::move(minimum);
@@ -252,7 +252,13 @@ public:
252 * 252 *
253 * @returns The required value of the setting 253 * @returns The required value of the setting
254 */ 254 */
255 [[nodiscard]] const Type& GetValue(bool need_global = false) const { 255 [[nodiscard]] const Type& GetValue() const override {
256 if (use_global) {
257 return this->global;
258 }
259 return custom;
260 }
261 [[nodiscard]] const Type& GetValue(bool need_global) const {
256 if (use_global || need_global) { 262 if (use_global || need_global) {
257 return this->global; 263 return this->global;
258 } 264 }
@@ -264,7 +270,7 @@ public:
264 * 270 *
265 * @param value The new value 271 * @param value The new value
266 */ 272 */
267 void SetValue(const Type& value) { 273 void SetValue(const Type& value) override {
268 Type temp{value}; 274 Type temp{value};
269 if (use_global) { 275 if (use_global) {
270 std::swap(this->global, temp); 276 std::swap(this->global, temp);
@@ -280,7 +286,7 @@ public:
280 * 286 *
281 * @returns A reference to the current setting value 287 * @returns A reference to the current setting value
282 */ 288 */
283 const Type& operator=(const Type& value) { 289 const Type& operator=(const Type& value) override {
284 Type temp{value}; 290 Type temp{value};
285 if (use_global) { 291 if (use_global) {
286 std::swap(this->global, temp); 292 std::swap(this->global, temp);
@@ -295,7 +301,7 @@ public:
295 * 301 *
296 * @returns A reference to the current setting value 302 * @returns A reference to the current setting value
297 */ 303 */
298 explicit operator const Type&() const { 304 explicit operator const Type&() const override {
299 if (use_global) { 305 if (use_global) {
300 return this->global; 306 return this->global;
301 } 307 }
@@ -335,7 +341,7 @@ public:
335 * 341 *
336 * @param value The desired value 342 * @param value The desired value
337 */ 343 */
338 void SetValue(const Type& value) { 344 void SetValue(const Type& value) override {
339 Type temp; 345 Type temp;
340 if (value < this->minimum) { 346 if (value < this->minimum) {
341 temp = std::move(this->minimum); 347 temp = std::move(this->minimum);
@@ -358,7 +364,7 @@ public:
358 * @param value The desired value 364 * @param value The desired value
359 * @returns A reference to the setting's value 365 * @returns A reference to the setting's value
360 */ 366 */
361 const Type& operator=(const Type& value) { 367 const Type& operator=(const Type& value) override {
362 Type temp; 368 Type temp;
363 if (value < this->minimum) { 369 if (value < this->minimum) {
364 temp = std::move(this->minimum); 370 temp = std::move(this->minimum);