GDAL
gdalsubdatasetinfo.h
1/***************************************************************************
2 gdal_subdatasetinfo.h - GDALSubdatasetInfo
3
4 ---------------------
5 begin : 21.7.2023
6 copyright : (C) 2023 by Alessndro Pasotti
7 email : elpaso@itopen.it
8 ***************************************************************************
9 * *
10 * SPDX-License-Identifier: MIT
11 * *
12 ***************************************************************************/
13#ifndef GDALSUBDATASETINFO_H
14#define GDALSUBDATASETINFO_H
15
16#include "cpl_port.h"
17#include <string>
18
26struct CPL_DLL GDALSubdatasetInfo
27{
28
29 public:
34 GDALSubdatasetInfo(const std::string &fileName);
35
36 virtual ~GDALSubdatasetInfo();
37
44 std::string GetPathComponent() const;
45
55 std::string ModifyPathComponent(const std::string &newPathName) const;
56
63 std::string GetSubdatasetComponent() const;
64
66 protected:
71 virtual void parseFileName() = 0;
72
76 static std::string quote(const std::string &path);
77
81 static std::string unquote(const std::string &path);
82
84 std::string m_fileName;
86 std::string m_pathComponent;
88 std::string m_cleanedPathComponent;
90 std::string m_subdatasetComponent;
92 std::string m_driverPrefixComponent;
94 bool m_isQuoted = false;
95
96 private:
97 mutable bool m_initialized = false;
98
99 void init() const;
100
102};
103
104#endif // GDALSUBDATASETINFO_H
Core portability definitions for CPL.
GDALSubdatasetInfo(const std::string &fileName)
Construct a GDALSubdatasetInfo object from a subdataset file descriptor.
Definition gdalsubdatasetinfo.cpp:85
std::string GetPathComponent() const
Returns the unquoted and unescaped path component of the complete file descriptor stripping any subda...
Definition gdalsubdatasetinfo.cpp:93
std::string ModifyPathComponent(const std::string &newPathName) const
Replaces the path component of the complete file descriptor by keeping the subdataset and any other c...
Definition gdalsubdatasetinfo.cpp:100
std::string GetSubdatasetComponent() const
Returns the subdataset component of the file name.
Definition gdalsubdatasetinfo.cpp:128