LCOV - code coverage report
Current view: top level - apps - gdalalg_vfs_copy.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 2 2 100.0 %
Date: 2025-04-16 00:42:22 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "vfs 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_VFS_COPY_INCLUDED
      14             : #define GDALALG_VFS_COPY_INCLUDED
      15             : 
      16             : #include "gdalalgorithm.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                          GDALVFSCopyAlgorithm                        */
      22             : /************************************************************************/
      23             : 
      24             : class GDALVFSCopyAlgorithm final : public GDALAlgorithm
      25             : {
      26             :   public:
      27             :     static constexpr const char *NAME = "copy";
      28             :     static constexpr const char *DESCRIPTION =
      29             :         "Copy files located on GDAL Virtual file systems (VSI).";
      30             :     static constexpr const char *HELP_URL = "/programs/gdal_vfs_copy.html";
      31             : 
      32          40 :     static std::vector<std::string> GetAliasesStatic()
      33             :     {
      34          80 :         return {"cp"};
      35             :     }
      36             : 
      37             :     GDALVFSCopyAlgorithm();
      38             : 
      39             :   private:
      40             :     std::string m_source{};
      41             :     std::string m_destination{};
      42             :     bool m_recursive = false;
      43             :     bool m_skip = false;
      44             : 
      45             :     bool RunImpl(GDALProgressFunc, void *) override;
      46             : 
      47             :     bool CopySingle(const std::string &src, const std::string &dst,
      48             :                     uint64_t size, GDALProgressFunc pfnProgress,
      49             :                     void *pProgressData) const;
      50             : 
      51             :     bool CopyRecursive(const std::string &src, const std::string &dst,
      52             :                        int depth, int maxdepth, uint64_t &curAmount,
      53             :                        uint64_t totalAmount, GDALProgressFunc pfnProgress,
      54             :                        void *pProgressData) const;
      55             : };
      56             : 
      57             : //! @endcond
      58             : 
      59             : #endif

Generated by: LCOV version 1.14