133 lines
9.8 KiB
HTML
133 lines
9.8 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>Chapter 31. Boost.Program_options</title>
|
||
<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||
<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="boost_process/acknowledgements.html" title="Acknowledgements">
|
||
<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="boost_process/acknowledgements.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 31. 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="id-1.3.32.1.3"></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 class="toc">
|
||
<dt><span class="section"><a href="program_options.html#id-1.3.32.3">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#id-1.3.32.4.3">Getting Started</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/tutorial.html#id-1.3.32.4.4">Option Details</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/tutorial.html#id-1.3.32.4.5">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#id-1.3.32.5.7">Options Description Component</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/overview.html#id-1.3.32.5.8">Parsers Component</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/overview.html#id-1.3.32.5.9">Storage Component</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/overview.html#id-1.3.32.5.10">Specific parsers</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/overview.html#id-1.3.32.5.11">Types</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/overview.html#id-1.3.32.5.12">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#id-1.3.32.6.3">Non-conventional Syntax</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/howto.html#id-1.3.32.6.4">Response Files</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/howto.html#id-1.3.32.6.5">Winmain Command Line</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/howto.html#id-1.3.32.6.6">Option Groups and Hidden Options</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/howto.html#id-1.3.32.6.7">Custom Validators</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/howto.html#id-1.3.32.6.8">Unicode Support</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/howto.html#id-1.3.32.6.9">Allowing Unknown Options</a></span></dt>
|
||
<dt><span class="section"><a href="program_options/howto.html#id-1.3.32.6.10">Testing Option Presence</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.config_hpp">Header <boost/program_options/config.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="id-1.3.32.3"></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" style="list-style-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"></td>
|
||
<td align="right"><div class="copyright-footer"></div></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="boost_process/acknowledgements.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>
|