1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Chapter 10. Boost.Program_options</title> |
---|
5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> |
---|
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> |
---|
7 | <link rel="start" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> |
---|
8 | <link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)"> |
---|
9 | <link rel="prev" href="boost_math/background_information_and_white_papers.html" title="Background Information and White Papers"> |
---|
10 | <link rel="next" href="program_options/tutorial.html" title="Tutorial"> |
---|
11 | </head> |
---|
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
13 | <table cellpadding="2" width="100%"> |
---|
14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> |
---|
15 | <td align="center"><a href="../../index.htm">Home</a></td> |
---|
16 | <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> |
---|
17 | <td align="center"><a href="../../people/people.htm">People</a></td> |
---|
18 | <td align="center"><a href="../../more/faq.htm">FAQ</a></td> |
---|
19 | <td align="center"><a href="../../more/index.htm">More</a></td> |
---|
20 | </table> |
---|
21 | <hr> |
---|
22 | <div class="spirit-nav"> |
---|
23 | <a accesskey="p" href="boost_math/background_information_and_white_papers.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="program_options/tutorial.html"><img src="images/next.png" alt="Next"></a> |
---|
24 | </div> |
---|
25 | <div class="chapter" lang="en"> |
---|
26 | <div class="titlepage"><div> |
---|
27 | <div><h2 class="title"> |
---|
28 | <a name="program_options"></a>Chapter 10. Boost.Program_options</h2></div> |
---|
29 | <div><div class="author"><h3 class="author"> |
---|
30 | <span class="firstname">Vladimir</span> <span class="surname">Prus</span> |
---|
31 | </h3></div></div> |
---|
32 | <div><p class="copyright">Copyright © 2002-2004 Vladimir Prus</p></div> |
---|
33 | <div><div class="legalnotice"> |
---|
34 | <a name="id1590662"></a><p>Distributed under the Boost Software License, Version 1.0. |
---|
35 | (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at |
---|
36 | <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) |
---|
37 | </p> |
---|
38 | </div></div> |
---|
39 | </div></div> |
---|
40 | <div class="toc"> |
---|
41 | <p><b>Table of Contents</b></p> |
---|
42 | <dl> |
---|
43 | <dt><span class="section"><a href="program_options.html#id1590687">Introduction</a></span></dt> |
---|
44 | <dt><span class="section"><a href="program_options/tutorial.html">Tutorial</a></span></dt> |
---|
45 | <dd><dl> |
---|
46 | <dt><span class="section"><a href="program_options/tutorial.html#id1590784">Getting Started</a></span></dt> |
---|
47 | <dt><span class="section"><a href="program_options/tutorial.html#id1590940">Option Details</a></span></dt> |
---|
48 | <dt><span class="section"><a href="program_options/tutorial.html#id1591176">Multiple Sources</a></span></dt> |
---|
49 | </dl></dd> |
---|
50 | <dt><span class="section"><a href="program_options/overview.html">Library Overview</a></span></dt> |
---|
51 | <dd><dl> |
---|
52 | <dt><span class="section"><a href="program_options/overview.html#id1591423">Options Description Component</a></span></dt> |
---|
53 | <dt><span class="section"><a href="program_options/overview.html#id1592003">Parsers Component</a></span></dt> |
---|
54 | <dt><span class="section"><a href="program_options/overview.html#id1592104">Storage Component</a></span></dt> |
---|
55 | <dt><span class="section"><a href="program_options/overview.html#id1592208">Specific parsers</a></span></dt> |
---|
56 | <dt><span class="section"><a href="program_options/overview.html#id1592393">Annotated List of Symbols</a></span></dt> |
---|
57 | </dl></dd> |
---|
58 | <dt><span class="section"><a href="program_options/howto.html">How To</a></span></dt> |
---|
59 | <dd><dl> |
---|
60 | <dt><span class="section"><a href="program_options/howto.html#id1592624">Non-conventional Syntax</a></span></dt> |
---|
61 | <dt><span class="section"><a href="program_options/howto.html#id1592676">Response Files</a></span></dt> |
---|
62 | <dt><span class="section"><a href="program_options/howto.html#id1592754">Winmain Command Line</a></span></dt> |
---|
63 | <dt><span class="section"><a href="program_options/howto.html#id1592795">Option Groups and Hidden Options</a></span></dt> |
---|
64 | <dt><span class="section"><a href="program_options/howto.html#id1592926">Custom Validators</a></span></dt> |
---|
65 | <dt><span class="section"><a href="program_options/howto.html#id1592999">Unicode Support</a></span></dt> |
---|
66 | <dt><span class="section"><a href="program_options/howto.html#id1593176">Allowing Unknown Options</a></span></dt> |
---|
67 | </dl></dd> |
---|
68 | <dt><span class="section"><a href="program_options/design.html">Design Discussion</a></span></dt> |
---|
69 | <dd><dl><dt><span class="section"><a href="program_options/design.html#program_options.design.unicode">Unicode Support</a></span></dt></dl></dd> |
---|
70 | <dt><span class="section"><a href="program_options/s06.html">Acknowledgements</a></span></dt> |
---|
71 | <dt><span class="section"><a href="program_options/reference.html">Reference</a></span></dt> |
---|
72 | <dd><dl> |
---|
73 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.cmdline.hpp">Header <boost/program_options/cmdline.hpp></a></span></dt> |
---|
74 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.environment_iterator.hpp">Header <boost/program_options/environment_iterator.hpp></a></span></dt> |
---|
75 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.eof_iterator.hpp">Header <boost/program_options/eof_iterator.hpp></a></span></dt> |
---|
76 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.errors.hpp">Header <boost/program_options/errors.hpp></a></span></dt> |
---|
77 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.option.hpp">Header <boost/program_options/option.hpp></a></span></dt> |
---|
78 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.options_description.hpp">Header <boost/program_options/options_description.hpp></a></span></dt> |
---|
79 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.parsers.hpp">Header <boost/program_options/parsers.hpp></a></span></dt> |
---|
80 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.positional_options.hpp">Header <boost/program_options/positional_options.hpp></a></span></dt> |
---|
81 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.value_semantic.hpp">Header <boost/program_options/value_semantic.hpp></a></span></dt> |
---|
82 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.variables_map.hpp">Header <boost/program_options/variables_map.hpp></a></span></dt> |
---|
83 | <dt><span class="section"><a href="program_options/reference.html#header.boost.program_options.version.hpp">Header <boost/program_options/version.hpp></a></span></dt> |
---|
84 | </dl></dd> |
---|
85 | </dl> |
---|
86 | </div> |
---|
87 | <div class="section" lang="en"> |
---|
88 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> |
---|
89 | <a name="id1590687"></a>Introduction</h2></div></div></div> |
---|
90 | <p>The program_options library allows program developers to obtain |
---|
91 | <span class="emphasis"><em>program options</em></span>, that is (name, value) pairs from the user, |
---|
92 | via conventional methods such as command line and config file.</p> |
---|
93 | <p>Why would you use such a library, and why is it better than parsing |
---|
94 | your command line by straightforward hand-written code? |
---|
95 | </p> |
---|
96 | <div class="itemizedlist"><ul type="disc"> |
---|
97 | <li><p>It's easier. The syntax for declaring options is simple, and |
---|
98 | the library itself is small. Things like conversion of option values to |
---|
99 | desired type and storing into program variables are handled |
---|
100 | automatically. |
---|
101 | </p></li> |
---|
102 | <li><p>Error reporting is better. All the problems with the command line are |
---|
103 | reported, while hand-written code can just misparse the input. In |
---|
104 | addition, the usage message can be automatically generated, to |
---|
105 | avoid falling out of sync with the real list of options.</p></li> |
---|
106 | <li><p>Options can be read from anywhere. Sooner or later the command |
---|
107 | line will be not enough for your users, and you'll want config files |
---|
108 | or maybe even environment variables. These can be added without significant |
---|
109 | effort on your part. |
---|
110 | </p></li> |
---|
111 | </ul></div> |
---|
112 | <p> |
---|
113 | </p> |
---|
114 | <p> |
---|
115 | Now let's see some examples of the library usage in the <a href="program_options/tutorial.html" title="Tutorial">the section called “Tutorial”</a>. |
---|
116 | </p> |
---|
117 | </div> |
---|
118 | </div> |
---|
119 | <table width="100%"><tr> |
---|
120 | <td align="left"><small><p>Last revised: July 30, 2004 at 13:20:27 GMT</p></small></td> |
---|
121 | <td align="right"><small></small></td> |
---|
122 | </tr></table> |
---|
123 | <hr> |
---|
124 | <div class="spirit-nav"> |
---|
125 | <a accesskey="p" href="boost_math/background_information_and_white_papers.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="program_options/tutorial.html"><img src="images/next.png" alt="Next"></a> |
---|
126 | </div> |
---|
127 | </body> |
---|
128 | </html> |
---|