Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
f94eb904
Commit
f94eb904
authored
Feb 11, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified code a little
parent
5edb76a6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
compress_stream_ex.cpp
examples/compress_stream_ex.cpp
+6
-14
No files found.
examples/compress_stream_ex.cpp
View file @
f94eb904
...
...
@@ -109,21 +109,13 @@ int main(int argc, char** argv)
return
0
;
}
// Make some references to the options inside the parser. This is just
// for convenience so we don't have to type out the longer form below.
const
clp
::
option_type
&
option_c
=
parser
.
option
(
"c"
);
const
clp
::
option_type
&
option_d
=
parser
.
option
(
"d"
);
const
clp
::
option_type
&
option_in
=
parser
.
option
(
"in"
);
const
clp
::
option_type
&
option_out
=
parser
.
option
(
"out"
);
// Figure out what the compression level should be. If the user didn't supply
// this command line option then a value of 2 will be used.
int
compression_level
=
get_option
(
parser
,
"l"
,
2
);
// make sure one of the c or d options was given
if
(
!
option_c
&&
!
option_d
)
if
(
!
parser
.
option
(
"c"
)
&&
!
parser
.
option
(
"d"
)
)
{
cout
<<
"Error in command line:
\n
You must specify either the c option or the d option.
\n
"
;
cout
<<
"
\n
Try the -h option for more information."
<<
endl
;
...
...
@@ -136,9 +128,9 @@ int main(int argc, char** argv)
// check if the user told us the input file and if they did then
// get the file name
if
(
option_in
)
if
(
parser
.
option
(
"in"
)
)
{
in_file
=
option_in
.
argument
();
in_file
=
parser
.
option
(
"in"
)
.
argument
();
}
else
{
...
...
@@ -150,9 +142,9 @@ int main(int argc, char** argv)
// check if the user told us the output file and if they did then
// get the file name
if
(
option_out
)
if
(
parser
.
option
(
"out"
)
)
{
out_file
=
option_out
.
argument
();
out_file
=
parser
.
option
(
"out"
)
.
argument
();
}
else
{
...
...
@@ -182,7 +174,7 @@ int main(int argc, char** argv)
// now perform the actual compression or decompression.
if
(
option_c
)
if
(
parser
.
option
(
"c"
)
)
{
// save the compression level to the output file
serialize
(
compression_level
,
fout
);
...
...
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