Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
utils
Commits
05c75007
Commit
05c75007
authored
22 years ago
by
Christian Beckmann
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
bb2688c0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
options.h
+15
-11
15 additions, 11 deletions
options.h
with
15 additions
and
11 deletions
options.h
+
15
−
11
View file @
05c75007
...
...
@@ -5,6 +5,7 @@
#include
<stdexcept>
#include
<string>
#include
<vector>
#include
<iostream>
#define POSIX_SOURCE 1
...
...
@@ -198,13 +199,16 @@ namespace Utilities {
/**
Throw this exception if an error occured inside the Options package.
*/
/* class X_OptionError: public std::exception { */
/* public: */
/* X_OptionError() throw() {}; */
/* virtual const char * what() const throw() { */
/* return "There were errors parsing the command line!"; */
/* } */
/* }; */
class
X_OptionError
:
public
std
::
exception
{
public:
X_OptionError
()
throw
()
{};
X_OptionError
(
const
string
&
s
)
throw
()
{
cerr
<<
s
<<
endl
;}
X_OptionError
(
const
string
&
o
,
const
string
&
v
)
throw
()
{
cerr
<<
o
<<
":invalid argument "
<<
v
<<
"!"
<<
endl
;
}
virtual
const
char
*
what
()
const
throw
()
{
return
"There were errors parsing the command line!"
;
}
};
/**
Throw this exception if no matching option was found during parsing.
...
...
@@ -250,8 +254,8 @@ namespace Utilities {
/* string str_; */
/* }; */
/*
/**
*/
/* */
*/
/* */
/* */
/* class X_InvalidArgument: public X_OptionError { */
/* public: */
/* X_InvalidArgument(const string& o, const string& v) throw(): */
...
...
@@ -393,8 +397,8 @@ int main(unsigned int argc, char **argv) {
@return true on success.
*/
unsigned
int
parse_option
(
const
string
&
optstr
,
const
string
&
valstr
)
//
throw(X_
AlreadySet, X_UnknownOption,
// X_MissingArgument, X_InvalidArgument)
;
throw
(
X_
OptionError
);
/**
@param str A string of the form --option[=value].
@return true on success.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment