diff --git a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx index 756ea62890030193ea0b2291b78a44b078a7d587..18b9afc2459e9436d06dc6011682e47f42badc8e 100644 --- a/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeConfusionMatrix.cxx @@ -37,11 +37,6 @@ namespace otb { namespace Wrapper { -/** Utility function to negate std::isalnum */ -bool IsNotAlphaNum(char c) - { - return !std::isalnum(c); - } class ComputeConfusionMatrix : public Application { @@ -198,7 +193,7 @@ private: { std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); key = item; - std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::string::iterator end = std::remove_if(key.begin(),key.end(), [](char c){return !std::isalnum(c);}); std::transform(key.begin(), end, key.begin(), tolower); OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index c4ca1ab8346a9c96db6da1370840741934efcc85..db4aca185f9c14cc396465d47bd6e5867e6fa851 100644 --- a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx @@ -32,12 +32,6 @@ namespace otb namespace Wrapper { -/** Utility function to negate std::isalnum */ -bool IsNotAlphaNum(char c) - { - return !std::isalnum(c); - } - class PolygonClassStatistics : public Application { public: @@ -141,7 +135,7 @@ private: { std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); key = item; - std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::string::iterator end = std::remove_if(key.begin(),key.end(), [](char c){return !std::isalnum(c);}); std::transform(key.begin(), end, key.begin(), tolower); OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); diff --git a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx index b94130d3f57a68067d035af1de464e55230d397d..473a82b3b0b6750f18a7e9ed2eafda3e6a94347c 100644 --- a/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleExtraction.cxx @@ -27,12 +27,6 @@ namespace otb { namespace Wrapper { -/** Utility function to negate std::isalnum */ -bool IsNotAlphaNum(char c) - { - return !std::isalnum(c); - } - class SampleExtraction : public Application { public: @@ -139,7 +133,7 @@ private: { std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); key = item; - std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::string::iterator end = std::remove_if(key.begin(),key.end(), [](char c){return !std::isalnum(c);}); std::transform(key.begin(), end, key.begin(), tolower); OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); diff --git a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx index c2bc93f144a79313db493355e1b39e024905d487..d4770c4d1dd5bd32dfc8294be9be8c47810a4603 100644 --- a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx @@ -32,13 +32,6 @@ namespace otb { namespace Wrapper { - -/** Utility function to negate std::isalnum */ -bool IsNotAlphaNum(char c) - { - return !std::isalnum(c); - } - class SampleSelection : public Application { public: @@ -243,7 +236,7 @@ private: { std::string key, item = feature.ogr().GetFieldDefnRef(iField)->GetNameRef(); key = item; - std::string::iterator end = std::remove_if(key.begin(),key.end(),IsNotAlphaNum); + std::string::iterator end = std::remove_if(key.begin(), key.end(), [](char c){return !std::isalnum(c);}); std::transform(key.begin(), end, key.begin(), tolower); OGRFieldType fieldType = feature.ogr().GetFieldDefnRef(iField)->GetType(); diff --git a/Modules/Applications/AppClassification/include/otbTrainVectorBase.h b/Modules/Applications/AppClassification/include/otbTrainVectorBase.h index 24b731cbd6b09ef5e81bb45388fddbcd43801ca3..d58b536468e3eb5166e246d424664afdacfda812 100644 --- a/Modules/Applications/AppClassification/include/otbTrainVectorBase.h +++ b/Modules/Applications/AppClassification/include/otbTrainVectorBase.h @@ -43,12 +43,6 @@ namespace otb namespace Wrapper { -/** Utility function to negate std::isalnum */ -bool IsNotAlphaNum(char c) -{ - return !std::isalnum( c ); -} - template <class TInputValue, class TOutputValue> class TrainVectorBase : public LearningApplicationBase<TInputValue, TOutputValue> { diff --git a/Modules/Applications/AppClassification/include/otbTrainVectorBase.hxx b/Modules/Applications/AppClassification/include/otbTrainVectorBase.hxx index eaaa8bee3189933a532c3c21abbde7a65dc77e87..ff2947dc7b757432b6230901eb80a945082f9734 100644 --- a/Modules/Applications/AppClassification/include/otbTrainVectorBase.hxx +++ b/Modules/Applications/AppClassification/include/otbTrainVectorBase.hxx @@ -124,7 +124,7 @@ TrainVectorBase<TInputValue, TOutputValue> { std::string key, item = feature.ogr().GetFieldDefnRef( iField )->GetNameRef(); key = item; - std::string::iterator end = std::remove_if( key.begin(), key.end(), IsNotAlphaNum ); + std::string::iterator end = std::remove_if( key.begin(), key.end(), [](char c){return !std::isalnum(c);} ); std::transform( key.begin(), end, key.begin(), tolower ); OGRFieldType fieldType = feature.ogr().GetFieldDefnRef( iField )->GetType(); diff --git a/Modules/Applications/AppClassification/include/otbVectorPrediction.h b/Modules/Applications/AppClassification/include/otbVectorPrediction.h index 916ace1ea6f6bbfff7ff33cd2785249be67c3139..d895324665f20035a8361e3b443b8a0acc43a598 100644 --- a/Modules/Applications/AppClassification/include/otbVectorPrediction.h +++ b/Modules/Applications/AppClassification/include/otbVectorPrediction.h @@ -86,12 +86,6 @@ public: } private: - /** Utility function to negate std::isalnum */ - static bool IsNotAlphaNum(char c) - { - return !std::isalnum(c); - } - void DoInit() override; /** Method defining the parameters used in the application and their documentation, specialized for RegressionMode=1 and RegrssionMode=0 */ diff --git a/Modules/Applications/AppClassification/include/otbVectorPrediction.hxx b/Modules/Applications/AppClassification/include/otbVectorPrediction.hxx index 00f1de167ed04f51f08f611e685f23498a203b0f..c46a11a1aabeb27b4629f6be61d52d19c1038ed2 100644 --- a/Modules/Applications/AppClassification/include/otbVectorPrediction.hxx +++ b/Modules/Applications/AppClassification/include/otbVectorPrediction.hxx @@ -60,9 +60,8 @@ void VectorPrediction<RegressionMode>::DoUpdateParameters() auto fieldDefn = layerDefn.GetFieldDefn(iField); std::string item = fieldDefn->GetNameRef(); std::string key(item); - key.erase(std::remove_if(key.begin(), key.end(), IsNotAlphaNum), key.end()); + key.erase(std::remove_if(key.begin(), key.end(), [](char c){return !std::isalnum(c);}), key.end()); std::transform(key.begin(), key.end(), key.begin(), tolower); - auto fieldType = fieldDefn->GetType(); if (fieldType == OFTInteger || fieldType == OFTInteger64 || fieldType == OFTReal) { diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbVectorDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbVectorDimensionalityReduction.cxx index 2629ce715998a58b38902703e53d5e85d6889b46..d3c4a29b45aeff39e3a1fb364146a494f961bc8b 100644 --- a/Modules/Applications/AppDimensionalityReduction/app/otbVectorDimensionalityReduction.cxx +++ b/Modules/Applications/AppDimensionalityReduction/app/otbVectorDimensionalityReduction.cxx @@ -32,13 +32,6 @@ namespace otb { namespace Wrapper { - -/** Utility function to negate std::isalnum */ -bool IsNotAlphaNum(char c) -{ -return !std::isalnum(c); -} - /** * \class VectorDimensionalityReduction * @@ -180,7 +173,7 @@ private: { std::string item = layerDefn.GetFieldDefn(iField)->GetNameRef(); std::string key(item); - std::string::iterator end = std::remove_if( key.begin(), key.end(), IsNotAlphaNum ); + std::string::iterator end = std::remove_if( key.begin(), key.end(), [](char c){return !std::isalnum(c);}); std::transform( key.begin(), end, key.begin(), tolower ); std::string tmpKey = "feat." + key.substr( 0, static_cast<unsigned long>( end - key.begin() ) ); AddChoice(tmpKey,item);