10
10
* SPDX-License-Identifier: MIT
11
11
****************************************************************************/
12
12
13
- #include " gdalalgorithm .h"
13
+ #include " gdalalg_vsi_sozip .h"
14
14
15
15
#include " cpl_conv.h"
16
16
#include " cpl_string.h"
25
25
#endif
26
26
27
27
/* ***********************************************************************/
28
- /* GDALSOZIPCreateBaseAlgorithm */
28
+ /* GDALVSISOZIPCreateBaseAlgorithm */
29
29
/* ***********************************************************************/
30
30
31
- class GDALSOZIPCreateBaseAlgorithm /* non final */ : public GDALAlgorithm
31
+ class GDALVSISOZIPCreateBaseAlgorithm /* non final */ : public GDALAlgorithm
32
32
{
33
33
protected:
34
- GDALSOZIPCreateBaseAlgorithm (const std::string &name,
35
- const std::string &description,
36
- const std::string &helpURL, bool optimizeFrom)
34
+ GDALVSISOZIPCreateBaseAlgorithm (const std::string &name,
35
+ const std::string &description,
36
+ const std::string &helpURL,
37
+ bool optimizeFrom)
37
38
: GDALAlgorithm(name, description, helpURL),
38
39
m_optimizeFrom (optimizeFrom)
39
40
{
@@ -143,11 +144,11 @@ class GDALSOZIPCreateBaseAlgorithm /* non final */ : public GDALAlgorithm
143
144
};
144
145
145
146
/* ***********************************************************************/
146
- /* GDALSOZIPCreateBaseAlgorithm ::RunImpl() */
147
+ /* GDALVSISOZIPCreateBaseAlgorithm ::RunImpl() */
147
148
/* ***********************************************************************/
148
149
149
- bool GDALSOZIPCreateBaseAlgorithm ::RunImpl (GDALProgressFunc pfnProgress,
150
- void *pProgressData)
150
+ bool GDALVSISOZIPCreateBaseAlgorithm ::RunImpl (GDALProgressFunc pfnProgress,
151
+ void *pProgressData)
151
152
{
152
153
CPLStringList aosOptions;
153
154
aosOptions.SetNameValue (" SOZIP_ENABLED" , m_mode.c_str ());
@@ -343,54 +344,55 @@ bool GDALSOZIPCreateBaseAlgorithm::RunImpl(GDALProgressFunc pfnProgress,
343
344
}
344
345
345
346
/* ***********************************************************************/
346
- /* GDALSOZIPCreateAlgorithm */
347
+ /* GDALVSISOZIPCreateAlgorithm */
347
348
/* ***********************************************************************/
348
349
349
- class GDALSOZIPCreateAlgorithm final : public GDALSOZIPCreateBaseAlgorithm
350
+ class GDALVSISOZIPCreateAlgorithm final : public GDALVSISOZIPCreateBaseAlgorithm
350
351
{
351
352
public:
352
353
static constexpr const char *NAME = " create" ;
353
354
static constexpr const char *DESCRIPTION =
354
355
" Create a Seek-optimized ZIP (SOZIP) file." ;
355
- static constexpr const char *HELP_URL = " /programs/gdal_sozip .html" ;
356
+ static constexpr const char *HELP_URL = " /programs/gdal_vsi_sozip .html" ;
356
357
357
- GDALSOZIPCreateAlgorithm ()
358
- : GDALSOZIPCreateBaseAlgorithm (NAME, DESCRIPTION, HELP_URL, false )
358
+ GDALVSISOZIPCreateAlgorithm ()
359
+ : GDALVSISOZIPCreateBaseAlgorithm (NAME, DESCRIPTION, HELP_URL, false )
359
360
{
360
361
}
361
362
};
362
363
363
364
/* ***********************************************************************/
364
- /* GDALSOZIPOptimizeAlgorithm */
365
+ /* GDALVSISOZIPOptimizeAlgorithm */
365
366
/* ***********************************************************************/
366
367
367
- class GDALSOZIPOptimizeAlgorithm final : public GDALSOZIPCreateBaseAlgorithm
368
+ class GDALVSISOZIPOptimizeAlgorithm final
369
+ : public GDALVSISOZIPCreateBaseAlgorithm
368
370
{
369
371
public:
370
372
static constexpr const char *NAME = " optimize" ;
371
373
static constexpr const char *DESCRIPTION =
372
374
" Create a Seek-optimized ZIP (SOZIP) file from a regular ZIP file." ;
373
- static constexpr const char *HELP_URL = " /programs/gdal_sozip .html" ;
375
+ static constexpr const char *HELP_URL = " /programs/gdal_vsi_sozip .html" ;
374
376
375
- GDALSOZIPOptimizeAlgorithm ()
376
- : GDALSOZIPCreateBaseAlgorithm (NAME, DESCRIPTION, HELP_URL, true )
377
+ GDALVSISOZIPOptimizeAlgorithm ()
378
+ : GDALVSISOZIPCreateBaseAlgorithm (NAME, DESCRIPTION, HELP_URL, true )
377
379
{
378
380
}
379
381
};
380
382
381
383
/* ***********************************************************************/
382
- /* GDALSOZIPListAlgorithm */
384
+ /* GDALVSISOZIPListAlgorithm */
383
385
/* ***********************************************************************/
384
386
385
- class GDALSOZIPListAlgorithm final : public GDALAlgorithm
387
+ class GDALVSISOZIPListAlgorithm final : public GDALAlgorithm
386
388
{
387
389
public:
388
390
static constexpr const char *NAME = " list" ;
389
391
static constexpr const char *DESCRIPTION =
390
392
" List content of a ZIP file, with SOZIP related information." ;
391
- static constexpr const char *HELP_URL = " /programs/gdal_sozip .html" ;
393
+ static constexpr const char *HELP_URL = " /programs/gdal_vsi_sozip .html" ;
392
394
393
- GDALSOZIPListAlgorithm () : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
395
+ GDALVSISOZIPListAlgorithm () : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
394
396
{
395
397
AddArg (" input" , ' i' , _ (" Input ZIP filename" ), &m_zipFilename)
396
398
.SetRequired ()
@@ -406,10 +408,10 @@ class GDALSOZIPListAlgorithm final : public GDALAlgorithm
406
408
};
407
409
408
410
/* ***********************************************************************/
409
- /* GDALSOZIPListAlgorithm ::RunImpl() */
411
+ /* GDALVSISOZIPListAlgorithm ::RunImpl() */
410
412
/* ***********************************************************************/
411
413
412
- bool GDALSOZIPListAlgorithm ::RunImpl (GDALProgressFunc, void *)
414
+ bool GDALVSISOZIPListAlgorithm ::RunImpl (GDALProgressFunc, void *)
413
415
{
414
416
std::unique_ptr<VSIDIR, decltype (&VSICloseDir)> psDir (
415
417
VSIOpenDir (std::string (" /vsizip/" ).append (m_zipFilename).c_str (), -1 ,
@@ -471,18 +473,18 @@ bool GDALSOZIPListAlgorithm::RunImpl(GDALProgressFunc, void *)
471
473
}
472
474
473
475
/* ***********************************************************************/
474
- /* GDALSOZIPValidateAlgorithm */
476
+ /* GDALVSISOZIPValidateAlgorithm */
475
477
/* ***********************************************************************/
476
478
477
- class GDALSOZIPValidateAlgorithm final : public GDALAlgorithm
479
+ class GDALVSISOZIPValidateAlgorithm final : public GDALAlgorithm
478
480
{
479
481
public:
480
482
static constexpr const char *NAME = " validate" ;
481
483
static constexpr const char *DESCRIPTION =
482
484
" Validate a ZIP file, possibly using SOZIP optimization." ;
483
- static constexpr const char *HELP_URL = " /programs/gdal_sozip .html" ;
485
+ static constexpr const char *HELP_URL = " /programs/gdal_vsi_sozip .html" ;
484
486
485
- GDALSOZIPValidateAlgorithm () : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
487
+ GDALVSISOZIPValidateAlgorithm () : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
486
488
{
487
489
AddArg (" input" , ' i' , _ (" Input ZIP filename" ), &m_zipFilename)
488
490
.SetRequired ()
@@ -523,10 +525,10 @@ class GDALSOZIPValidateAlgorithm final : public GDALAlgorithm
523
525
};
524
526
525
527
/* ***********************************************************************/
526
- /* GDALSOZIPValidateAlgorithm ::RunImpl() */
528
+ /* GDALVSISOZIPValidateAlgorithm ::RunImpl() */
527
529
/* ***********************************************************************/
528
530
529
- bool GDALSOZIPValidateAlgorithm ::RunImpl (GDALProgressFunc, void *)
531
+ bool GDALVSISOZIPValidateAlgorithm ::RunImpl (GDALProgressFunc, void *)
530
532
{
531
533
std::unique_ptr<VSIDIR, decltype (&VSICloseDir)> psDir (
532
534
VSIOpenDir (std::string (" /vsizip/" ).append (m_zipFilename).c_str (), -1 ,
@@ -839,35 +841,16 @@ bool GDALSOZIPValidateAlgorithm::RunImpl(GDALProgressFunc, void *)
839
841
}
840
842
841
843
/* ***********************************************************************/
842
- /* GDALSOZIPAlgorithm */
844
+ /* GDALVSISOZIPAlgorithm::GDALVSISOZIPAlgorithm() */
843
845
/* ***********************************************************************/
844
846
845
- class GDALSOZIPAlgorithm final : public GDALAlgorithm
847
+ GDALVSISOZIPAlgorithm::GDALVSISOZIPAlgorithm ()
848
+ : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
846
849
{
847
- public:
848
- static constexpr const char *NAME = " sozip" ;
849
- static constexpr const char *DESCRIPTION =
850
- " Seek-optimized ZIP (SOZIP) commands." ;
851
- static constexpr const char *HELP_URL = " /programs/gdal_sozip.html" ;
852
-
853
- GDALSOZIPAlgorithm () : GDALAlgorithm(NAME, DESCRIPTION, HELP_URL)
854
- {
855
- RegisterSubAlgorithm<GDALSOZIPCreateAlgorithm>();
856
- RegisterSubAlgorithm<GDALSOZIPOptimizeAlgorithm>();
857
- RegisterSubAlgorithm<GDALSOZIPListAlgorithm>();
858
- RegisterSubAlgorithm<GDALSOZIPValidateAlgorithm>();
859
- }
860
-
861
- private:
862
- bool RunImpl (GDALProgressFunc, void *) override
863
- {
864
- CPLError (CE_Failure, CPLE_AppDefined,
865
- " The Run() method should not be called directly on the \" gdal "
866
- " sozip\" program." );
867
- return false ;
868
- }
869
- };
870
-
871
- GDAL_STATIC_REGISTER_ALG (GDALSOZIPAlgorithm);
850
+ RegisterSubAlgorithm<GDALVSISOZIPCreateAlgorithm>();
851
+ RegisterSubAlgorithm<GDALVSISOZIPOptimizeAlgorithm>();
852
+ RegisterSubAlgorithm<GDALVSISOZIPListAlgorithm>();
853
+ RegisterSubAlgorithm<GDALVSISOZIPValidateAlgorithm>();
854
+ }
872
855
873
856
// ! @endcond
0 commit comments