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
Container Registry
Model registry
Operate
Environments
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
Main Repositories
otb
Commits
100839af
Commit
100839af
authored
13 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
STYLE: fix typo
parent
56ee4d4c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Common/otbCommandLineArgumentParser.cxx
+19
-10
19 additions, 10 deletions
Code/Common/otbCommandLineArgumentParser.cxx
Code/Common/otbCommandLineArgumentParser.h
+14
-15
14 additions, 15 deletions
Code/Common/otbCommandLineArgumentParser.h
with
33 additions
and
25 deletions
Code/Common/otbCommandLineArgumentParser.cxx
+
19
−
10
View file @
100839af
...
...
@@ -25,7 +25,12 @@
namespace
otb
{
// --------- CommandLineArgumentParseResult ----------------------------------------
// --------- CommandLineArgumentParseResult
// --------- ----------------------------------------
CommandLineArgumentParseResult
::
CommandLineArgumentParseResult
()
{}
CommandLineArgumentParseResult
::~
CommandLineArgumentParseResult
()
{}
void
CommandLineArgumentParseResult
::
PrintSelf
(
std
::
ostream
&
/*os*/
/*, itk::Indent indent*/
)
const
{
...
...
@@ -123,6 +128,10 @@ CommandLineArgumentParser
m_ProgramDescription
.
clear
();
}
CommandLineArgumentParser
::~
CommandLineArgumentParser
()
{}
void
CommandLineArgumentParser
::
AddInputImage
(
bool
obligatory
)
{
...
...
@@ -136,13 +145,13 @@ void CommandLineArgumentParser
}
void
CommandLineArgumentParser
::
AddOption
(
std
::
string
name
,
std
::
string
comment
,
std
::
string
synon
i
m
,
int
nParameters
,
bool
obligatory
)
::
AddOption
(
std
::
string
name
,
std
::
string
comment
,
std
::
string
synon
y
m
,
int
nParameters
,
bool
obligatory
)
{
// Create a structure for the command
OptionType
option
;
option
.
CommonName
=
name
;
option
.
Description
=
comment
;
option
.
Synon
i
m
=
synon
i
m
;
option
.
Synon
y
m
=
synon
y
m
;
option
.
NumberOfParameters
=
nParameters
;
option
.
NumberOfParametersFixed
=
true
;
option
.
Obligatory
=
obligatory
;
...
...
@@ -154,13 +163,13 @@ void CommandLineArgumentParser
}
void
CommandLineArgumentParser
::
AddOptionNParams
(
std
::
string
name
,
std
::
string
comment
,
std
::
string
synon
i
m
,
bool
obligatory
)
::
AddOptionNParams
(
std
::
string
name
,
std
::
string
comment
,
std
::
string
synon
y
m
,
bool
obligatory
)
{
// Create a structure for the command
OptionType
option
;
option
.
CommonName
=
name
;
option
.
Description
=
comment
;
option
.
Synon
i
m
=
synon
i
m
;
option
.
Synon
y
m
=
synon
y
m
;
option
.
NumberOfParameters
=
-
1
;
option
.
NumberOfParametersFixed
=
false
;
option
.
Obligatory
=
obligatory
;
...
...
@@ -348,7 +357,7 @@ bool CommandLineArgumentParser::FindOption(const std::string& option, int& index
std
::
string
strOption
(
option
);
while
(
goOnFlag
==
true
)
{
if
((
m_OptionList
[
cpt
].
CommonName
==
strOption
)
||
(
m_OptionList
[
cpt
].
Synon
i
m
==
strOption
))
if
((
m_OptionList
[
cpt
].
CommonName
==
strOption
)
||
(
m_OptionList
[
cpt
].
Synon
y
m
==
strOption
))
{
index
=
cpt
;
goOnFlag
=
false
;
...
...
@@ -379,7 +388,7 @@ void CommandLineArgumentParser::PrintUsage(std::ostream& os) const
for
(
i
=
0
;
i
<
m_OptionList
.
size
();
++
i
)
{
int
largeur
=
m_OptionList
[
i
].
CommonName
.
size
()
+
m_OptionList
[
i
].
Synon
i
m
.
size
();
int
largeur
=
m_OptionList
[
i
].
CommonName
.
size
()
+
m_OptionList
[
i
].
Synon
y
m
.
size
();
if
(
largeur
>
largeurmax
)
largeurmax
=
largeur
;
}
...
...
@@ -388,14 +397,14 @@ void CommandLineArgumentParser::PrintUsage(std::ostream& os) const
{
if
(
m_OptionList
[
i
].
CommonName
!=
"--OTBTesting"
)
{
int
largeur
=
m_OptionList
[
i
].
CommonName
.
size
()
+
m_OptionList
[
i
].
Synon
i
m
.
size
();
int
largeur
=
m_OptionList
[
i
].
CommonName
.
size
()
+
m_OptionList
[
i
].
Synon
y
m
.
size
();
os
<<
" "
;
if
(
m_OptionList
[
i
].
Obligatory
==
false
)
os
<<
"["
;
else
os
<<
" "
;
os
<<
m_OptionList
[
i
].
CommonName
;
if
(
m_OptionList
[
i
].
Synon
i
m
.
empty
()
==
false
)
if
(
m_OptionList
[
i
].
Synon
y
m
.
empty
()
==
false
)
{
os
<<
"|"
<<
m_OptionList
[
i
].
Synon
i
m
;
os
<<
"|"
<<
m_OptionList
[
i
].
Synon
y
m
;
}
if
(
m_OptionList
[
i
].
Obligatory
==
false
)
os
<<
"]"
;
else
os
<<
" "
;
...
...
This diff is collapsed.
Click to expand it.
Code/Common/otbCommandLineArgumentParser.h
+
14
−
15
View file @
100839af
...
...
@@ -140,14 +140,14 @@ public:
#define otbGetParameterMacro(name, type) \
virtual type GetParameter ## name (std::string option, unsigned int number = 0) const \
{
\
std::string parameter = this->GetParameterString(option, number);
\
type lValeur;
\
::otb::StringStream flux;
\
flux << parameter;
\
flux >> lValeur;
\
return lValeur;
\
}
{
\
std::string parameter = this->GetParameterString(option, number); \
type lValeur; \
::otb::StringStream flux; \
flux << parameter; \
flux >> lValeur; \
return lValeur; \
}
otbGetParameterMacro
(
Char
,
char
);
otbGetParameterMacro
(
Short
,
short
);
...
...
@@ -165,11 +165,10 @@ public:
std
::
string
GetOutputImage
(
void
)
const
;
protected:
CommandLineArgumentParseResult
()
{}
;
virtual
~
CommandLineArgumentParseResult
()
{}
CommandLineArgumentParseResult
();
virtual
~
CommandLineArgumentParseResult
()
;
private:
template
<
typename
TypeValeur
>
TypeValeur
GetParameter
(
std
::
string
option
,
unsigned
int
number
=
0
)
const
;
...
...
@@ -235,12 +234,12 @@ public:
/** Add a new option with fixed number of parameters */
void
AddOption
(
std
::
string
name
,
std
::
string
comment
,
std
::
string
synon
i
m
=
NULL
,
std
::
string
synon
y
m
=
NULL
,
int
nParameters
=
1
,
bool
obligatory
=
true
);
/** Add a new option with unknown number of parameters */
void
AddOptionNParams
(
std
::
string
name
,
std
::
string
comment
,
std
::
string
synon
i
m
=
NULL
,
bool
obligatory
=
true
);
void
AddOptionNParams
(
std
::
string
name
,
std
::
string
comment
,
std
::
string
synon
y
m
=
NULL
,
bool
obligatory
=
true
);
/** Interpret options from the command line */
void
ParseCommandLine
(
int
argc
,
char
*
argv
[],
...
...
@@ -249,7 +248,7 @@ public:
protected:
CommandLineArgumentParser
();
virtual
~
CommandLineArgumentParser
()
{}
virtual
~
CommandLineArgumentParser
()
;
private:
...
...
@@ -268,7 +267,7 @@ private:
{
std
::
string
CommonName
;
// option name
std
::
string
Description
;
// option description
std
::
string
Synon
i
m
;
// shortcut
std
::
string
Synon
y
m
;
// shortcut
bool
NumberOfParametersFixed
;
// required number of values
int
NumberOfParameters
;
// number of values
bool
Obligatory
;
// is the option mandatory ?
...
...
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