Check type case insensitive

Former-commit-id: 07cebb35933bba53012b7f05bc467f11a28bcc8c
This commit is contained in:
poljvd 2013-10-16 18:13:31 +02:00
parent d2738ef5f6
commit d07ddc8009

View File

@ -1,3 +1,6 @@
// stl includes
#include <cctype>
#include <algorithm>
// Bootsequence includes // Bootsequence includes
#include <bootsequence/BootSequenceFactory.h> #include <bootsequence/BootSequenceFactory.h>
@ -8,7 +11,8 @@
BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, const Json::Value & jsonConfig) BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, const Json::Value & jsonConfig)
{ {
const std::string type = jsonConfig["type"].asString(); std::string type = jsonConfig["type"].asString();
std::transform(type.begin(), type.end(), type.begin(), std::tolower);
if (type == "none") if (type == "none")
{ {
@ -19,7 +23,7 @@ BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, cons
const unsigned duration_ms = jsonConfig["duration_ms"].asUInt(); const unsigned duration_ms = jsonConfig["duration_ms"].asUInt();
return new RainbowBootSequence(hyperion, duration_ms); return new RainbowBootSequence(hyperion, duration_ms);
} }
else if (type == "knightrider") else if (type == "knightrider" || type == "knight rider")
{ {
const unsigned duration_ms = jsonConfig["duration_ms"].asUInt(); const unsigned duration_ms = jsonConfig["duration_ms"].asUInt();
return new KittBootSequence(hyperion, duration_ms); return new KittBootSequence(hyperion, duration_ms);