Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
12e31c90
Commit
12e31c90
authored
13 years ago
by
Jonathan Guinet
Browse files
Options
Downloads
Patches
Plain Diff
BUG: IsAttribute Method gives bad results with non-existant parameters.
parent
dbf0e085
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx
+7
-16
7 additions, 16 deletions
Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx
with
7 additions
and
16 deletions
Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx
+
7
−
16
View file @
12e31c90
...
...
@@ -181,7 +181,7 @@ CommandLineParser::GetAttribut( const std::string & key, const std::string & exp
tempModKey
=
expFromKey
.
substr
(
0
,
expFromKey
.
find
(
"--"
)
-
1
);
}
// Only if the key has values assciated
// Only if the key has values ass
o
ciated
if
(
tempModKey
.
size
()
>
0
)
{
std
::
vector
<
itksys
::
String
>
spaceSplitted
=
itksys
::
SystemTools
::
SplitString
(
tempModKey
.
substr
(
1
,
tempModKey
.
size
()).
c_str
(),
' '
,
false
);
...
...
@@ -196,7 +196,7 @@ CommandLineParser::GetAttribut( const std::string & key, const std::string & exp
}
}
// Remove space at the begining of the string and cast into std::vector<std::string>
// Remove space at the begin
n
ing of the string and cast into std::vector<std::string>
for
(
unsigned
int
i
=
0
;
i
<
spaceSplitted
.
size
();
i
++
)
{
while
(
spaceSplitted
[
i
].
size
()
>
0
&&
spaceSplitted
[
i
][
0
]
==
' '
)
...
...
@@ -244,21 +244,12 @@ bool
CommandLineParser
::
IsAttributExists
(
const
std
::
string
key
,
const
std
::
string
&
exp
)
{
std
::
string
keySpaced
=
key
;
// Add space to avoid troubles with key twhich starts by another one : --out and --outmax for example
std
::
string
expSpaced
=
exp
;
// Add space to avoid troubles with key which starts by another one : --out and --outmax for example
keySpaced
.
append
(
" "
);
std
::
size_t
found
=
exp
.
find
(
keySpaced
);
if
(
found
==
std
::
string
::
npos
)
{
// Case the attribut is at the end of the expression : no space
found
=
exp
.
find
(
key
);
if
(
found
==
std
::
string
::
npos
)
{
return
false
;
}
return
true
;
}
return
true
;
expSpaced
.
append
(
" "
);
std
::
size_t
found
=
expSpaced
.
find
(
keySpaced
);
return
(
found
!=
std
::
string
::
npos
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment