summaryrefslogtreecommitdiff
path: root/doc/html/typed_value.html
blob: 6f8f57f02e6cc5831f846c1aaa64b06046e51ea5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Class template typed_value</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="index.html" title="The Boost C++ Libraries">
<link rel="up" href="program_options/reference.html#id857530" title="Header &lt;boost/program_options/value_semantic.hpp&gt;">
<link rel="prev" href="id683292.html" title="Class positional_options_description">
<link rel="next" href="untyped_value.html" title="Class untyped_value">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%">
<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td>
<td align="center"><a href="../../index.htm">Home</a></td>
<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="../../people/people.htm">People</a></td>
<td align="center"><a href="../../more/faq.htm">FAQ</a></td>
<td align="center"><a href="../../more/index.htm">More</a></td>
</table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="id683292.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="program_options/reference.html#id857530"><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="untyped_value.html"><img src="images/next.png" alt="Next"></a>
</div>
<div class="refentry" lang="en">
<a name="typed_value"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template typed_value</span></h2>
<p>boost::program_options::typed_value &#8212; </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T, <span class="bold"><strong>typename</strong></span> charT = <span class="bold"><strong>char</strong></span>&gt; 
<span class="bold"><strong>class</strong></span> typed_value
  :  : <span class="bold"><strong>public</strong></span> boost::program_options::value_semantic_codecvt_helper&lt; charT &gt;
{
<span class="bold"><strong>public</strong></span>:
  <span class="emphasis"><em>// <a href="typed_value.html#typed_valueconstruct-copy-destruct">construct/copy/destruct</a></em></span>
  <a href="typed_value.html#id1113060-bb">typed_value</a>(T *);

  <span class="emphasis"><em>// <a href="typed_value.html#id934494-bb">public member functions</a></em></span>
  <span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a href="typed_value.html#id934499-bb">default_value</a>(<span class="bold"><strong>const</strong></span> T &amp;) ;
  <span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a href="typed_value.html#id797160-bb">default_value</a>(<span class="bold"><strong>const</strong></span> T &amp;, <span class="bold"><strong>const</strong></span> std::string &amp;) ;
  <span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a href="typed_value.html#id1008859-bb">notifier</a>(function1&lt; <span class="bold"><strong>void</strong></span>, <span class="bold"><strong>const</strong></span>  T &amp; &gt;) ;
  <span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a href="typed_value.html#id760792-bb">composing</a>() ;
  <span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a href="typed_value.html#id1112969-bb">multitoken</a>() ;
  <span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a href="typed_value.html#id658034-bb">zero_tokens</a>() ;
  <span class="type">std::string</span> <a href="typed_value.html#id798654-bb">name</a>() <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="typed_value.html#id998228-bb">is_composing</a>() <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>unsigned</strong></span></span> <a href="typed_value.html#id998241-bb">min_tokens</a>() <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>unsigned</strong></span></span> <a href="typed_value.html#id998254-bb">max_tokens</a>() <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="typed_value.html#id908506-bb">xparse</a>(boost::any &amp;, <span class="bold"><strong>const</strong></span> std::vector&lt; std::basic_string&lt; charT &gt; &gt; &amp;) <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>virtual</strong></span> <span class="bold"><strong>bool</strong></span></span> <a href="typed_value.html#id1104904-bb">apply_default</a>(boost::any &amp;) <span class="bold"><strong>const</strong></span>;
  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="typed_value.html#id1104938-bb">notify</a>(<span class="bold"><strong>const</strong></span> boost::any &amp;) <span class="bold"><strong>const</strong></span>;
};</pre></div>
<div class="refsect1" lang="en">
<a name="id1257056"></a><h2>Description</h2>
<p>Class which handles value of a specific type. </p>
<div class="refsect2" lang="en">
<a name="id1257063"></a><h3>
<a name="typed_valueconstruct-copy-destruct"></a><code class="computeroutput">typed_value</code> construct/copy/destruct</h3>
<div class="orderedlist"><ol type="1"><li>
<pre class="literallayout"><a name="id1113060-bb"></a>typed_value(T * store_to);</pre>
<p>Ctor. The 'store_to' parameter tells where to store the value when it's known. The parameter can be NULL. </p>
</li></ol></div>
</div>
<div class="refsect2" lang="en">
<a name="id1257100"></a><h3>
<a name="id934494-bb"></a><code class="computeroutput">typed_value</code> public member functions</h3>
<div class="orderedlist"><ol type="1">
<li>
<pre class="literallayout"><span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a name="id934499-bb"></a>default_value(<span class="bold"><strong>const</strong></span> T &amp; v) ;</pre>
<p>Specifies default value, which will be used if none is explicitly specified. The type 'T' should provide operator&lt;&lt; for ostream. </p>
</li>
<li>
<pre class="literallayout"><span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a name="id797160-bb"></a>default_value(<span class="bold"><strong>const</strong></span> T &amp; v, <span class="bold"><strong>const</strong></span> std::string &amp; textual) ;</pre>
<p>Specifies default value, which will be used if none is explicitly specified. Unlike the above overload, the type 'T' need not provide operator&lt;&lt; for ostream, but textual representation of default value must be provided by the user. </p>
</li>
<li>
<pre class="literallayout"><span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a name="id1008859-bb"></a>notifier(function1&lt; <span class="bold"><strong>void</strong></span>, <span class="bold"><strong>const</strong></span>  T &amp; &gt; f) ;</pre>
<p>Specifies a function to be called when the final value is determined. </p>
</li>
<li>
<pre class="literallayout"><span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a name="id760792-bb"></a>composing() ;</pre>
<p>Specifies that the value is composing. See the 'is_composing' method for explanation. </p>
</li>
<li>
<pre class="literallayout"><span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a name="id1112969-bb"></a>multitoken() ;</pre>
<p>Specifies that the value can span multiple tokens. </p>
</li>
<li><pre class="literallayout"><span class="type"><a href="typed_value.html" title="Class template typed_value">typed_value</a> *</span> <a name="id658034-bb"></a>zero_tokens() ;</pre></li>
<li><pre class="literallayout"><span class="type">std::string</span> <a name="id798654-bb"></a>name() <span class="bold"><strong>const</strong></span>;</pre></li>
<li><pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id998228-bb"></a>is_composing() <span class="bold"><strong>const</strong></span>;</pre></li>
<li><pre class="literallayout"><span class="type"><span class="bold"><strong>unsigned</strong></span></span> <a name="id998241-bb"></a>min_tokens() <span class="bold"><strong>const</strong></span>;</pre></li>
<li><pre class="literallayout"><span class="type"><span class="bold"><strong>unsigned</strong></span></span> <a name="id998254-bb"></a>max_tokens() <span class="bold"><strong>const</strong></span>;</pre></li>
<li>
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id908506-bb"></a>xparse(boost::any &amp; value_store, 
            <span class="bold"><strong>const</strong></span> std::vector&lt; std::basic_string&lt; charT &gt; &gt; &amp; new_tokens) <span class="bold"><strong>const</strong></span>;</pre>
<p>Creates an instance of the 'validator' class and calls its operator() to perform athe ctual conversion. </p>
</li>
<li>
<pre class="literallayout"><span class="type"><span class="bold"><strong>virtual</strong></span> <span class="bold"><strong>bool</strong></span></span> <a name="id1104904-bb"></a>apply_default(boost::any &amp; value_store) <span class="bold"><strong>const</strong></span>;</pre>
<p>If default value was specified via previous call to 'default_value', stores that value into 'value_store'. Returns true if default value was stored. </p>
</li>
<li>
<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id1104938-bb"></a>notify(<span class="bold"><strong>const</strong></span> boost::any &amp; value_store) <span class="bold"><strong>const</strong></span>;</pre>
<p>If an address of variable to store value was specified when creating *this, stores the value there. Otherwise, does nothing. </p>
</li>
</ol></div>
</div>
</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"><small>Copyright © 2002-2004 Vladimir Prus</small></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="id683292.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="program_options/reference.html#id857530"><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="untyped_value.html"><img src="images/next.png" alt="Next"></a>
</div>
</body>
</html>