From 745eba34f26ddf56fc3f1a1f92aa6b2364b77a5b Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Wed, 7 Jun 2023 22:04:40 -0500 Subject: [PATCH] Color table statements should be case insensitive Fixes #57 --- wxdata/source/scwx/common/color_table.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/wxdata/source/scwx/common/color_table.cpp b/wxdata/source/scwx/common/color_table.cpp index 17935576..f476cc56 100644 --- a/wxdata/source/scwx/common/color_table.cpp +++ b/wxdata/source/scwx/common/color_table.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -180,37 +181,37 @@ std::shared_ptr ColorTable::Load(std::istream& is) void ColorTable::ProcessLine(const std::vector& tokenList) { - if (tokenList[0] == "Product:") + if (boost::iequals(tokenList[0], "Product:")) { // Product: string p->product_ = tokenList[1]; } - else if (tokenList[0] == "Units:") + else if (boost::iequals(tokenList[0], "Units:")) { // Units: string p->units_ = tokenList[1]; } - else if (tokenList[0] == "Scale:") + else if (boost::iequals(tokenList[0], "Scale:")) { // Scale: float p->scale_ = std::stof(tokenList[1]); } - else if (tokenList[0] == "Offset:") + else if (boost::iequals(tokenList[0], "Offset:")) { // Offset: float p->offset_ = std::stof(tokenList[1]); } - else if (tokenList[0] == "Step:") + else if (boost::iequals(tokenList[0], "Step:")) { // Step: number p->step_ = std::stol(tokenList[1]); } - else if (tokenList[0] == "RF:") + else if (boost::iequals(tokenList[0], "RF:")) { // RF: R G B [A] p->rfColor_ = ParseColor(tokenList, 1, p->colorMode_); } - else if (tokenList[0] == "Color:") + else if (boost::iequals(tokenList[0], "Color:")) { // Color: value R G B [R G B] float key = std::stof(tokenList[1]); @@ -226,7 +227,7 @@ void ColorTable::ProcessLine(const std::vector& tokenList) p->colorMap_[key] = std::make_pair(color1, color2); } - else if (tokenList[0] == "Color4:") + else if (boost::iequals(tokenList[0], "Color4:")) { // Color4: value R G B A [R G B A] float key = std::stof(tokenList[1]); @@ -242,7 +243,7 @@ void ColorTable::ProcessLine(const std::vector& tokenList) p->colorMap_[key] = std::make_pair(color1, color2); } - else if (tokenList[0] == "SolidColor:") + else if (boost::iequals(tokenList[0], "SolidColor:")) { // SolidColor: value R G B float key = std::stof(tokenList[1]); @@ -252,7 +253,7 @@ void ColorTable::ProcessLine(const std::vector& tokenList) p->colorMap_[key] = std::make_pair(color1, color1); } - else if (tokenList[0] == "SolidColor4:") + else if (boost::iequals(tokenList[0], "SolidColor4:")) { // SolidColor4: value R G B A float key = std::stof(tokenList[1]);