1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" |
---|
3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> |
---|
4 | <library |
---|
5 | name="Program_options" |
---|
6 | dirname="program_options" id="program_options" |
---|
7 | last-revision="$Date: 2004/07/30 13:20:27 $" |
---|
8 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
---|
9 | <libraryinfo> |
---|
10 | <author> |
---|
11 | <firstname>Vladimir</firstname> |
---|
12 | <surname>Prus</surname> |
---|
13 | </author> |
---|
14 | |
---|
15 | <copyright> |
---|
16 | <year>2002</year> |
---|
17 | <year>2003</year> |
---|
18 | <year>2004</year> |
---|
19 | <holder>Vladimir Prus</holder> |
---|
20 | </copyright> |
---|
21 | |
---|
22 | <legalnotice> |
---|
23 | <para>Distributed under the Boost Software License, Version 1.0. |
---|
24 | (See accompanying file <filename>LICENSE_1_0.txt</filename> or copy at |
---|
25 | <ulink |
---|
26 | url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>) |
---|
27 | </para> |
---|
28 | </legalnotice> |
---|
29 | |
---|
30 | |
---|
31 | <librarypurpose> |
---|
32 | Facilities to obtain configuration data from command line, config files |
---|
33 | and other sources</librarypurpose> |
---|
34 | <librarycategory name="category:data-structures"></librarycategory> |
---|
35 | </libraryinfo> |
---|
36 | |
---|
37 | <title>Boost.Program_options</title> |
---|
38 | |
---|
39 | <section> |
---|
40 | <title>Introduction</title> |
---|
41 | |
---|
42 | <para>The program_options library allows program developers to obtain |
---|
43 | <emphasis>program options</emphasis>, that is (name, value) pairs from the user, |
---|
44 | via conventional methods such as command line and config file.</para> |
---|
45 | |
---|
46 | <para>Why would you use such a library, and why is it better than parsing |
---|
47 | your command line by straightforward hand-written code? |
---|
48 | <itemizedlist> |
---|
49 | <listitem> |
---|
50 | <para>It's easier. The syntax for declaring options is simple, and |
---|
51 | the library itself is small. Things like conversion of option values to |
---|
52 | desired type and storing into program variables are handled |
---|
53 | automatically. |
---|
54 | </para> |
---|
55 | </listitem> |
---|
56 | <listitem> |
---|
57 | <para>Error reporting is better. All the problems with the command line are |
---|
58 | reported, while hand-written code can just misparse the input. In |
---|
59 | addition, the usage message can be automatically generated, to |
---|
60 | avoid falling out of sync with the real list of options.</para> |
---|
61 | </listitem> |
---|
62 | <listitem> |
---|
63 | <para>Options can be read from anywhere. Sooner or later the command |
---|
64 | line will be not enough for your users, and you'll want config files |
---|
65 | or maybe even environment variables. These can be added without significant |
---|
66 | effort on your part. |
---|
67 | </para> |
---|
68 | </listitem> |
---|
69 | </itemizedlist> |
---|
70 | </para> |
---|
71 | |
---|
72 | <para> |
---|
73 | Now let's see some examples of the library usage in the <xref |
---|
74 | linkend="program_options.tutorial"/>. |
---|
75 | </para> |
---|
76 | |
---|
77 | </section> |
---|
78 | |
---|
79 | <xi:include href="tutorial.xml"/> |
---|
80 | <xi:include href="overview.xml"/> |
---|
81 | |
---|
82 | <xi:include href="howto.xml"/> |
---|
83 | <xi:include href="design.xml"/> |
---|
84 | <xi:include href="acknowledgements.xml"/> |
---|
85 | |
---|
86 | <xi:include href="autodoc.boostbook"/> |
---|
87 | </library> |
---|