Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
42c1fe96
Commit
42c1fe96
authored
Jan 16, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/OptionParser: add "noexcept"
parent
465b154f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
OptionParser.cxx
src/util/OptionParser.cxx
+4
-2
OptionParser.hxx
src/util/OptionParser.hxx
+8
-7
No files found.
src/util/OptionParser.cxx
View file @
42c1fe96
...
...
@@ -22,7 +22,8 @@
#include <string.h>
bool
OptionParser
::
CheckOption
(
const
OptionDef
&
opt
)
bool
OptionParser
::
CheckOption
(
const
OptionDef
&
opt
)
const
noexcept
{
assert
(
option
!=
nullptr
);
...
...
@@ -35,7 +36,8 @@ bool OptionParser::CheckOption(const OptionDef &opt)
option
[
1
]
==
'\0'
;
}
bool
OptionParser
::
ParseNext
()
bool
OptionParser
::
ParseNext
()
noexcept
{
assert
(
HasEntries
());
char
*
arg
=
*
argv
;
...
...
src/util/OptionParser.hxx
View file @
42c1fe96
...
...
@@ -39,18 +39,18 @@ public:
/**
* Constructs #OptionParser.
*/
OptionParser
(
int
_argc
,
char
**
_argv
)
OptionParser
(
int
_argc
,
char
**
_argv
)
noexcept
:
argc
(
_argc
-
1
),
argv
(
_argv
+
1
)
{}
/**
* Checks if there are command line entries to process.
*/
bool
HasEntries
()
const
{
return
argc
>
0
;
}
bool
HasEntries
()
const
noexcept
{
return
argc
>
0
;
}
/**
* Gets the last parsed option.
*/
char
*
GetOption
()
{
char
*
GetOption
()
noexcept
{
assert
(
option_raw
!=
nullptr
);
return
option_raw
;
}
...
...
@@ -58,13 +58,14 @@ public:
/**
* Checks if current option is a specified option.
*/
bool
CheckOption
(
const
OptionDef
&
opt
)
;
bool
CheckOption
(
const
OptionDef
&
opt
)
const
noexcept
;
/**
* Checks if current option is a specified option
* or specified alternative option.
*/
bool
CheckOption
(
const
OptionDef
&
opt
,
const
OptionDef
&
alt_opt
)
{
bool
CheckOption
(
const
OptionDef
&
opt
,
const
OptionDef
&
alt_opt
)
const
noexcept
{
return
CheckOption
(
opt
)
||
CheckOption
(
alt_opt
);
}
...
...
@@ -74,12 +75,12 @@ public:
* Regardless of result, advances current position to the next
* command line entry.
*/
bool
ParseNext
();
bool
ParseNext
()
noexcept
;
/**
* Checks if specified string is a command line option.
*/
static
bool
IsOption
(
const
char
*
s
)
{
static
bool
IsOption
(
const
char
*
s
)
noexcept
{
assert
(
s
!=
nullptr
);
return
s
[
0
]
==
'-'
;
}
...
...
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