Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "rename-layer" step of "vector pipeline" 5 : * Author: Even Rouault <even dot rouault at spatialys.com> 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2026, Even Rouault <even dot rouault at spatialys.com> 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDALALG_VECTOR_RENAME_LAYER_INCLUDED 14 : #define GDALALG_VECTOR_RENAME_LAYER_INCLUDED 15 : 16 : #include "gdalalg_vector_pipeline.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALVectorRenameLayerAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALVectorRenameLayerAlgorithm /* non final */ 25 : : public GDALVectorPipelineStepAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "rename-layer"; 29 : static constexpr const char *DESCRIPTION = 30 : "Rename layer(s) of a vector dataset."; 31 : static constexpr const char *HELP_URL = 32 : "/programs/gdal_vector_rename_layer.html"; 33 : 34 : explicit GDALVectorRenameLayerAlgorithm(bool standaloneStep = false); 35 : 36 : private: 37 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 38 : 39 : std::string m_inputLayerName{}; 40 : bool m_ascii = false; 41 : bool m_filenameCompatible = false; 42 : bool m_lowerCase = false; 43 : std::string m_reservedChars{}; 44 : std::string m_replacementChar{}; 45 : int m_maxLength = 0; 46 : }; 47 : 48 : /************************************************************************/ 49 : /* GDALVectorRenameLayerAlgorithmStandalone */ 50 : /************************************************************************/ 51 : 52 120 : class GDALVectorRenameLayerAlgorithmStandalone final 53 : : public GDALVectorRenameLayerAlgorithm 54 : { 55 : public: 56 60 : GDALVectorRenameLayerAlgorithmStandalone() 57 60 : : GDALVectorRenameLayerAlgorithm(/* standaloneStep = */ true) 58 : { 59 60 : } 60 : 61 : ~GDALVectorRenameLayerAlgorithmStandalone() override; 62 : }; 63 : 64 : //! @endcond 65 : 66 : #endif /* GDALALG_VECTOR_RENAME_LAYER_INCLUDED */