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
7e3fccd5
Commit
7e3fccd5
authored
Mar 31, 2021
by
aligungr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Options parser improvement
parent
51a29493
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
src/utils/options.cpp
src/utils/options.cpp
+7
-2
src/utils/options.hpp
src/utils/options.hpp
+1
-0
No files found.
src/utils/options.cpp
View file @
7e3fccd5
...
@@ -222,9 +222,14 @@ opt::OptionsResult::OptionsResult(int argc, char **argv, const opt::OptionsDescr
...
@@ -222,9 +222,14 @@ opt::OptionsResult::OptionsResult(int argc, char **argv, const opt::OptionsDescr
bool
opt
::
OptionsResult
::
hasFlag
(
const
opt
::
OptionItem
&
item
)
const
bool
opt
::
OptionsResult
::
hasFlag
(
const
opt
::
OptionItem
&
item
)
const
{
{
if
(
item
.
shortName
.
has_value
()
&&
m_options
.
count
(
std
::
string
(
1
,
*
item
.
shortName
))
>
0
)
return
hasFlag
(
item
.
shortName
,
item
.
longName
);
}
bool
opt
::
OptionsResult
::
hasFlag
(
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
true
;
return
true
;
if
(
item
.
longName
.
has_value
()
&&
m_options
.
count
(
*
item
.
longName
)
>
0
)
if
(
longName
.
has_value
()
&&
m_options
.
count
(
*
longName
)
>
0
)
return
true
;
return
true
;
return
false
;
return
false
;
}
}
...
...
src/utils/options.hpp
View file @
7e3fccd5
...
@@ -107,6 +107,7 @@ class OptionsResult
...
@@ -107,6 +107,7 @@ class OptionsResult
public:
public:
bool
hasFlag
(
const
OptionItem
&
item
)
const
;
bool
hasFlag
(
const
OptionItem
&
item
)
const
;
bool
hasFlag
(
const
std
::
optional
<
char
>
&
shortName
,
const
std
::
optional
<
std
::
string
>&
longName
)
const
;
int
positionalCount
()
const
;
int
positionalCount
()
const
;
int
count
()
const
;
int
count
()
const
;
std
::
string
getPositional
(
int
index
)
const
;
std
::
string
getPositional
(
int
index
)
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