Skip to content

Introduce a convenience template setting getter in ConnectionSettings

Arjen Hiemstra requested to merge work/ahiemstra/settingtemplate into master

This removes the need for manual casting after getting the setting object using the setting(SettingType) getter. Combined with auto this greatly reduces the length of setting getter lines by reducing duplication, improving readability of code using settings.

As can be seen in the second commit, this allows changing code like this:

NetworkManager::WirelessSecuritySetting::Ptr wifiSecuritySetting = settings->setting(NetworkManager::Setting::WirelessSecurity).staticCast<NetworkManager::WirelessSecuritySetting>();

to:

auto wifiSecuritySetting = settings->setting<NetworkManager::WirelessSecuritySetting>();

which easily fits on a single line.

Edited by Arjen Hiemstra

Merge request reports

Loading