Iterate Enum fixes
This commit is contained in:
@@ -53,7 +53,7 @@ typename std::enable_if<
|
|||||||
!std::is_same_v<T, LedstripAnimation> &&
|
!std::is_same_v<T, LedstripAnimation> &&
|
||||||
!std::is_same_v<T, HandbremseMode> &&
|
!std::is_same_v<T, HandbremseMode> &&
|
||||||
!std::is_same_v<T, CloudMode> &&
|
!std::is_same_v<T, CloudMode> &&
|
||||||
!std::is_same_v<T, BobbyQuickActions>
|
!std::is_same_v<T, BatteryCellType>
|
||||||
, void>::type
|
, void>::type
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||||
{
|
{
|
||||||
@@ -203,69 +203,17 @@ showInputForSetting(std::string_view key, T value, std::string &body)
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
std::is_same_v<T, OtaAnimationModes>
|
std::is_same_v<T, OtaAnimationModes> ||
|
||||||
, void>::type
|
std::is_same_v<T, LedstripAnimation> ||
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
std::is_same_v<T, BatteryCellType> ||
|
||||||
{
|
std::is_same_v<T, CloudMode> ||
|
||||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
|
||||||
|
|
||||||
iterateOtaAnimationModes([&](T enumVal, std::string_view enumKey){
|
|
||||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(enumVal), value == enumVal ? " selected" : ""), body};
|
|
||||||
body += esphttpdutils::htmlentities(enumKey);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
typename std::enable_if<
|
|
||||||
std::is_same_v<T, LedstripAnimation>
|
|
||||||
, void>::type
|
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
|
||||||
{
|
|
||||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
|
||||||
|
|
||||||
iterateLedstripAnimation([&](T enumVal, std::string_view enumKey){
|
|
||||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(enumVal), value == enumVal ? " selected" : ""), body};
|
|
||||||
body += esphttpdutils::htmlentities(enumKey);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
typename std::enable_if<
|
|
||||||
std::is_same_v<T, HandbremseMode>
|
std::is_same_v<T, HandbremseMode>
|
||||||
, void>::type
|
, void>::type
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
showInputForSetting(std::string_view key, T value, std::string &body)
|
||||||
{
|
{
|
||||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
||||||
|
|
||||||
iterateHandbremseMode([&](T enumVal, std::string_view enumKey){
|
iterateEnum<T>::iterate([&](T enumVal, std::string_view enumKey){
|
||||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(enumVal), value == enumVal ? " selected" : ""), body};
|
|
||||||
body += esphttpdutils::htmlentities(enumKey);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
typename std::enable_if<
|
|
||||||
std::is_same_v<T, BobbyQuickActions>
|
|
||||||
, void>::type
|
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
|
||||||
{
|
|
||||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
|
||||||
|
|
||||||
iterateBobbyQuickActions([&](T enumVal, std::string_view enumKey){
|
|
||||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(enumVal), value == enumVal ? " selected" : ""), body};
|
|
||||||
body += esphttpdutils::htmlentities(enumKey);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
typename std::enable_if<
|
|
||||||
std::is_same_v<T, CloudMode>
|
|
||||||
, void>::type
|
|
||||||
showInputForSetting(std::string_view key, T value, std::string &body)
|
|
||||||
{
|
|
||||||
HtmlTag select{"select", fmt::format("name=\"{}\"", esphttpdutils::htmlentities(key)), body};
|
|
||||||
|
|
||||||
iterateCloudMode([&](T enumVal, std::string_view enumKey){
|
|
||||||
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(enumVal), value == enumVal ? " selected" : ""), body};
|
HtmlTag option{"option", fmt::format("value=\"{}\"{}", std::to_underlying(enumVal), value == enumVal ? " selected" : ""), body};
|
||||||
body += esphttpdutils::htmlentities(enumKey);
|
body += esphttpdutils::htmlentities(enumKey);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user