MCPcopy Create free account
hub / github.com/OSGeo/gdal / ModifyPathComponent

Method ModifyPathComponent

gcore/gdalsubdatasetinfo.cpp:99–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99std::string
100GDALSubdatasetInfo::ModifyPathComponent(const std::string &newPathName) const
101{
102 init();
103
104 std::string replaced{m_fileName};
105
106 try
107 {
108 auto newPathName_{newPathName};
109 if (m_isQuoted)
110 {
111 if (newPathName_.length() >= 2 && newPathName_.at(0) != '"' &&
112 newPathName_.at(newPathName_.length() - 1) != '"')
113 {
114 newPathName_ = quote(newPathName_);
115 }
116 }
117 replaced.replace(replaced.find(m_pathComponent),
118 m_pathComponent.length(), newPathName_);
119 }
120 catch (const std::out_of_range &)
121 {
122 return "";
123 }
124
125 return replaced;
126}
127
128std::string GDALSubdatasetInfo::GetSubdatasetComponent() const
129{

Calls 2

initFunction · 0.50
lengthMethod · 0.45