diff --git a/CMake/ImportBoost.cmake b/CMake/ImportBoost.cmake index 045b08b3fa695a48ee1f42f69a1fa6f09084ccfb..612f1913a113e295a56963f6620ad483fc457c4a 100644 --- a/CMake/ImportBoost.cmake +++ b/CMake/ImportBoost.cmake @@ -6,7 +6,7 @@ MARK_AS_ADVANCED(OTB_USE_EXTERNAL_BOOST) IF(OTB_USE_EXTERNAL_BOOST) # Import the package - FIND_PACKAGE(Boost REQUIRED COMPONENTS regex) + FIND_PACKAGE(Boost) MARK_AS_ADVANCED(Boost_DIR) IF(Boost_FOUND) MESSAGE(STATUS " Found Boost version ${Boost_VERSION}") diff --git a/Code/IO/CMakeLists.txt b/Code/IO/CMakeLists.txt index df8803528ab701564a1fd107292347e571c56be6..9b5f0f1e6a19e172fa9bbf6a0f7c6311c08b2b86 100644 --- a/Code/IO/CMakeLists.txt +++ b/Code/IO/CMakeLists.txt @@ -38,7 +38,7 @@ ADD_LIBRARY(OTBIO ${OTBIO_SRCS}) # PROPERTIES # LINK_INTERFACE_LIBRARIES "" # ) -TARGET_LINK_LIBRARIES (OTBIO ${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${GDAL_LIBRARY} ${OGR_LIBRARY} ${JPEG_LIBRARY} ${OPENTHREADS_LIBRARY} ${Boost_REGEX_LIBRARY} OTBCommon OTBBasicFilters OTBCurlAdapters) +TARGET_LINK_LIBRARIES (OTBIO ${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${GDAL_LIBRARY} ${OGR_LIBRARY} ${JPEG_LIBRARY} ${OPENTHREADS_LIBRARY} OTBCommon OTBBasicFilters OTBCurlAdapters) TARGET_LINK_LIBRARIES (OTBIO ITKIO ITKCommon otbkml tinyXML) IF (OTB_USE_LIBLAS) diff --git a/Code/IO/otbSpectralSensitivityReader.cxx b/Code/IO/otbSpectralSensitivityReader.cxx index 81c09d1927097ec1d76e68c56482769241eac45a..1a90150ce9f99bb32fdae982f5f44bbb40143b08 100644 --- a/Code/IO/otbSpectralSensitivityReader.cxx +++ b/Code/IO/otbSpectralSensitivityReader.cxx @@ -22,7 +22,6 @@ #include <algorithm> #include <cctype> #include <boost/algorithm/string.hpp> -#include <boost/regex.hpp> #include "itksys/SystemTools.hxx" #include "otbSpotImageMetadataInterface.h" @@ -138,10 +137,8 @@ SpectralSensitivityReader while (std::getline(file, line)) { // Replace multiple spaces by a unique space - boost::regex expr("(\\s)+"); - std::string fmt(" "); - line = boost::regex_replace(line, expr, fmt); - + std::unique(line.begin(), line.end(), SpectralSensitivityReader::BothAre(' ')); + // if the first character is a space, erase it boost::trim(line); std::vector<std::string> keywordStrings; diff --git a/Code/IO/otbSpectralSensitivityReader.h b/Code/IO/otbSpectralSensitivityReader.h index 7d68cbceb4133c724b3d376ff261188c41e7e2f8..4be6bf96830cc2d5de10a95c301753c80aae84d7 100644 --- a/Code/IO/otbSpectralSensitivityReader.h +++ b/Code/IO/otbSpectralSensitivityReader.h @@ -84,6 +84,18 @@ protected: /** PrintSelf method */ void PrintSelf(std::ostream& os, itk::Indent indent) const; + /** Struct use to remove multiple spaces in file */ + struct BothAre +{ + char c; + BothAre(char r) : c(r) {} + bool operator()(char l, char r) const + { + return r == c && l == c; + } +}; + + private: SpectralSensitivityReader(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented