• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Class options_description</title>
6<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../../program_options/reference.html#header.boost.program_options.options_description_hpp" title="Header &lt;boost/program_options/options_description.hpp&gt;">
10<link rel="prev" href="option_description.html" title="Class option_description">
11<link rel="next" href="options_d_1_3_31_9_7_1_1_4.html" title="Class options_description_easy_init">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
16<td align="center"><a href="../../../../index.html">Home</a></td>
17<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="option_description.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../program_options/reference.html#header.boost.program_options.options_description_hpp"><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="options_d_1_3_31_9_7_1_1_4.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.program_options.options_description"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Class options_description</span></h2>
30<p>boost::program_options::options_description</p>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../program_options/reference.html#header.boost.program_options.options_description_hpp" title="Header &lt;boost/program_options/options_description.hpp&gt;">boost/program_options/options_description.hpp</a>&gt;
34
35</span>
36<span class="keyword">class</span> <a class="link" href="options_description.html" title="Class options_description">options_description</a> <span class="special">{</span>
37<span class="keyword">public</span><span class="special">:</span>
38  <span class="comment">// <a class="link" href="options_description.html#boost.program_options.options_descriptionconstruct-copy-destruct">construct/copy/destruct</a></span>
39  <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_4-bb"><span class="identifier">options_description</span></a><span class="special">(</span><span class="keyword">unsigned</span> <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">,</span>
40                      <span class="keyword">unsigned</span> <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">/</span><span class="number">2</span><span class="special">)</span><span class="special">;</span>
41  <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_5-bb"><span class="identifier">options_description</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">,</span>
42                      <span class="keyword">unsigned</span> <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">/</span><span class="number">2</span><span class="special">)</span><span class="special">;</span>
43
44  <span class="comment">// <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3-bb">public member functions</a></span>
45  <span class="keyword">void</span> <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_1-bb"><span class="identifier">add</span></a><span class="special">(</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">&gt;</span><span class="special">)</span><span class="special">;</span>
46  <a class="link" href="options_description.html" title="Class options_description">options_description</a> <span class="special">&amp;</span> <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_2-bb"><span class="identifier">add</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="options_description.html" title="Class options_description">options_description</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
47  <span class="keyword">unsigned</span> <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_3-bb"><span class="identifier">get_option_column_width</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
48  <a class="link" href="options_d_1_3_31_9_7_1_1_4.html" title="Class options_description_easy_init">options_description_easy_init</a> <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_4-bb"><span class="identifier">add_options</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
49  <span class="keyword">const</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">&amp;</span>
50  <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_5-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
51  <span class="keyword">const</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">*</span>
52  <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_6-bb"><span class="identifier">find_nothrow</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
53  <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">shared_ptr</span><span class="special">&lt;</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">&amp;</span> <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_7-bb"><span class="identifier">options</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
54  <span class="keyword">void</span> <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_3_8-bb"><span class="identifier">print</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
55
56  <span class="comment">// <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_6-bb">friend functions</a></span>
57  <span class="keyword">friend</span> <span class="identifier">BOOST_PROGRAM_OPTIONS_DECL</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span>
58  <a class="link" href="options_description.html#id-1_3_31_9_7_1_1_3_6_1-bb"><span class="keyword">operator</span><span class="special">&lt;&lt;</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="options_description.html" title="Class options_description">options_description</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
59
60  <span class="comment">// public data members</span>
61  <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="identifier">m_default_line_length</span><span class="special">;</span>
62<span class="special">}</span><span class="special">;</span></pre></div>
63<div class="refsect1">
64<a name="id-1.3.31.9.8.5.4"></a><h2>Description</h2>
65<p>A set of option descriptions. This provides convenient interface for adding new option (the add_options) method, and facilities to search for options by name.</p>
66<p>See here for option adding interface discussion. </p>
67<p><span class="bold"><strong>See Also:</strong></span></p>
68<p><a class="link" href="option_description.html" title="Class option_description">option_description</a> </p>
69<p>
70</p>
71<p>
72</p>
73<div class="refsect2">
74<a name="id-1.3.31.9.8.5.4.4"></a><h3>
75<a name="boost.program_options.options_descriptionconstruct-copy-destruct"></a><code class="computeroutput">options_description</code>
76        public
77       construct/copy/destruct</h3>
78<div class="orderedlist"><ol class="orderedlist" type="1">
79<li class="listitem">
80<pre class="literallayout"><a name="id-1_3_31_9_7_1_1_3_4-bb"></a><span class="identifier">options_description</span><span class="special">(</span><span class="keyword">unsigned</span> line_length <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">,</span>
81                    <span class="keyword">unsigned</span> min_description_length <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">/</span><span class="number">2</span><span class="special">)</span><span class="special">;</span></pre>
82<p>Creates the instance. </p>
83</li>
84<li class="listitem">
85<pre class="literallayout"><a name="id-1_3_31_9_7_1_1_3_5-bb"></a><span class="identifier">options_description</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> caption<span class="special">,</span>
86                    <span class="keyword">unsigned</span> line_length <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">,</span>
87                    <span class="keyword">unsigned</span> min_description_length <span class="special">=</span> <span class="identifier">m_default_line_length</span><span class="special">/</span><span class="number">2</span><span class="special">)</span><span class="special">;</span></pre>
88<p>Creates the instance. The 'caption' parameter gives the name of this '<code class="computeroutput"><a class="link" href="options_description.html" title="Class options_description">options_description</a></code>' instance. Primarily useful for output. The 'description_length' specifies the number of columns that should be reserved for the description text; if the option text encroaches into this, then the description will start on the next line. </p>
89</li>
90</ol></div>
91</div>
92<div class="refsect2">
93<a name="id-1.3.31.9.8.5.4.5"></a><h3>
94<a name="id-1_3_31_9_7_1_1_3_3-bb"></a><code class="computeroutput">options_description</code> public member functions</h3>
95<div class="orderedlist"><ol class="orderedlist" type="1">
96<li class="listitem">
97<pre class="literallayout"><span class="keyword">void</span> <a name="id-1_3_31_9_7_1_1_3_3_1-bb"></a><span class="identifier">add</span><span class="special">(</span><span class="identifier">shared_ptr</span><span class="special">&lt;</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">&gt;</span> desc<span class="special">)</span><span class="special">;</span></pre>
98<p>Adds new variable description. Throws duplicate_variable_error if either short or long name matches that of already present one. </p>
99</li>
100<li class="listitem">
101<pre class="literallayout"><a class="link" href="options_description.html" title="Class options_description">options_description</a> <span class="special">&amp;</span> <a name="id-1_3_31_9_7_1_1_3_3_2-bb"></a><span class="identifier">add</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="options_description.html" title="Class options_description">options_description</a> <span class="special">&amp;</span> desc<span class="special">)</span><span class="special">;</span></pre>
102<p>Adds a group of option description. This has the same effect as adding all option_descriptions in 'desc' individually, except that output operator will show a separate group. Returns *this. </p>
103</li>
104<li class="listitem">
105<pre class="literallayout"><span class="keyword">unsigned</span> <a name="id-1_3_31_9_7_1_1_3_3_3-bb"></a><span class="identifier">get_option_column_width</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
106<p>Find the maximum width of the option column, including options in groups. </p>
107</li>
108<li class="listitem">
109<pre class="literallayout"><a class="link" href="options_d_1_3_31_9_7_1_1_4.html" title="Class options_description_easy_init">options_description_easy_init</a> <a name="id-1_3_31_9_7_1_1_3_3_4-bb"></a><span class="identifier">add_options</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
110<p>Returns an object of implementation-defined type suitable for adding options to <code class="computeroutput"><a class="link" href="options_description.html" title="Class options_description">options_description</a></code>. The returned object will have overloaded operator() with parameter type matching '<code class="computeroutput"><a class="link" href="option_description.html" title="Class option_description">option_description</a></code>' constructors. Calling the operator will create new <code class="computeroutput"><a class="link" href="option_description.html" title="Class option_description">option_description</a></code> instance and add it. </p>
111</li>
112<li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">&amp;</span>
113<a name="id-1_3_31_9_7_1_1_3_3_5-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> name<span class="special">,</span> <span class="keyword">bool</span> approx<span class="special">,</span> <span class="keyword">bool</span> long_ignore_case <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span>
114     <span class="keyword">bool</span> short_ignore_case <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
115<li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">*</span>
116<a name="id-1_3_31_9_7_1_1_3_3_6-bb"></a><span class="identifier">find_nothrow</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="special">&amp;</span> name<span class="special">,</span> <span class="keyword">bool</span> approx<span class="special">,</span>
117             <span class="keyword">bool</span> long_ignore_case <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> <span class="keyword">bool</span> short_ignore_case <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
118<li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span> <span class="identifier">shared_ptr</span><span class="special">&lt;</span> <a class="link" href="option_description.html" title="Class option_description">option_description</a> <span class="special">&gt;</span> <span class="special">&gt;</span> <span class="special">&amp;</span> <a name="id-1_3_31_9_7_1_1_3_3_7-bb"></a><span class="identifier">options</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
119<li class="listitem">
120<pre class="literallayout"><span class="keyword">void</span> <a name="id-1_3_31_9_7_1_1_3_3_8-bb"></a><span class="identifier">print</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> os<span class="special">,</span> <span class="keyword">unsigned</span> width <span class="special">=</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
121<p>Outputs 'desc' to the specified stream, calling 'f' to output each <code class="computeroutput"><a class="link" href="option_description.html" title="Class option_description">option_description</a></code> element. </p>
122</li>
123</ol></div>
124</div>
125<div class="refsect2">
126<a name="id-1.3.31.9.8.5.4.6"></a><h3>
127<a name="id-1_3_31_9_7_1_1_3_6-bb"></a><code class="computeroutput">options_description</code> friend functions</h3>
128<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
129<pre class="literallayout"><span class="keyword">friend</span> <span class="identifier">BOOST_PROGRAM_OPTIONS_DECL</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span>
130<a name="id-1_3_31_9_7_1_1_3_6_1-bb"></a><span class="keyword">operator</span><span class="special">&lt;&lt;</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&amp;</span> os<span class="special">,</span> <span class="keyword">const</span> <a class="link" href="options_description.html" title="Class options_description">options_description</a> <span class="special">&amp;</span> desc<span class="special">)</span><span class="special">;</span></pre>
131<p>Produces a human readable output of 'desc', listing options, their descriptions and allowed parameters. Other <code class="computeroutput"><a class="link" href="options_description.html" title="Class options_description">options_description</a></code> instances previously passed to add will be output separately. </p>
132</li></ol></div>
133</div>
134</div>
135</div>
136<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
137<td align="left"></td>
138<td align="right"><div class="copyright-footer">Copyright © 2002-2004 Vladimir Prus<p>Distributed under the Boost Software License, Version 1.0.
139      (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
140      <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
141      </p>
142</div></td>
143</tr></table>
144<hr>
145<div class="spirit-nav">
146<a accesskey="p" href="option_description.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../program_options/reference.html#header.boost.program_options.options_description_hpp"><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="options_d_1_3_31_9_7_1_1_4.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
147</div>
148</body>
149</html>
150