Skip to content

Commit 5840018

Browse files
committed
Trim trailing spaces.
1 parent 8d5103d commit 5840018

31 files changed

+565
-565
lines changed

example/config_file_types.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ stringstream make_file()
3838
ss << "word = word\n";
3939
ss << "phrase = this is a phrase\n";
4040
ss << "quoted = \"quotes are in result\"\n";
41-
41+
4242
ss << "\n[ints]\n";
4343
ss << "positive = 41\n";
4444
ss << "negative = -42\n";
@@ -71,7 +71,7 @@ stringstream make_file()
7171
ss << "onoff_true = on\n";
7272
ss << "onoff_false = off\n";
7373
ss << "present_equal_true = \n";
74-
//FAILS: Must be an =
74+
//FAILS: Must be an =
7575
//ss << "present_no_equal_true\n";
7676

7777
ss.seekp(ios_base::beg);
@@ -236,7 +236,7 @@ int main(int ac, char* av[])
236236
auto opts = set_options();
237237
po::variables_map vars;
238238
auto unregistered = parse_file(file, opts, vars);
239-
check_results(vars, unregistered);
239+
check_results(vars, unregistered);
240240

241241
return 0;
242242
}

example/custom_syntax.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
/** This example shows how to support custom options syntax.
77
8-
It's possible to install 'custom_parser'. It will be invoked on all command
9-
line tokens and can return name/value pair, or nothing. If it returns
8+
It's possible to install 'custom_parser'. It will be invoked on all command
9+
line tokens and can return name/value pair, or nothing. If it returns
1010
nothing, usual processing will be done.
1111
*/
1212

@@ -20,7 +20,7 @@ using namespace boost::program_options;
2020
#include <iostream>
2121
using namespace std;
2222

23-
/* This custom option parse function recognize gcc-style
23+
/* This custom option parse function recognize gcc-style
2424
option "-fbar" / "-fno-bar".
2525
*/
2626
pair<string, string> reg_foo(const string& s)
@@ -32,7 +32,7 @@ pair<string, string> reg_foo(const string& s)
3232
return make_pair(s.substr(2), string("true"));
3333
} else {
3434
return make_pair(string(), string());
35-
}
35+
}
3636
}
3737

3838
int main(int ac, char* av[])
@@ -53,7 +53,7 @@ int main(int ac, char* av[])
5353
cout << "\nIn addition -ffoo and -fno-foo syntax are recognized.\n";
5454
}
5555
if (vm.count("foo")) {
56-
cout << "foo value with the value of "
56+
cout << "foo value with the value of "
5757
<< vm["foo"].as<string>() << "\n";
5858
}
5959
}

example/first.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ int main(int ac, char* av[])
2323
("compression", po::value<double>(), "set compression level")
2424
;
2525

26-
po::variables_map vm;
26+
po::variables_map vm;
2727
po::store(po::parse_command_line(ac, av, desc), vm);
28-
po::notify(vm);
28+
po::notify(vm);
2929

3030
if (vm.count("help")) {
3131
cout << desc << "\n";
3232
return 0;
3333
}
3434

3535
if (vm.count("compression")) {
36-
cout << "Compression level was set to "
36+
cout << "Compression level was set to "
3737
<< vm["compression"].as<double>() << ".\n";
3838
} else {
3939
cout << "Compression level was not set.\n";

example/multiple_sources.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ using namespace std;
1818
template<class T>
1919
ostream& operator<<(ostream& os, const vector<T>& v)
2020
{
21-
copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
21+
copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
2222
return os;
2323
}
2424

@@ -28,8 +28,8 @@ int main(int ac, char* av[])
2828
try {
2929
int opt;
3030
string config_file;
31-
32-
// Declare a group of options that will be
31+
32+
// Declare a group of options that will be
3333
// allowed only on command line
3434
po::options_description generic("Generic options");
3535
generic.add_options()
@@ -38,16 +38,16 @@ int main(int ac, char* av[])
3838
("config,c", po::value<string>(&config_file)->default_value("multiple_sources.cfg"),
3939
"name of a file of a configuration.")
4040
;
41-
42-
// Declare a group of options that will be
41+
42+
// Declare a group of options that will be
4343
// allowed both on command line and in
4444
// config file
4545
po::options_description config("Configuration");
4646
config.add_options()
47-
("optimization", po::value<int>(&opt)->default_value(10),
47+
("optimization", po::value<int>(&opt)->default_value(10),
4848
"optimization level")
49-
("include-path,I",
50-
po::value< vector<string> >()->composing(),
49+
("include-path,I",
50+
po::value< vector<string> >()->composing(),
5151
"include path")
5252
;
5353

@@ -58,7 +58,7 @@ int main(int ac, char* av[])
5858
("input-file", po::value< vector<string> >(), "input file")
5959
;
6060

61-
61+
6262
po::options_description cmdline_options;
6363
cmdline_options.add(generic).add(config).add(hidden);
6464

@@ -67,15 +67,15 @@ int main(int ac, char* av[])
6767

6868
po::options_description visible("Allowed options");
6969
visible.add(generic).add(config);
70-
70+
7171
po::positional_options_description p;
7272
p.add("input-file", -1);
73-
73+
7474
po::variables_map vm;
7575
store(po::command_line_parser(ac, av).
7676
options(cmdline_options).positional(p).run(), vm);
7777
notify(vm);
78-
78+
7979
ifstream ifs(config_file.c_str());
8080
if (!ifs)
8181
{
@@ -87,7 +87,7 @@ int main(int ac, char* av[])
8787
store(parse_config_file(ifs, config_file_options), vm);
8888
notify(vm);
8989
}
90-
90+
9191
if (vm.count("help")) {
9292
cout << visible << "\n";
9393
return 0;
@@ -100,22 +100,22 @@ int main(int ac, char* av[])
100100

101101
if (vm.count("include-path"))
102102
{
103-
cout << "Include paths are: "
103+
cout << "Include paths are: "
104104
<< vm["include-path"].as< vector<string> >() << "\n";
105105
}
106106

107107
if (vm.count("input-file"))
108108
{
109-
cout << "Input files are: "
109+
cout << "Input files are: "
110110
<< vm["input-file"].as< vector<string> >() << "\n";
111111
}
112112

113-
cout << "Optimization level is " << opt << "\n";
113+
cout << "Optimization level is " << opt << "\n";
114114
}
115115
catch(exception& e)
116116
{
117117
cout << e.what() << "\n";
118118
return 1;
119-
}
119+
}
120120
return 0;
121121
}

example/option_groups.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main(int ac, char* av[])
5353
backend.add_options()
5454
("num-threads", value<int>(), "the initial number of threads")
5555
;
56-
56+
5757
// Declare an options description instance which will include
5858
// all the options
5959
options_description all("Allowed options");
@@ -63,12 +63,12 @@ int main(int ac, char* av[])
6363
// to the user
6464
options_description visible("Allowed options");
6565
visible.add(general).add(gui);
66-
66+
6767

6868
variables_map vm;
6969
store(parse_command_line(ac, av, all), vm);
7070

71-
if (vm.count("help"))
71+
if (vm.count("help"))
7272
{
7373
cout << visible;
7474
return 0;
@@ -80,16 +80,16 @@ int main(int ac, char* av[])
8080
} else if (s == "backend") {
8181
cout << backend;
8282
} else {
83-
cout << "Unknown module '"
83+
cout << "Unknown module '"
8484
<< s << "' in the --help-module option\n";
8585
return 1;
8686
}
8787
return 0;
8888
}
8989
if (vm.count("num-threads")) {
9090
cout << "The 'num-threads' options was set to "
91-
<< vm["num-threads"].as<int>() << "\n";
92-
}
91+
<< vm["num-threads"].as<int>() << "\n";
92+
}
9393
}
9494
catch(std::exception& e) {
9595
cout << e.what() << "\n";

example/options_heirarchy.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// (See accompanying file LICENSE_1_0.txt
44
// or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6-
//
6+
//
77
// This is an example of a program that uses multiple facets of the boost
8-
// program_options library. It will go through different types of config
8+
// program_options library. It will go through different types of config
99
// options in a heirarchal manner:
1010
// 1. Default options are set.
1111
// 2. Command line options are set (they override defaults).
@@ -16,7 +16,7 @@
1616
// other steps).
1717
// 5. Default config file (default.cfg) is read, if present (it overrides
1818
// defaults but not options from the other steps).
19-
//
19+
//
2020
// See the bottom of this file for full usage examples
2121
//
2222

@@ -217,7 +217,7 @@ class OptionsHeirarchy
217217
std::cout << "Program Options Example " << version << std::endl;
218218
throw OptionsExitsProgram();
219219
}
220-
void ParseEnvironment()
220+
void ParseEnvironment()
221221
{
222222
store(po::parse_environment(common_options,
223223
// The next two lines are the crazy syntax to use EnvironmentMapper as
@@ -333,16 +333,16 @@ int main(int ac, char* av[])
333333
return 0;
334334
}
335335

336-
/*
336+
/*
337337
Full Usage Examples
338338
===================
339339
340-
These were run on windows, so some results may show that environment, but
340+
These were run on windows, so some results may show that environment, but
341341
results should be similar on POSIX platforms.
342342
343343
Help
344344
----
345-
To see the help screen, with the available options just pass the --help (or -h)
345+
To see the help screen, with the available options just pass the --help (or -h)
346346
parameter. The program will then exit.
347347
348348
> example.exe --help
@@ -367,10 +367,10 @@ Version is similar to help (--version or -v).
367367
368368
Basics
369369
------
370-
Running without any options will get the default values (path is set from the
370+
Running without any options will get the default values (path is set from the
371371
environment):
372372
373-
> example.exe
373+
> example.exe
374374
First 75 chars of the system path:
375375
C:\Program Files (x86)\MSBuild\14.0\bin;C:\Perl\site\bin;C:\Perl\bin;C:\Pro
376376
Verbosity: INFO
@@ -436,8 +436,8 @@ Or you can put the option immediately after it:
436436
Network Address: 127.0.0.1
437437
Network Port: 12345
438438
439-
The include path (--include-path or -I) option allows for multiple paths to be
440-
specified (both on the command line and in config files) and combined into a
439+
The include path (--include-path or -I) option allows for multiple paths to be
440+
specified (both on the command line and in config files) and combined into a
441441
vector for use by the program.
442442
443443
> example.exe --include-path=a/b/c --include-path d/e/f -I g/h/i -Ij/k/l
@@ -455,7 +455,7 @@ vector for use by the program.
455455
Network Address: 127.0.0.1
456456
Network Port: 12345
457457
458-
There are also the option of flags that do not take parameters and just set a
458+
There are also the option of flags that do not take parameters and just set a
459459
boolean value to true. In this case, running the gui also causes default values
460460
for the gui to be output to the screen.
461461
@@ -491,7 +491,7 @@ one specifies the "master" file the others are additional files.
491491
492492
Environment Variables
493493
---------------------
494-
In addition to the PATH environment variable, it also knows how to read the
494+
In addition to the PATH environment variable, it also knows how to read the
495495
EXAMPLE_VERBOSE environmental variable and use that to set the verbosity
496496
option/
497497
@@ -509,7 +509,7 @@ option/
509509
510510
However, if the --verboseity flag is also set, it will override the env
511511
variable. This illustrates an important example, the way program_options works,
512-
is that a parser will not override a value that has previously been set by
512+
is that a parser will not override a value that has previously been set by
513513
another parser. Thus the env parser doesn't override the command line parser.
514514
(We will see this again in config files.) Default values are seperate from this
515515
heirarcy, they only apply if no parser has set the value and it is being read.
@@ -527,7 +527,7 @@ heirarcy, they only apply if no parser has set the value and it is being read.
527527
Network Port: 12345
528528
529529
(You can unset an environmental variable with an empty set command)
530-
530+
531531
> set EXAMPLE_VERBOSE=
532532
> example.exe
533533
First 75 chars of the system path:
@@ -544,7 +544,7 @@ heirarcy, they only apply if no parser has set the value and it is being read.
544544
Config Files
545545
------------
546546
Config files generally follow the [INI file format]
547-
(https://en.wikipedia.org/wiki/INI_file) with a few exceptions.
547+
(https://en.wikipedia.org/wiki/INI_file) with a few exceptions.
548548
549549
Values can be simply added tp options with an equal sign. Here are two include
550550
paths added via the default config file (default.cfg), you can have optional
@@ -661,7 +661,7 @@ Results in a combination of all three config files:
661661
Network Address: 5.6.7.8
662662
Network Port: 3000
663663
664-
Incidently the boolean run-gui option could have been set a number of ways
664+
Incidently the boolean run-gui option could have been set a number of ways
665665
that all result in the C++ boolean value of true:
666666
667667
run-gui=true
@@ -672,10 +672,10 @@ that all result in the C++ boolean value of true:
672672
673673
Since run-gui is an option that was set with the bool_switch type, which
674674
forces its use on the command line without a parameter (i.e. --run-gui instead
675-
of --run-gui=true) it can't be given a "false" option, bool_switch values can
675+
of --run-gui=true) it can't be given a "false" option, bool_switch values can
676676
only be turned true. If instead we had a value ("my-switch", po::value<bool>())
677-
that could be set at the command line --my-switch=true or --my-switch=false, or
678-
any of the other types of boolean keywords true: true, on, 1, yes;
677+
that could be set at the command line --my-switch=true or --my-switch=false, or
678+
any of the other types of boolean keywords true: true, on, 1, yes;
679679
false: false, off, 0, no. In a config file this could look like:
680680
681681
my-switch=true

0 commit comments

Comments
 (0)