Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
ea41802a
Commit
ea41802a
authored
Nov 29, 2011
by
Cyrille Valladeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: improve DocExample
parent
d003f8a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
52 deletions
+19
-52
Code/ApplicationEngine/otbWrapperDocExampleStructure.h
Code/ApplicationEngine/otbWrapperDocExampleStructure.h
+16
-38
Testing/Code/ApplicationEngine/CMakeLists.txt
Testing/Code/ApplicationEngine/CMakeLists.txt
+2
-2
Testing/Code/ApplicationEngine/otbWrapperDocExampleStructureTest.cxx
...e/ApplicationEngine/otbWrapperDocExampleStructureTest.cxx
+1
-12
No files found.
Code/ApplicationEngine/otbWrapperDocExampleStructure.h
View file @
ea41802a
...
...
@@ -64,7 +64,6 @@ public:
/** Parameter list accessors : adding key and name */
void
AddParameter
(
const
std
::
string
key
,
const
std
::
string
name
)
{
std
::
cout
<<
"DocExampleStructure::AddParameter"
<<
std
::
endl
;
ThreeStringType
mParam
;
mParam
[
0
]
=
key
;
mParam
[
1
]
=
name
;
...
...
@@ -132,38 +131,17 @@ public:
{
return
m_ApplicationName
;
}
/** Set the list of paths. */
void
SetBinPath
(
const
std
::
vector
<
std
::
string
>
bPath
)
{
m_BinPath
=
bPath
;
}
/** Add a path to the list. */
void
AddBinPath
(
std
::
string
myPath
)
{
m_BinPath
.
push_back
(
myPath
);
}
/** Get the list of paths. */
std
::
vector
<
std
::
string
>
GetBinPath
()
{
return
m_BinPath
;
}
/** Generation of the documentation for CommandLine. */
std
::
string
GenerateCLExample
()
{
if
(
m_ApplicationName
.
empty
()
||
m_BinPath
.
size
()
==
0
||
m_ParameterList
.
size
()
==
0
)
if
(
m_ApplicationName
.
empty
()
||
m_ParameterList
.
size
()
==
0
)
{
return
""
;
}
itk
::
OStringStream
oss
;
oss
<<
OTB_CONFIG
<<
"/bin/otbApplicationLauncherCommandLine "
;
oss
<<
m_ApplicationName
<<
" "
;
for
(
unsigned
int
i
=
0
;
i
<
m_BinPath
.
size
();
i
++
)
{
oss
<<
m_BinPath
[
i
]
<<
" "
;
}
oss
<<
"otbcli_"
<<
m_ApplicationName
<<
" "
;
for
(
unsigned
int
i
=
0
;
i
<
m_ParameterList
.
size
();
i
++
)
{
...
...
@@ -184,22 +162,29 @@ public:
}
/** Generation of teh documentation for Qt. */
std
::
string
Generate
Qt
Example
()
std
::
string
Generate
Html
Example
()
{
if
(
m_ApplicationName
.
empty
()
||
m_BinPath
.
size
()
==
0
||
m_ParameterList
.
size
()
==
0
)
if
(
m_ApplicationName
.
empty
()
||
m_ParameterList
.
size
()
==
0
)
{
return
""
;
}
itk
::
OStringStream
oss
;
oss
<<
"<ul>"
;
for
(
unsigned
int
i
=
0
;
i
<
m_ParameterList
.
size
();
i
++
)
{
if
(
this
->
GetParameterValue
(
i
)
!=
""
)
{
oss
<<
this
->
GetParameterName
(
i
)
<<
": "
<<
this
->
GetParameterValue
(
i
)
<<
"<br />"
;
oss
<<
"<li>"
;
oss
<<
"<p style=
\"
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
\"
>"
;
oss
<<
this
->
GetParameterName
(
i
)
<<
": "
;
oss
<<
this
->
GetParameterValue
(
i
);
oss
<<
"</p>"
;
oss
<<
"</li>"
;
}
}
oss
<<
"</ul>"
;
std
::
string
res
=
oss
.
str
();
...
...
@@ -210,12 +195,7 @@ public:
protected:
/** Constructor */
DocExampleStructure
()
{
itk
::
OStringStream
oss
;
oss
<<
OTB_CONFIG
<<
"/bin"
;
m_BinPath
.
push_back
(
oss
.
str
()
);
}
DocExampleStructure
(){}
/** Destructor */
virtual
~
DocExampleStructure
()
...
...
@@ -225,14 +205,12 @@ private:
DocExampleStructure
(
const
DocExampleStructure
&
);
//purposely not implemented
void
operator
=
(
const
DocExampleStructure
&
);
//purposely not implemented
/** List of the application parameters. List of key/value couples. */
/** List of the application parameters. List of key/
name/
value couples. */
ParameterListType
m_ParameterList
;
/** List of the application parameter names. List of key/name couples. */
ParameterListType
m_ParameterNameList
;
ParameterListType
m_ParameterNameList
;
// ???
/** application name */
std
::
string
m_ApplicationName
;
/** paths where to the application. */
std
::
vector
<
std
::
string
>
m_BinPath
;
};
// End class Parameter
...
...
Testing/Code/ApplicationEngine/CMakeLists.txt
View file @
ea41802a
...
...
@@ -171,8 +171,8 @@ add_test(NAME owTvApplicationHtmlDocGeneratorTest
endif
(
BUILD_APPLICATIONS
)
# DocExampleStructure
add_test
(
owTuDocExampleStructure
${
OTB_WRAPPER_TESTS
}
otbWrapperDocExampleStructure
add_test
(
owTuDocExampleStructure
New
${
OTB_WRAPPER_TESTS
}
otbWrapperDocExampleStructure
New
)
add_test
(
owTuDocExampleStructureTest
${
OTB_WRAPPER_TESTS
}
...
...
Testing/Code/ApplicationEngine/otbWrapperDocExampleStructureTest.cxx
View file @
ea41802a
...
...
@@ -41,9 +41,6 @@ int otbWrapperDocExampleStructureTest(int argc, char* argv[])
std
::
vector
<
std
::
string
>
bPath
;
bPath
.
push_back
(
"binPath1"
);
docStruct
->
SetBinPath
(
bPath
);
docStruct
->
AddBinPath
(
"binPath2"
);
docStruct
->
AddParameter
(
"key1"
,
"name1"
);
docStruct
->
AddParameter
(
"key2"
,
"name2"
);
...
...
@@ -52,21 +49,13 @@ int otbWrapperDocExampleStructureTest(int argc, char* argv[])
std
::
string
exp
=
docStruct
->
GenerateCLExample
();
if
(
exp
.
find
(
"otbApplication
LauncherCommandLine binPath1 binPath2
-key1 val1 -key2 val2"
)
==
std
::
string
::
npos
)
if
(
exp
.
find
(
"otb
cli_Test
Application -key1 val1 -key2 val2"
)
==
std
::
string
::
npos
)
{
std
::
cout
<<
"ERROR in expression: "
<<
exp
<<
std
::
endl
;
std
::
cout
<<
"The returned expression is not the waited one"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
std
::
cout
<<
exp
.
substr
(
0
,
exp
.
find_first_of
(
" "
)
)
<<
std
::
endl
;
if
(
!
itksys
::
SystemTools
::
FileExists
(
exp
.
substr
(
0
,
exp
.
find_first_of
(
" "
)
).
c_str
()
)
)
{
std
::
cout
<<
"ERROR in expression: "
<<
exp
<<
std
::
endl
;
std
::
cout
<<
"The executable is not valid"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
return
EXIT_SUCCESS
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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