GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
application_setting_record_validator.cpp
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
9
10#include <format>
11
12namespace designlab {
13
15 : kErrorMesForWindowWidthGeMin(
16 std::format("The window width should be set to a value greater than "
17 "or equal to {}.",
18 ApplicationSettingRecord::kWindowWidthMin)),
19
20 kErrorMesForWindowWidthLeMax(std::format(
21 "The window width should be set to a value less than or equal to {}.",
22 ApplicationSettingRecord::kWindowWidthMax)),
23
24 kErrorMesForWindowHeightGeMin(
25 std::format("The window height should be set to a value greater than "
26 "or equal to {}.",
27 ApplicationSettingRecord::kWindowHeightMin)),
28
29 kErrorMesForWindowHeightLeMax(
30 std::format("The window height should be set to a value less than or "
31 "equal to {}.",
32 ApplicationSettingRecord::kWindowHeightMax)),
33
34 kErrorMesForFpsGeMin(
35 std::format("FPS should be set to a value greater than {}.",
36 ApplicationSettingRecord::kFpsMin)),
37
38 kErrorMesForFpsLeMax(
39 std::format("FPS should be set to a value less than or equal to {}.",
40 ApplicationSettingRecord::kFpsMax)) {}
41
42std::tuple<bool, std::string> ApplicationSettingRecordValidator::Validate(
43 const ApplicationSettingRecord& setting_record) const
44
45{
46 if (setting_record.window_size_x <
48 return std::make_tuple(false, kErrorMesForWindowWidthGeMin);
49 }
50
51 if (setting_record.window_size_x >
53 return std::make_tuple(false, kErrorMesForWindowWidthLeMax);
54 }
55
56 if (setting_record.window_size_y <
58 return std::make_tuple(false, kErrorMesForWindowHeightGeMin);
59 }
60
61 if (setting_record.window_size_y >
63 return std::make_tuple(false, kErrorMesForWindowHeightLeMax);
64 }
65
66 if (setting_record.window_fps < ApplicationSettingRecord::kFpsMin) {
67 return std::make_tuple(false, kErrorMesForFpsGeMin);
68 }
69
70 if (setting_record.window_fps > ApplicationSettingRecord::kFpsMax) {
71 return std::make_tuple(false, kErrorMesForFpsLeMax);
72 }
73
74 return std::make_tuple(true, "");
75}
76
77} // namespace designlab
std::tuple< bool, std::string > Validate(const ApplicationSettingRecord &setting_record) const override
設定ファイルの内容を検証する.
Definition com_type.h:21
アプリの設定を記録する構造体.
int window_size_x
グラフィカルウィンドウの横幅.
int window_fps
グラフィカルウィンドウのFPS.
int window_size_y
グラフィカルウィンドウの縦幅.