mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-12 13:46:02 -04:00
added note on xor
This commit is contained in:
parent
a15700d36d
commit
0f874b5e90
@ -654,6 +654,28 @@ wasn't matched, it will also return <constant>FALSE</constant>.)
|
|||||||
throw("Very bad things...");
|
throw("Very bad things...");
|
||||||
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
|
It is helpful to note that <classname>Arg</classname>s of any type can be xor'd together.
|
||||||
|
This means that you can xor a <classname>SwitchArg</classname> with a <classname>ValueArg</classname>.
|
||||||
|
This is helpful in situations where one of several options is necessary and one of the options
|
||||||
|
requires additional information.
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
|
||||||
|
SwitchArg sss("s", "stdin", "read from STDIN", false);
|
||||||
|
ValueArg<string> fff("f", "file", "read from file", false, "/dev/null", "string");
|
||||||
|
ValueArg<string> uuu("u", "url", "read from URL", false, "http://example.com", "string");
|
||||||
|
|
||||||
|
vector<Arg*> xorlist;
|
||||||
|
xorlist.push_back(&sss);
|
||||||
|
xorlist.push_back(&fff);
|
||||||
|
xorlist.push_back(&uuu);
|
||||||
|
|
||||||
|
cmd.xorAdd( xorlist );
|
||||||
|
|
||||||
|
</programlisting>
|
||||||
|
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user