Implement at32() util

Works like .at() but uses source location for "exception".
This commit is contained in:
Nekotekina 2022-09-19 15:57:51 +03:00 committed by Ivan
parent 2655255d4d
commit 6ff6a4989a
62 changed files with 472 additions and 452 deletions

View file

@ -83,7 +83,7 @@ void cfg_camera::camera_setting::from_string(const std::string& text)
camera_log.error("String '%s' cannot be interpreted as camera_setting.", text);
return;
}
const auto to_integer = [](const std::string& str, int& out) -> bool
{
auto [ptr, ec] = std::from_chars(str.c_str(), str.c_str() + str.size(), out);
@ -107,13 +107,13 @@ void cfg_camera::camera_setting::from_string(const std::string& text)
return true;
};
if (!to_integer(list.at(0), width) ||
!to_integer(list.at(1), height) ||
!to_double(list.at(2), min_fps) ||
!to_double(list.at(3), max_fps) ||
!to_integer(list.at(4), format) ||
!to_integer(list.at(5), pixel_aspect_width) ||
!to_integer(list.at(6), pixel_aspect_height))
if (!to_integer(::at32(list, 0), width) ||
!to_integer(::at32(list, 1), height) ||
!to_double(::at32(list, 2), min_fps) ||
!to_double(::at32(list, 3), max_fps) ||
!to_integer(::at32(list, 4), format) ||
!to_integer(::at32(list, 5), pixel_aspect_width) ||
!to_integer(::at32(list, 6), pixel_aspect_height))
{
width = 0;
height = 0;