Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
b356d8f9
Commit
b356d8f9
authored
Oct 05, 2022
by
Rémi Cresson
Browse files
REFAC: shorter code, DOC: explainations
parent
b949b27a
Pipeline
#11688
failed with stages
in 80 minutes and 32 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Modules/Core/Common/src/otbExtendedFilenameHelper.cxx
View file @
b356d8f9
...
...
@@ -47,10 +47,12 @@ void ExtendedFilenameHelper::SetExtendedFileName(const std::string& extFname)
std
::
vector
<
std
::
string
>
splits
;
if
(
!
m_ExtendedFileName
.
empty
())
{
// We consider that everything before "?&" is the file path, and
// everything after (if any) are the extended filename options.
// This is more secure than considering only "?" since the path
// can be a vsicurl URI containing some "?" chars.
// We consider that everything before the last occurrence of "?&" is
// the file path, and everything after (if any) are the extended
// filename options. This is more secure than considering only "?" since
// the path can be a vsicurl URI containing some "?" chars, and the
// documentation clearly states that the right pattern for extended
// filenames is "file.tif?&key1=value1&...&keyN=valueN".
auto
locator
=
m_ExtendedFileName
.
rfind
(
"?&"
);
auto
fileName
=
m_ExtendedFileName
.
substr
(
0
,
locator
);
this
->
SetSimpleFileName
(
fileName
);
...
...
@@ -58,11 +60,11 @@ void ExtendedFilenameHelper::SetExtendedFileName(const std::string& extFname)
{
auto
extension
=
m_ExtendedFileName
.
substr
(
locator
+
1
);
boost
::
split
(
splits
,
extension
,
boost
::
is_any_of
(
"&"
),
boost
::
token_compress_on
);
for
(
unsigned
int
i
=
0
;
i
<
splits
.
size
();
i
++
)
if
(
!
split
s
[
i
]
.
empty
())
for
(
const
auto
&
split
:
splits
)
if
(
!
split
.
empty
())
{
std
::
vector
<
std
::
string
>
tmp
;
boost
::
split
(
tmp
,
split
s
[
i
]
,
boost
::
is_any_of
(
"="
),
boost
::
token_compress_on
);
boost
::
split
(
tmp
,
split
,
boost
::
is_any_of
(
"="
),
boost
::
token_compress_on
);
if
(
tmp
.
size
()
>
1
)
{
auto
key
=
tmp
[
0
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment