Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
UERANSIM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
UERANSIM
Commits
668787e0
Commit
668787e0
authored
Mar 31, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Options parser improvement
parent
7e3fccd5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
src/utils/options.cpp
src/utils/options.cpp
+10
-4
src/utils/options.hpp
src/utils/options.hpp
+1
-0
No files found.
src/utils/options.cpp
View file @
668787e0
...
@@ -349,10 +349,16 @@ std::string opt::OptionsResult::getPositional(int index) const
...
@@ -349,10 +349,16 @@ std::string opt::OptionsResult::getPositional(int index) const
std
::
string
opt
::
OptionsResult
::
getOption
(
const
OptionItem
&
item
)
const
std
::
string
opt
::
OptionsResult
::
getOption
(
const
OptionItem
&
item
)
const
{
{
if
(
item
.
shortName
.
has_value
()
&&
m_options
.
count
(
std
::
string
(
1
,
*
item
.
shortName
))
>
0
)
return
getOption
(
item
.
shortName
,
item
.
longName
);
return
m_options
.
at
(
std
::
string
(
1
,
*
item
.
shortName
));
}
if
(
item
.
longName
.
has_value
()
&&
m_options
.
count
(
*
item
.
longName
))
return
m_options
.
at
(
*
item
.
longName
);
std
::
string
opt
::
OptionsResult
::
getOption
(
const
std
::
optional
<
char
>
&
shortName
,
const
std
::
optional
<
std
::
string
>
&
longName
)
const
{
if
(
shortName
.
has_value
()
&&
m_options
.
count
(
std
::
string
(
1
,
*
shortName
))
>
0
)
return
m_options
.
at
(
std
::
string
(
1
,
*
shortName
));
if
(
longName
.
has_value
()
&&
m_options
.
count
(
*
longName
))
return
m_options
.
at
(
*
longName
);
return
{};
return
{};
}
}
...
...
src/utils/options.hpp
View file @
668787e0
...
@@ -112,6 +112,7 @@ class OptionsResult
...
@@ -112,6 +112,7 @@ class OptionsResult
int
count
()
const
;
int
count
()
const
;
std
::
string
getPositional
(
int
index
)
const
;
std
::
string
getPositional
(
int
index
)
const
;
std
::
string
getOption
(
const
OptionItem
&
item
)
const
;
std
::
string
getOption
(
const
OptionItem
&
item
)
const
;
std
::
string
getOption
(
const
std
::
optional
<
char
>
&
shortName
,
const
std
::
optional
<
std
::
string
>&
longName
)
const
;
public:
public:
void
showHelp
()
const
;
void
showHelp
()
const
;
...
...
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