Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Pavel Zhukov
Kea
Commits
6cc5d94b
Commit
6cc5d94b
authored
Jun 13, 2018
by
Tomek Mrugalski
🛰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[gitlab10/5422] list for specific daemons are now generated.
parent
e0021f33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
13 deletions
+65
-13
tools/cmd-docgen/kea_docgen.cc
tools/cmd-docgen/kea_docgen.cc
+65
-13
No files found.
tools/cmd-docgen/kea_docgen.cc
View file @
6cc5d94b
...
...
@@ -3,6 +3,7 @@
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <exceptions/exceptions.h>
#include <cc/data.h>
...
...
@@ -120,30 +121,79 @@ public:
f
<<
"<!-- autogenerated using cmd_docgen. Do not edit by hand! -->"
<<
endl
;
}
void
generateOutput
()
{
stringstream
f
;
generateCopyright
(
f
);
f
<<
"<chapter xmlns=
\"
http://docbook.org/ns/docbook
\"
version=
\"
5.0
\"
xml:id=
\"
api
\"
>"
<<
endl
;
f
<<
" <title>API Reference</title>"
<<
endl
;
void
generateCmdLink
(
stringstream
&
f
,
const
string
&
cmd
)
{
f
<<
"<command><link linkend=
\"
ref-"
<<
cmd
<<
"
\"
>"
<<
cmd
<<
"</link></command>"
<<
endl
;
}
// Generate initial list of commands
void
generateLists
(
stringstream
&
f
)
{
// Generate a list of all commands
f
<<
" <para>Kea currently supports "
<<
cmds_
.
size
()
<<
" commands:"
<<
endl
;
bool
first
=
true
;
for
(
auto
cmd
:
cmds_
)
{
if
(
!
first
)
{
f
<<
", "
;
generateCmdLink
(
f
,
cmd
.
first
);
}
f
<<
"<command>"
<<
cmd
.
first
<<
"</command>"
<<
endl
;
first
=
false
;
}
f
<<
".</para>"
<<
endl
;
// Generate a list of components:
set
<
string
>
all_daemons
;
for
(
auto
cmd
:
cmds_
)
{
auto
daemons
=
cmd
.
second
->
get
(
"support"
);
for
(
int
i
=
0
;
i
<
daemons
->
size
();
i
++
)
{
string
daemon
=
daemons
->
get
(
i
)
->
stringValue
();
if
(
all_daemons
.
find
(
daemon
)
==
all_daemons
.
end
())
{
all_daemons
.
insert
(
daemon
);
}
}
}
cout
<<
"### "
<<
all_daemons
.
size
()
<<
" daemon(s) detected."
<<
endl
;
for
(
auto
daemon
:
all_daemons
)
{
f
<<
"<para xml:id=
\"
commands-"
<<
daemon
<<
"
\"
>"
<<
"Commands supported by "
<<
daemon
<<
": "
;
bool
first
=
true
;
for
(
auto
cmd
:
cmds_
)
{
first
=
true
;
auto
daemons
=
cmd
.
second
->
get
(
"support"
);
for
(
auto
d
:
daemons
->
listValue
())
{
if
(
d
->
stringValue
()
==
daemon
)
{
if
(
!
first
)
{
f
<<
", "
;
}
generateCmdLink
(
f
,
cmd
.
first
);
first
=
false
;
break
;
// get to next command
}
}
}
f
<<
".</para>"
<<
endl
;
}
}
void
generateOutput
()
{
stringstream
f
;
generateCopyright
(
f
);
f
<<
"<chapter xmlns=
\"
http://docbook.org/ns/docbook
\"
version=
\"
5.0
\"
xml:id=
\"
api
\"
>"
<<
endl
;
f
<<
" <title>API Reference</title>"
<<
endl
;
generateLists
(
f
);
// Generate actual commands references.
generateCommands
(
f
);
...
...
@@ -215,7 +265,8 @@ string standardResponseComment() {
void
generateCommand
(
stringstream
&
f
,
const
ElementPtr
&
cmd
)
{
// command overview
f
<<
"<para><command>"
<<
cmd
->
get
(
"name"
)
->
stringValue
()
<<
"</command> - "
f
<<
"<para xml:id=
\"
ref-"
<<
cmd
->
get
(
"name"
)
->
stringValue
()
<<
"
\"
><command>"
<<
cmd
->
get
(
"name"
)
->
stringValue
()
<<
"</command> - "
<<
cmd
->
get
(
"brief"
)
->
stringValue
()
<<
"</para>"
<<
endl
<<
endl
;
// command can be issued to the following daemons
...
...
@@ -226,7 +277,8 @@ void generateCommand(stringstream& f, const ElementPtr& cmd) {
f
<<
", "
;
}
f
<<
daemons
->
get
(
i
)
->
stringValue
();
f
<<
"<command><link linkend=
\"
commands-"
<<
daemons
->
get
(
i
)
->
stringValue
()
<<
"
\"
>"
<<
daemons
->
get
(
i
)
->
stringValue
()
<<
"</link></command>"
;
}
f
<<
"</para>"
<<
endl
<<
endl
;
...
...
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