1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Class variable_value</title> |
---|
5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> |
---|
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
7 | <link rel="start" href="index.html" title="The Boost C++ Libraries"> |
---|
8 | <link rel="up" href="program_options/reference.html#id2524541" title="Header <boost/program_options/variables_map.hpp>"> |
---|
9 | <link rel="prev" href="bool_switch.html" title="Function bool_switch"> |
---|
10 | <link rel="next" href="abstract_variables_map.html" title="Class abstract_variables_map"> |
---|
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.png (6897 bytes)" 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="bool_switch.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="program_options/reference.html#id2524541"><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="abstract_variables_map.html"><img src="images/next.png" alt="Next"></a> |
---|
24 | </div> |
---|
25 | <div class="refentry" lang="en"> |
---|
26 | <a name="variable_value"></a><div class="titlepage"></div> |
---|
27 | <div class="refnamediv"> |
---|
28 | <h2><span class="refentrytitle">Class variable_value</span></h2> |
---|
29 | <p>boost::program_options::variable_value — </p> |
---|
30 | </div> |
---|
31 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
---|
32 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"> |
---|
33 | <span class="bold"><strong>class</strong></span> variable_value { |
---|
34 | <span class="bold"><strong>public</strong></span>: |
---|
35 | <span class="emphasis"><em>// <a href="variable_value.html#variable_valueconstruct-copy-destruct">construct/copy/destruct</a></em></span> |
---|
36 | <a href="variable_value.html#id2452057-bb">variable_value</a>(); |
---|
37 | <a href="variable_value.html#id2452059-bb">variable_value</a>(<span class="bold"><strong>const</strong></span> boost::any &, <span class="bold"><strong>bool</strong></span>); |
---|
38 | |
---|
39 | <span class="emphasis"><em>// <a href="variable_value.html#id2341076-bb">public member functions</a></em></span> |
---|
40 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <span class="type"><span class="bold"><strong>const</strong></span> T &</span> <a href="variable_value.html#id2341081-bb">as</a>() <span class="bold"><strong>const</strong></span>; |
---|
41 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <span class="type">T &</span> <a href="variable_value.html#id2380778-bb">as</a>() ; |
---|
42 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="variable_value.html#id2380808-bb">empty</a>() <span class="bold"><strong>const</strong></span>; |
---|
43 | <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="variable_value.html#id2378486-bb">defaulted</a>() <span class="bold"><strong>const</strong></span>; |
---|
44 | <span class="type"><span class="bold"><strong>const</strong></span> boost::any &</span> <a href="variable_value.html#id2378507-bb">value</a>() <span class="bold"><strong>const</strong></span>; |
---|
45 | <span class="type">boost::any &</span> <a href="variable_value.html#id2336963-bb">value</a>() ; |
---|
46 | };</pre></div> |
---|
47 | <div class="refsect1" lang="en"> |
---|
48 | <a name="id2728518"></a><h2>Description</h2> |
---|
49 | <p>Class holding value of option. Contains details about how the value is set and allows to conveniently obtain the value. </p> |
---|
50 | <div class="refsect2" lang="en"> |
---|
51 | <a name="id2728526"></a><h3> |
---|
52 | <a name="variable_valueconstruct-copy-destruct"></a><code class="computeroutput">variable_value</code> construct/copy/destruct</h3> |
---|
53 | <div class="orderedlist"><ol type="1"> |
---|
54 | <li><pre class="literallayout"><a name="id2452057-bb"></a>variable_value();</pre></li> |
---|
55 | <li><pre class="literallayout"><a name="id2452059-bb"></a>variable_value(<span class="bold"><strong>const</strong></span> boost::any & v, <span class="bold"><strong>bool</strong></span> defaulted);</pre></li> |
---|
56 | </ol></div> |
---|
57 | </div> |
---|
58 | <div class="refsect2" lang="en"> |
---|
59 | <a name="id2728586"></a><h3> |
---|
60 | <a name="id2341076-bb"></a><code class="computeroutput">variable_value</code> public member functions</h3> |
---|
61 | <div class="orderedlist"><ol type="1"> |
---|
62 | <li> |
---|
63 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <span class="type"><span class="bold"><strong>const</strong></span> T &</span> <a name="id2341081-bb"></a>as() <span class="bold"><strong>const</strong></span>;</pre> |
---|
64 | <p>If stored value if of type T, returns that value. Otherwise, throws boost::bad_any_cast exception. </p> |
---|
65 | </li> |
---|
66 | <li> |
---|
67 | <pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <span class="type">T &</span> <a name="id2380778-bb"></a>as() ;</pre> |
---|
68 | <p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </p> |
---|
69 | </li> |
---|
70 | <li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2380808-bb"></a>empty() <span class="bold"><strong>const</strong></span>;</pre></li> |
---|
71 | <li> |
---|
72 | <pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id2378486-bb"></a>defaulted() <span class="bold"><strong>const</strong></span>;</pre> |
---|
73 | <p>Returns true if the value was not explicitly given, but has default value. </p> |
---|
74 | </li> |
---|
75 | <li> |
---|
76 | <pre class="literallayout"><span class="type"><span class="bold"><strong>const</strong></span> boost::any &</span> <a name="id2378507-bb"></a>value() <span class="bold"><strong>const</strong></span>;</pre> |
---|
77 | <p>Returns the contained value. </p> |
---|
78 | </li> |
---|
79 | <li> |
---|
80 | <pre class="literallayout"><span class="type">boost::any &</span> <a name="id2336963-bb"></a>value() ;</pre> |
---|
81 | <p>Returns the contained value. </p> |
---|
82 | </li> |
---|
83 | </ol></div> |
---|
84 | </div> |
---|
85 | </div> |
---|
86 | </div> |
---|
87 | <table width="100%"><tr> |
---|
88 | <td align="left"></td> |
---|
89 | <td align="right"><small>Copyright © 2002-2004 Vladimir Prus</small></td> |
---|
90 | </tr></table> |
---|
91 | <hr> |
---|
92 | <div class="spirit-nav"> |
---|
93 | <a accesskey="p" href="bool_switch.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="program_options/reference.html#id2524541"><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="abstract_variables_map.html"><img src="images/next.png" alt="Next"></a> |
---|
94 | </div> |
---|
95 | </body> |
---|
96 | </html> |
---|