| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> |
| <title>Chapter 13. Boost.Program_options</title> |
| <link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css"> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> |
| <link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> |
| <link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)"> |
| <link rel="prev" href="mpi/acknowledge.html" title="Acknowledgments"> |
| <link rel="next" href="program_options/tutorial.html" title="Tutorial"> |
| </head> |
| <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| <table cellpadding="2" width="100%"><tr> |
| <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> |
| <td align="center"><a href="../../index.html">Home</a></td> |
| <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> |
| <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> |
| <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> |
| <td align="center"><a href="../../more/index.htm">More</a></td> |
| </tr></table> |
| <hr> |
| <div class="spirit-nav"> |
| <a accesskey="p" href="mpi/acknowledge.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="program_options/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| <div class="chapter"> |
| <div class="titlepage"><div> |
| <div><h2 class="title"> |
| <a name="program_options"></a>Chapter 13. Boost.Program_options</h2></div> |
| <div><div class="author"><h3 class="author"> |
| <span class="firstname">Vladimir</span> <span class="surname">Prus</span> |
| </h3></div></div> |
| <div><p class="copyright">Copyright © 2002-2004 Vladimir Prus</p></div> |
| <div><div class="legalnotice"> |
| <a name="id2072771"></a><p>Distributed under the Boost Software License, Version 1.0. |
| (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at |
| <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) |
| </p> |
| </div></div> |
| </div></div> |
| <div class="toc"> |
| <p><b>Table of Contents</b></p> |
| <dl> |
| <dt><span class="section"><a href="program_options.html#id2072796">Introduction</a></span></dt> |
| <dt><span class="section"><a href="program_options/tutorial.html">Tutorial</a></span></dt> |
| <dd><dl> |
| <dt><span class="section"><a href="program_options/tutorial.html#id2072893">Getting Started</a></span></dt> |
| <dt><span class="section"><a href="program_options/tutorial.html#id2073050">Option Details</a></span></dt> |
| <dt><span class="section"><a href="program_options/tutorial.html#id2073299">Multiple Sources</a></span></dt> |
| </dl></dd> |
| <dt><span class="section"><a href="program_options/overview.html">Library Overview</a></span></dt> |
| <dd><dl> |
| <dt><span class="section"><a href="program_options/overview.html#id2073547">Options Description Component</a></span></dt> |
| <dt><span class="section"><a href="program_options/overview.html#id2074129">Parsers Component</a></span></dt> |
| <dt><span class="section"><a href="program_options/overview.html#id2074238">Storage Component</a></span></dt> |
| <dt><span class="section"><a href="program_options/overview.html#id2074341">Specific parsers</a></span></dt> |
| <dt><span class="section"><a href="program_options/overview.html#id2074635">Annotated List of Symbols</a></span></dt> |
| </dl></dd> |
| <dt><span class="section"><a href="program_options/howto.html">How To</a></span></dt> |
| <dd><dl> |
| <dt><span class="section"><a href="program_options/howto.html#id2074869">Non-conventional Syntax</a></span></dt> |
| <dt><span class="section"><a href="program_options/howto.html#id2074922">Response Files</a></span></dt> |
| <dt><span class="section"><a href="program_options/howto.html#id2075000">Winmain Command Line</a></span></dt> |
| <dt><span class="section"><a href="program_options/howto.html#id2075046">Option Groups and Hidden Options</a></span></dt> |
| <dt><span class="section"><a href="program_options/howto.html#id2075177">Custom Validators</a></span></dt> |
| <dt><span class="section"><a href="program_options/howto.html#id2075250">Unicode Support</a></span></dt> |
| <dt><span class="section"><a href="program_options/howto.html#id2075428">Allowing Unknown Options</a></span></dt> |
| </dl></dd> |
| <dt><span class="section"><a href="program_options/design.html">Design Discussion</a></span></dt> |
| <dd><dl><dt><span class="section"><a href="program_options/design.html#program_options.design.unicode">Unicode Support</a></span></dt></dl></dd> |
| <dt><span class="section"><a href="program_options/s06.html">Acknowledgements</a></span></dt> |
| <dt><span class="section"><a href="program_options/reference.html">Reference</a></span></dt> |
| <dd><dl> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| </dl></dd> |
| </dl> |
| </div> |
| <div class="section"> |
| <div class="titlepage"><div><div><h2 class="title" style="clear: both"> |
| <a name="id2072796"></a>Introduction</h2></div></div></div> |
| <p>The program_options library allows program developers to obtain |
| <span class="emphasis"><em>program options</em></span>, that is (name, value) pairs from the user, |
| via conventional methods such as command line and config file.</p> |
| <p>Why would you use such a library, and why is it better than parsing |
| your command line by straightforward hand-written code? |
| </p> |
| <div class="itemizedlist"><ul class="itemizedlist" type="disc"> |
| <li class="listitem"><p>It's easier. The syntax for declaring options is simple, and |
| the library itself is small. Things like conversion of option values to |
| desired type and storing into program variables are handled |
| automatically. |
| </p></li> |
| <li class="listitem"><p>Error reporting is better. All the problems with the command line are |
| reported, while hand-written code can just misparse the input. In |
| addition, the usage message can be automatically generated, to |
| avoid falling out of sync with the real list of options.</p></li> |
| <li class="listitem"><p>Options can be read from anywhere. Sooner or later the command |
| line will be not enough for your users, and you'll want config files |
| or maybe even environment variables. These can be added without significant |
| effort on your part. |
| </p></li> |
| </ul></div> |
| <p> |
| </p> |
| <p> |
| Now let's see some examples of the library usage in the <a class="xref" href="program_options/tutorial.html" title="Tutorial">the section called “Tutorial”</a>. |
| </p> |
| </div> |
| </div> |
| <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> |
| <td align="left"><p><small>Last revised: November 25, 2007 at 18:38:02 +0000</small></p></td> |
| <td align="right"><div class="copyright-footer"></div></td> |
| </tr></table> |
| <hr> |
| <div class="spirit-nav"> |
| <a accesskey="p" href="mpi/acknowledge.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="program_options/tutorial.html"><img src="../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| </body> |
| </html> |