-
- Downloads
COMP: add missing string includes
Before this commit, many files are using std::string without including <string>. It can work accidentally but causes issues when refactoring, especially if using operator <<() which is included implicitly by some compilers. To find guilty header files, I used: grep -l "^ *std::string" $(grep -L "#include <string>" $(find . -type f -name "*.h")) which finds all files containing "std::string" at the beginning of a line (usually a member or variable declaration), but not "#include <string>". And then this script to add the includes (plus some manual ediing): #!/usr/bin/env python3 import re import argparse def fix_file(filename, header): with open(filename, "r") as f: content = f.read() matches = list(re.finditer(r"(#include .*\n)\n", content)) if len(matches) == 0: print("no include!") sys.exit(-1) pos = matches[-1].end(1) open(filename, "w").write(content[:pos] + "#include <{}>\n".format(header) + content[pos:]) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--header', type=str, required=True) parser.add_argument('files', type=str, nargs='+') args = parser.parse_args() for filename in args.files: fix_file(filename, args.header)
Showing
- Modules/Adapters/CurlAdapters/include/otbCurlHelper.h 1 addition, 0 deletionsModules/Adapters/CurlAdapters/include/otbCurlHelper.h
- Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h 1 addition, 0 deletionsModules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h
- Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h 1 addition, 0 deletionsModules/Adapters/OSSIMAdapters/include/otbDEMHandler.h
- Modules/Applications/AppClassification/include/otbLearningApplicationBase.h 1 addition, 0 deletions...ns/AppClassification/include/otbLearningApplicationBase.h
- Modules/Applications/AppClassification/include/otbTrainImagesBase.h 1 addition, 0 deletions...plications/AppClassification/include/otbTrainImagesBase.h
- Modules/Applications/AppClassification/include/otbTrainVectorBase.h 1 addition, 0 deletions...plications/AppClassification/include/otbTrainVectorBase.h
- Modules/Applications/AppDimensionalityReduction/include/otbTrainDimensionalityReductionApplicationBase.h 1 addition, 0 deletions.../include/otbTrainDimensionalityReductionApplicationBase.h
- Modules/Core/Common/include/otbExtendedFilenameHelper.h 1 addition, 0 deletionsModules/Core/Common/include/otbExtendedFilenameHelper.h
- Modules/Core/ImageBase/include/otbRemoteSensingRegion.h 1 addition, 0 deletionsModules/Core/ImageBase/include/otbRemoteSensingRegion.h
- Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h 1 addition, 0 deletionsModules/Core/LabelMap/include/otbAttributesMapLabelObject.h
- Modules/Core/LabelMap/include/otbStatisticsAttributesLabelMapFilter.h 1 addition, 0 deletions.../LabelMap/include/otbStatisticsAttributesLabelMapFilter.h
- Modules/Core/Metadata/include/otbFormosatImageMetadataInterface.h 1 addition, 0 deletions...Core/Metadata/include/otbFormosatImageMetadataInterface.h
- Modules/Core/Metadata/include/otbPleiadesImageMetadataInterface.h 1 addition, 0 deletions...Core/Metadata/include/otbPleiadesImageMetadataInterface.h
- Modules/Core/Metadata/include/otbSpot6ImageMetadataInterface.h 1 addition, 0 deletions...es/Core/Metadata/include/otbSpot6ImageMetadataInterface.h
- Modules/Core/Metadata/include/otbSpotImageMetadataInterface.h 1 addition, 0 deletions...les/Core/Metadata/include/otbSpotImageMetadataInterface.h
- Modules/Core/Transform/include/otbGenericMapProjection.h 1 addition, 0 deletionsModules/Core/Transform/include/otbGenericMapProjection.h
- Modules/Core/Transform/include/otbGenericRSTransform.h 1 addition, 0 deletionsModules/Core/Transform/include/otbGenericRSTransform.h
- Modules/Core/Transform/include/otbImageToGenericRSOutputParameters.h 1 addition, 0 deletions...e/Transform/include/otbImageToGenericRSOutputParameters.h
- Modules/Core/VectorDataBase/include/otbDataNode.h 1 addition, 0 deletionsModules/Core/VectorDataBase/include/otbDataNode.h
- Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h 1 addition, 0 deletions...e/VectorDataBase/include/otbGISConnectionImplementation.h
Loading
Please register or sign in to comment