Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: gdal "dataset copy" subcommand 5 : * Author: Even Rouault <even dot rouault at spatialys.com> 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com> 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDALALG_DATASET_COPY_INCLUDED 14 : #define GDALALG_DATASET_COPY_INCLUDED 15 : 16 : #include "gdalalgorithm.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALDatasetCopyRenameCommonAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALDatasetCopyRenameCommonAlgorithm /* non-final */ 25 : : public GDALAlgorithm 26 : { 27 : protected: 28 : GDALDatasetCopyRenameCommonAlgorithm(const std::string &name, 29 : const std::string &description, 30 : const std::string &helpURL); 31 : 32 : private: 33 : std::string m_source{}; 34 : std::string m_destination{}; 35 : std::string m_format{}; 36 : bool m_overwrite = false; 37 : 38 : bool RunImpl(GDALProgressFunc, void *) override; 39 : }; 40 : 41 : /************************************************************************/ 42 : /* GDALDatasetCopyAlgorithm */ 43 : /************************************************************************/ 44 : 45 16 : class GDALDatasetCopyAlgorithm final 46 : : public GDALDatasetCopyRenameCommonAlgorithm 47 : { 48 : public: 49 : static constexpr const char *NAME = "copy"; 50 : static constexpr const char *DESCRIPTION = "Copy files of a dataset."; 51 : static constexpr const char *HELP_URL = "/programs/gdal_dataset_copy.html"; 52 : 53 29 : static std::vector<std::string> GetAliasesStatic() 54 : { 55 58 : return {"cp"}; 56 : } 57 : 58 : GDALDatasetCopyAlgorithm(); 59 : ~GDALDatasetCopyAlgorithm() override; 60 : }; 61 : 62 : //! @endcond 63 : 64 : #endif