File: Poco.Util.OptionProcessor.html

package info (click to toggle)
poco-doc 1.3.6-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 10,076 kB
  • ctags: 9,611
  • sloc: makefile: 31
file content (75 lines) | stat: -rw-r--r-- 7,500 bytes parent folder | download | duplicates (2)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::Util::OptionProcessor</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.Util.html" class="namespace">Poco::Util</a></h1>
<h1 class="symbol">class OptionProcessor</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Util<br />
<b>Package:</b> Options<br />
<b>Header:</b> Poco/Util/OptionProcessor.h</p>
<h2>Description</h2>
<div class="description">
<p>An <a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a> is used to process the command line arguments of an application. </p>
<p>The <a href="Poco.Util.OptionProcessor.html#17127" title="Poco::Util::OptionProcessor::process()">process</a>() method takes an argument from the command line. If that argument starts with an option prefix, the argument is further processed. Otherwise, the argument is ignored and false is ignored. The argument must match one of the options given in the <a href="Poco.Util.OptionSet.html" title="class Poco::Util::OptionSet">OptionSet</a> that is passed to the <a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a> with the constructor. If an option is part of a group, at most one option of the group can be passed to the <a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a>. Otherwise an <a href="Poco.Util.IncompatibleOptionsException.html" title="class Poco::Util::IncompatibleOptionsException">IncompatibleOptionsException</a> is thrown. If the same option is given multiple times, but the option is not repeatable, a <a href="Poco.Util.DuplicateOptionException.html" title="class Poco::Util::DuplicateOptionException">DuplicateOptionException</a> is thrown. If the option is not recognized, a <a href="Poco.Util.UnexpectedArgumentException.html" title="class Poco::Util::UnexpectedArgumentException">UnexpectedArgumentException</a> is thrown. If the option requires an argument, but none is given, an <a href="Poco.Util.MissingArgumentException.html" title="class Poco::Util::MissingArgumentException">MissingArgumentException</a> is thrown. If no argument is expected, but one is present, a <a href="Poco.Util.UnexpectedArgumentException.html" title="class Poco::Util::UnexpectedArgumentException">UnexpectedArgumentException</a> is thrown. If a partial option name is ambiguous, an <a href="Poco.Util.AmbiguousOptionException.html" title="class Poco::Util::AmbiguousOptionException">AmbiguousOptionException</a> is thrown. </p>
<p>The <a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a> supports two modes: Unix mode and default mode. In Unix mode, the option prefix is a dash '-'. A dash must be followed by a short option name, or another dash, followed by a (partial) long option name. In default mode, the option prefix is a slash '/', followed by  a (partial) long option name. If the special option '&mdash;' is encountered in Unix mode, all following options are ignored. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Util.OptionProcessor.html#17131" title="Poco::Util::OptionProcessor::checkRequired()">checkRequired</a>, <a href="Poco.Util.OptionProcessor.html#17126" title="Poco::Util::OptionProcessor::isUnixStyle()">isUnixStyle</a>, <a href="Poco.Util.OptionProcessor.html#17127" title="Poco::Util::OptionProcessor::process()">process</a>, <a href="Poco.Util.OptionProcessor.html#17124" title="Poco::Util::OptionProcessor::setUnixStyle()">setUnixStyle</a></p>
<h2>Constructors</h2>
<h3><a name="17121">OptionProcessor</a></h3>
<p class="decl"><a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.Util.OptionSet.html" title="class Poco::Util::OptionSet">OptionSet</a> &amp; options<br />);</p>
<div class="description">
<p>Creates the <a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a>, using the given <a href="Poco.Util.OptionSet.html" title="class Poco::Util::OptionSet">OptionSet</a>. </p>
</div>
<h2>Destructor</h2>
<h3><a name="17123">~OptionProcessor</a></h3>
<p class="decl">~<a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.Util.OptionProcessor.html" title="class Poco::Util::OptionProcessor">OptionProcessor</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="17131">checkRequired</a></h3>
<p class="decl">void checkRequired() const;</p>
<div class="description">
<p>Checks if all required options have been processed. </p>
<p>Does nothing if all required options have been processed. Throws a <a href="Poco.Util.MissingOptionException.html" title="class Poco::Util::MissingOptionException">MissingOptionException</a> otherwise. </p>
</div>
<h3><a name="17126">isUnixStyle</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">bool isUnixStyle() const;</p>
<div class="description">
<p>Returns true if and only if Unix-style option processing is enabled. </p>
</div>
<h3><a name="17127">process</a></h3>
<p class="decl">bool process(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; argument,<br />&nbsp;&nbsp;&nbsp;&nbsp;std::string &amp; optionName,<br />&nbsp;&nbsp;&nbsp;&nbsp;std::string &amp; optionArg<br />);</p>
<div class="description">
<p>Examines and processes the given command line argument. </p>
<p>If the argument begins with an option prefix, the option is processed and true is returned. The full option name is stored in optionName and the  option argument, if present, is stored in optionArg. </p>
<p>If the option does not begin with an option prefix, false is returned. </p>
</div>
<h3><a name="17124">setUnixStyle</a></h3>
<p class="decl">void setUnixStyle(<br />&nbsp;&nbsp;&nbsp;&nbsp;bool flag<br />);</p>
<div class="description">
<p>Enables (flag == true) or disables (flag == false) Unix-style option processing. </p>
<p>If Unix-style processing is enabled, options are expected to begin with a single or a double dash ('-' or '&mdash;', respectively). A single dash must be followed by a short option name. A double dash must be followed by a (partial) full option name. </p>
<p>If Unix-style processing is disabled, options are expected to begin with a slash ('/'), followed by a (partial) full option name. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>